...
|
...
|
@@ -16,7 +16,10 @@ class Xmpp.Views.Chat.WindowView extends Backbone.View
|
16
|
16
|
@historyStack = []
|
17
|
17
|
|
18
|
18
|
render: ->
|
19
|
|
- $(@el).html(@template(showWriter: true))
|
|
19
|
+ historyStackHtml = _.map(@historyStack, (view) ->
|
|
20
|
+ view.render().el.outerHTML
|
|
21
|
+ )
|
|
22
|
+ $(@el).html(@template(showWriter: true, history: historyStackHtml))
|
20
|
23
|
@show()
|
21
|
24
|
return this
|
22
|
25
|
|
...
|
...
|
@@ -70,4 +73,11 @@ class Xmpp.Views.Chat.WindowView extends Backbone.View
|
70
|
70
|
appendMessage: (user, date, msg) ->
|
71
|
71
|
messageView = new Xmpp.Views.Chat.MessageView(user: user, date: date, message: msg)
|
72
|
72
|
$(@el).find('.messages').append(messageView.render().el)
|
73
|
|
- App.UI.resizeMessages()
|
74
|
73
|
\ No newline at end of file
|
|
74
|
+ App.UI.resizeMessages()
|
|
75
|
+ @log(messageView)
|
|
76
|
+
|
|
77
|
+ log: (view) ->
|
|
78
|
+ if (@historyStack.length + 1 >= @maxHistoryLength)
|
|
79
|
+ @historyStack = @historyStack.slice(@historyStack.length - @maxHistoryLength + 1)
|
|
80
|
+
|
|
81
|
+ @historyStack.push(view)
|
75
|
82
|
\ No newline at end of file
|