1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00
Radarr/UI/Shared/NotificationModel.js
2013-04-18 16:14:38 -07:00

39 lines
1.0 KiB
JavaScript

"use strict";
define(['app'], function () {
NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
mutators: {
preFormattedMessage: function () {
return this.get('message').replace(/\\r\\n/g, '<br>');
},
isPreFormatted: function () {
return this.get('message').indexOf('\\r\\n') !== -1;
},
iconClass: function () {
if (this.has('icon')) {
return 'icon';
}
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 "";
}
},
defaults: {
"level" : 'info',
"title" : '',
"message": ''
}
});
});