|
|
@ -2,7 +2,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
define([
|
|
|
|
define([
|
|
|
|
'app',
|
|
|
|
'app',
|
|
|
|
'Settings/Notifications/Model'
|
|
|
|
'Settings/Notifications/Model',
|
|
|
|
|
|
|
|
'Settings/Notifications/DeleteView'
|
|
|
|
|
|
|
|
|
|
|
|
], function () {
|
|
|
|
], function () {
|
|
|
|
|
|
|
|
|
|
|
@ -10,14 +11,15 @@ define([
|
|
|
|
template : 'Settings/Notifications/EditTemplate',
|
|
|
|
template : 'Settings/Notifications/EditTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .x-save': 'save'
|
|
|
|
'click .x-save': '_saveNotification',
|
|
|
|
|
|
|
|
'click .x-remove': '_deleteNotification'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
initialize: function (options) {
|
|
|
|
this.notificationCollection = options.notificationCollection;
|
|
|
|
this.notificationCollection = options.notificationCollection;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
save: function () {
|
|
|
|
_saveNotification: function () {
|
|
|
|
var name = this.model.get('name');
|
|
|
|
var name = this.model.get('name');
|
|
|
|
var success = 'Notification Saved: ' + name;
|
|
|
|
var success = 'Notification Saved: ' + name;
|
|
|
|
var fail = 'Failed to save notification: ' + name;
|
|
|
|
var fail = 'Failed to save notification: ' + name;
|
|
|
@ -25,6 +27,11 @@ define([
|
|
|
|
this.model.save(undefined, this.syncNotification(success, fail, this));
|
|
|
|
this.model.save(undefined, this.syncNotification(success, fail, this));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_deleteNotification: function () {
|
|
|
|
|
|
|
|
var view = new NzbDrone.Settings.Notifications.DeleteView({ model: this.model });
|
|
|
|
|
|
|
|
NzbDrone.modalRegion.show(view);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
syncNotification: function (success, error, context) {
|
|
|
|
syncNotification: function (success, error, context) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
success: function () {
|
|
|
|
success: function () {
|
|
|
|