Initial commit
This commit is contained in:
25
lib/assets/javascripts/dashboard/data/flash-message-model.js
Normal file
25
lib/assets/javascripts/dashboard/data/flash-message-model.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const Backbone = require('backbone');
|
||||
|
||||
module.exports = Backbone.Model.extend({
|
||||
defaults: {
|
||||
msg: '',
|
||||
type: 'error',
|
||||
display: false
|
||||
},
|
||||
|
||||
shouldDisplay: function () {
|
||||
return this.get('display') && !!this.get('msg') && !!this.get('type');
|
||||
},
|
||||
|
||||
show: function (message, type) {
|
||||
return this.set({
|
||||
display: true,
|
||||
msg: message,
|
||||
type: type
|
||||
});
|
||||
},
|
||||
|
||||
hide: function () {
|
||||
this.set('display', false);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user