Move some initial setup to the 'opened' event
Avoid inbox views digging too deep into conversation views. // FREEBIE
This commit is contained in:
parent
2861fa26a7
commit
2ee8cae8d4
2 changed files with 9 additions and 4 deletions
|
@ -27,7 +27,7 @@
|
||||||
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);
|
||||||
this.listenTo(this.model, 'opened', this.focusMessageField);
|
this.listenTo(this.model, 'opened', this.onOpened);
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
twemoji.parse(this.el, { base: '/images/twemoji/', size: 16 });
|
twemoji.parse(this.el, { base: '/images/twemoji/', size: 16 });
|
||||||
|
@ -85,6 +85,14 @@
|
||||||
'click .choose-file': 'focusMessageField',
|
'click .choose-file': 'focusMessageField',
|
||||||
'loadMore .message-list': 'fetchMessages'
|
'loadMore .message-list': 'fetchMessages'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onOpened: function() {
|
||||||
|
this.view.resetScrollPosition();
|
||||||
|
this.$el.trigger('force-resize');
|
||||||
|
this.focusMessageField();
|
||||||
|
this.model.markRead();
|
||||||
|
},
|
||||||
|
|
||||||
focusMessageField: function() {
|
focusMessageField: function() {
|
||||||
this.$messageField.focus();
|
this.$messageField.focus();
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,9 +56,6 @@
|
||||||
$el = view.$el;
|
$el = view.$el;
|
||||||
}
|
}
|
||||||
$el.prependTo(this.el);
|
$el.prependTo(this.el);
|
||||||
$el.find('.message-list').trigger('reset-scroll');
|
|
||||||
$el.trigger('force-resize');
|
|
||||||
conversation.markRead();
|
|
||||||
conversation.trigger('opened');
|
conversation.trigger('opened');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue