Refactor content message class names

This commit is contained in:
lilia 2015-02-17 23:36:20 -08:00
parent 94c94eb7c9
commit 4716754209
4 changed files with 6 additions and 8 deletions

View file

@ -39,12 +39,14 @@
this.template = $('#message').html();
Mustache.parse(this.template);
},
className: function() {
if (this.model.get('delivered')) { return 'delivered'; }
},
render: function() {
this.$el.html(
Mustache.render(this.template, {
message: this.model.get('body'),
timestamp: moment(this.model.get('received_at')).fromNow(),
bubble_class: this.model.get('type') === 'outgoing' ? 'sent' : 'incoming',
sender: this.model.get('source')
})
);
@ -55,10 +57,6 @@
})
);
if (this.model.get('delivered')) {
this.$el.addClass('delivered');
}
var errors = this.model.get('errors');
if (errors && errors.length) {
this.$el.find('.bubble').append(