1 /*globals View render_template*/
2 var FlashView = View.extend({
3 template: 'flash-view-template',
5 init: function(element, model, template) {
6 this.shownMessage = null;
7 this._super(element, model, template);
11 setModel: function(model) {
13 this.model.removeObserver(this);
16 this.shownMessage = null;
18 this.shownMessage = this.model.get('firstFlashMessage');
19 this.model.addObserver(this, 'firstFlashMessage', this.modelFirstFlashMessageChanged.bind(this));
25 this.element.html(render_template(this.template, this));
28 modelFirstFlashMessageChanged: function(property, value) {
29 this.element.fadeOut('slow', function() {
30 this.shownMessage = value;
32 this.element.fadeIn('slow');