Add new Last Seen Indicator with unread count, scroll to it
This is to ensure that when there are a lot of unread messages, the user is given the chance to see all of them by being scrolled to the oldest new message. When a new message comes in, the indicator will be incremented. When the user sends a message or switches away from the conversation, the last seen indicator will be removed. FREEBIEpull/749/head
parent
bec69826ae
commit
fed26c36ca
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* vim: ts=4:sw=4:expandtab
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.LastSeenIndicatorView = Whisper.View.extend({
|
||||
className: 'last-seen-indicator-view',
|
||||
templateName: 'last-seen-indicator-view',
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.count = options.count || 0;
|
||||
},
|
||||
|
||||
increment: function(count) {
|
||||
this.count += count;
|
||||
this.render();
|
||||
},
|
||||
|
||||
render_attributes: function() {
|
||||
var unreadMessages = this.count === 1 ? i18n('unreadMessage')
|
||||
: i18n('unreadMessages', [this.count]);
|
||||
|
||||
return {
|
||||
unreadMessages: unreadMessages
|
||||
};
|
||||
}
|
||||
});
|
||||
})();
|
Loading…
Reference in New Issue