mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Better message handling on save
This commit is contained in:
parent
03c085030e
commit
ef58acb4b5
7 changed files with 63 additions and 64 deletions
|
@ -24,7 +24,12 @@ define([
|
|||
var success = 'Notification Saved: ' + name;
|
||||
var fail = 'Failed to save notification: ' + name;
|
||||
|
||||
this.model.save(undefined, this.syncNotification(success, fail, this));
|
||||
this.model.save(undefined, NzbDrone.Settings.SyncNotificaiton.callback({
|
||||
successMessage: success,
|
||||
errorMessage: fail,
|
||||
successCallback: this._saveSuccess,
|
||||
context: this
|
||||
}));
|
||||
},
|
||||
|
||||
_deleteNotification: function () {
|
||||
|
@ -32,21 +37,9 @@ define([
|
|||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
|
||||
syncNotification: function (success, error, context) {
|
||||
return {
|
||||
success: function () {
|
||||
NzbDrone.Shared.Messenger.show({
|
||||
message: success
|
||||
});
|
||||
|
||||
context.notificationCollection.add(context.model, { merge: true });
|
||||
NzbDrone.modalRegion.closeModal();
|
||||
},
|
||||
|
||||
error: function () {
|
||||
window.alert(error);
|
||||
}
|
||||
};
|
||||
_saveSuccess: function () {
|
||||
this.notificationCollection.add(this.model, { merge: true });
|
||||
NzbDrone.modalRegion.closeModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue