mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Save and add, notif settings cleanup
This commit is contained in:
parent
7f59062215
commit
f7c340d795
15 changed files with 151 additions and 43 deletions
|
@ -2,23 +2,54 @@
|
|||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (Marionette, AsModelBoundView) {
|
||||
], function (App, Marionette, AsModelBoundView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/EditTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-save': 'save'
|
||||
'click .x-save': '_save',
|
||||
'click .x-save-and-add': '_saveAndAdd'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.indexerCollection = options.indexerCollection;
|
||||
},
|
||||
|
||||
save: function () {
|
||||
this.model.saveSettings();
|
||||
_save: function () {
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
App.modalRegion.closeModal();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_saveAndAdd: function () {
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
|
||||
self.model.set({
|
||||
id: undefined,
|
||||
name: '',
|
||||
enable: false
|
||||
});
|
||||
|
||||
_.each(self.model.get('fields'), function (value, key, list) {
|
||||
self.model.set('fields.' + key +'.value', '');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue