Cable-Desktop/js/views/message_list_view.js
lilia c0681beca7 Consolidate message callbacks
Register the runtime callback at the top level view rather than having
each conversation view register independently.
Also refactors Layout into InboxView.
2014-11-24 19:25:03 -08:00

25 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();
},
});
})();