/
notice.js
33 lines (28 loc) · 853 Bytes
/
notice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
App.Views.Notice = Backbone.View.extend({
className: "success",
displayLength: 5000,
defaultMessage: '',
initialize: function() {
_.bindAll(this, 'render');
this.message = this.options.message || this.defaultMessage;
this.render();
},
render: function() {
var view = this;
$(this.el).html(this.message);
$(this.el).hide();
$('#notice').html(this.el);
$(this.el).slideDown();
$.doTimeout(this.displayLength, function() {
$(view.el).slideUp();
$.doTimeout(2000, function() {
view.remove();
});
});
return this;
}
});
App.Views.Error = App.Views.Notice.extend({
className: "error",
defaultMessage: 'Uh oh! Something went wrong. Please try again.'
});