Update conversation header avatar if it changes
// FREEBIE
This commit is contained in:
parent
a8e02a94be
commit
4418be19d4
1 changed files with 9 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
},
|
},
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
this.listenTo(this.model, 'destroy', this.stopListening);
|
this.listenTo(this.model, 'destroy', this.stopListening);
|
||||||
|
this.listenTo(this.model, 'change:avatar', this.updateAvatar);
|
||||||
this.listenTo(this.model, 'change:name', this.updateTitle);
|
this.listenTo(this.model, 'change:name', this.updateTitle);
|
||||||
this.listenTo(this.model, 'newmessage', this.addMessage);
|
this.listenTo(this.model, 'newmessage', this.addMessage);
|
||||||
this.listenTo(this.model, 'change:unreadCount', this.onUnread);
|
this.listenTo(this.model, 'change:unreadCount', this.onUnread);
|
||||||
|
@ -221,6 +222,14 @@
|
||||||
this.$('.conversation-title').text(this.model.getTitle());
|
this.$('.conversation-title').text(this.model.getTitle());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateAvatar: function() {
|
||||||
|
var avatarView = new (Whisper.View.extend({
|
||||||
|
templateName: 'avatar',
|
||||||
|
render_attributes: { avatar: this.model.getAvatar() }
|
||||||
|
}))();
|
||||||
|
this.$('.conversation-header .avatar').replaceWith(avatarView.render().$('.avatar'));
|
||||||
|
},
|
||||||
|
|
||||||
updateMessageFieldSize: function (event) {
|
updateMessageFieldSize: function (event) {
|
||||||
var keyCode = event.which || event.keyCode;
|
var keyCode = event.which || event.keyCode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue