Update display when contact colors change

// FREEBIE
This commit is contained in:
lilia
2016-09-11 15:03:05 -07:00
parent 6a4b720b89
commit edd6f58539
3 changed files with 37 additions and 8 deletions

View File

@@ -39,7 +39,7 @@
},
initialize: function(options) {
this.listenTo(this.model, 'destroy', this.stopListening);
this.listenTo(this.model, 'change:avatar', this.updateAvatar);
this.listenTo(this.model, 'change:color', this.updateColor);
this.listenTo(this.model, 'change:name', this.updateTitle);
this.listenTo(this.model, 'newmessage', this.addMessage);
this.listenTo(this.model, 'opened', this.onOpened);
@@ -319,12 +319,17 @@
this.$('.conversation-title').text(this.model.getTitle());
},
updateAvatar: function() {
updateColor: function(model, color) {
var header = this.$('.conversation-header');
header.removeClass(Whisper.Conversation.COLORS);
if (color) {
header.addClass(color);
}
var avatarView = new (Whisper.View.extend({
templateName: 'avatar',
render_attributes: { avatar: this.model.getAvatar() }
}))();
this.$('.conversation-header .avatar').replaceWith(avatarView.render().$('.avatar'));
header.find('.avatar').replaceWith(avatarView.render().$('.avatar'));
},
updateMessageFieldSize: function (event) {