2014-07-22 20:55:26 +02:00
|
|
|
var Whisper = Whisper || {};
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Whisper.MessageListView = Whisper.ListView.extend({
|
|
|
|
tagName: 'ul',
|
2014-07-28 00:12:59 +02:00
|
|
|
className: 'discussion',
|
2014-11-11 08:16:46 +01:00
|
|
|
itemView: Whisper.MessageView,
|
|
|
|
events: {
|
|
|
|
'add': 'scrollToBottom'
|
|
|
|
},
|
|
|
|
scrollToBottom: function() {
|
|
|
|
this.$el.scrollTop(this.el.scrollHeight);
|
|
|
|
},
|
2014-11-13 23:35:37 +01:00
|
|
|
addAll: function() {
|
|
|
|
this.$el.html('');
|
|
|
|
this.collection.each(function(model) {
|
|
|
|
var view = new this.itemView({model: model});
|
|
|
|
this.$el.prepend(view.render().el);
|
2014-11-16 22:19:51 +01:00
|
|
|
}, this);
|
2014-11-17 00:30:40 +01:00
|
|
|
this.scrollToBottom();
|
2014-11-13 23:35:37 +01:00
|
|
|
},
|
2014-07-22 20:55:26 +02:00
|
|
|
});
|
|
|
|
})();
|