You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
597 B
JavaScript
26 lines
597 B
JavaScript
var Whisper = Whisper || {};
|
|
|
|
(function () {
|
|
'use strict';
|
|
|
|
Whisper.MessageListView = Whisper.ListView.extend({
|
|
tagName: 'ul',
|
|
className: 'discussion',
|
|
itemView: Whisper.MessageView,
|
|
events: {
|
|
'add': 'scrollToBottom'
|
|
},
|
|
scrollToBottom: function() {
|
|
this.$el.scrollTop(this.el.scrollHeight);
|
|
},
|
|
addAll: function() {
|
|
this.$el.html('');
|
|
this.collection.each(function(model) {
|
|
var view = new this.itemView({model: model});
|
|
this.$el.prepend(view.render().el);
|
|
}, this);
|
|
this.scrollToBottom();
|
|
},
|
|
});
|
|
})();
|