signal-desktop/js/views/scroll_down_button_view.js

40 lines
877 B
JavaScript
Raw Normal View History

/*
* vim: ts=4:sw=4:expandtab
*/
2018-04-27 21:25:04 +00:00
(function() {
'use strict';
window.Whisper = window.Whisper || {};
2018-04-27 21:25:04 +00:00
Whisper.ScrollDownButtonView = Whisper.View.extend({
className: 'scroll-down-button-view',
templateName: 'scroll-down-button-view',
2018-04-27 21:25:04 +00:00
initialize: function(options) {
options = options || {};
this.count = options.count || 0;
},
2018-04-27 21:25:04 +00:00
increment: function(count) {
count = count || 0;
this.count += count;
this.render();
},
2018-04-27 21:25:04 +00:00
render_attributes: function() {
var cssClass = this.count > 0 ? 'new-messages' : '';
2018-04-27 21:25:04 +00:00
var moreBelow = i18n('scrollDown');
if (this.count > 1) {
moreBelow = i18n('messagesBelow');
} else if (this.count === 1) {
moreBelow = i18n('messageBelow');
}
2018-04-27 21:25:04 +00:00
return {
cssClass: cssClass,
moreBelow: moreBelow,
};
},
});
})();