2013-02-14 20:18:29 +03:00
|
|
|
define(['app'], function () {
|
|
|
|
|
|
|
|
NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
|
2013-03-30 02:28:58 +03:00
|
|
|
mutators: {
|
2013-02-15 06:10:03 +03:00
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
preFormattedMessage: function () {
|
2013-02-15 09:46:42 +03:00
|
|
|
return this.get('message').replace(/\\r\\n/g, '<br>');
|
|
|
|
},
|
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
isPreFormatted: function () {
|
2013-02-15 09:46:42 +03:00
|
|
|
return this.get('message').indexOf('\\r\\n') !== -1;
|
2013-02-14 20:18:29 +03:00
|
|
|
},
|
2013-02-15 09:46:42 +03:00
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
iconClass: function () {
|
2013-02-14 20:18:29 +03:00
|
|
|
|
|
|
|
if (this.has('icon')) {
|
2013-02-15 06:10:03 +03:00
|
|
|
return 'icon';
|
2013-02-14 20:18:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.get('level') === 'info') {
|
|
|
|
return "icon-info-sign";
|
|
|
|
} else if (this.get('level') === 'success') {
|
|
|
|
return 'icon-ok-sign';
|
|
|
|
} else if (this.get('level') === 'error') {
|
|
|
|
return 'icon-warning-sign';
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
2013-02-01 06:15:19 +03:00
|
|
|
}
|
2013-01-29 04:59:18 +03:00
|
|
|
},
|
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
defaults: {
|
|
|
|
"level" : 'info',
|
|
|
|
"title" : '',
|
|
|
|
"message": ''
|
2013-01-29 04:59:18 +03:00
|
|
|
}
|
2013-02-14 20:18:29 +03:00
|
|
|
});
|
|
|
|
});
|