signal-desktop/js/views/banner_view.js

38 lines
762 B
JavaScript
Raw Normal View History

/* global Whisper */
// eslint-disable-next-line func-names
2018-04-27 21:25:04 +00:00
(function() {
'use strict';
2018-04-27 21:25:04 +00:00
window.Whisper = window.Whisper || {};
2018-04-27 21:25:04 +00:00
Whisper.BannerView = Whisper.View.extend({
className: 'banner',
templateName: 'banner',
events: {
'click .dismiss': 'onDismiss',
'click .body': 'onClick',
},
initialize(options) {
2018-04-27 21:25:04 +00:00
this.message = options.message;
this.callbacks = {
onDismiss: options.onDismiss,
onClick: options.onClick,
};
this.render();
},
render_attributes() {
2018-04-27 21:25:04 +00:00
return {
message: this.message,
};
},
onDismiss(e) {
2018-04-27 21:25:04 +00:00
this.callbacks.onDismiss();
e.stopPropagation();
},
onClick() {
2018-04-27 21:25:04 +00:00
this.callbacks.onClick();
},
});
})();