1 _kiwi
.view
.StatusMessage
= Backbone
.View
.extend({
2 initialize: function () {
5 // Timer for hiding the message after X seconds
9 text: function (text
, opt
) {
12 opt
.type
= opt
.type
|| '';
13 opt
.timeout
= opt
.timeout
|| 5000;
15 this.$el
.text(text
).addClass(opt
.type
);
16 this.$el
.slideDown($.proxy(_kiwi
.app
.view
.doLayout
, _kiwi
.app
.view
));
18 if (opt
.timeout
) this.doTimeout(opt
.timeout
);
21 html: function (html
, opt
) {
24 opt
.type
= opt
.type
|| '';
25 opt
.timeout
= opt
.timeout
|| 5000;
27 this.$el
.html(html
).addClass(opt
.type
);
28 this.$el
.slideDown($.proxy(_kiwi
.app
.view
.doLayout
, _kiwi
.app
.view
));
30 if (opt
.timeout
) this.doTimeout(opt
.timeout
);
34 this.$el
.slideUp($.proxy(_kiwi
.app
.view
.doLayout
, _kiwi
.app
.view
));
37 doTimeout: function (length
) {
38 if (this.tmr
) clearTimeout(this.tmr
);
40 this.tmr
= setTimeout(function () { that
.hide(); }, length
);