mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
fixed saving settings. now done more generically.
This commit is contained in:
parent
d126c6efc1
commit
806e58ed1f
13 changed files with 104 additions and 161 deletions
|
@ -1,11 +1,10 @@
|
|||
'use strict';
|
||||
define(['app',
|
||||
'marionette',
|
||||
'Shared/Messenger',
|
||||
'Settings/Indexers/ItemView',
|
||||
'Settings/Indexers/EditView',
|
||||
'Settings/Indexers/Collection'],
|
||||
function (App, Marionette, Messenger, IndexerItemView, IndexerEditView, IndexerCollection) {
|
||||
function (App, Marionette, IndexerItemView, IndexerEditView, IndexerCollection) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : IndexerItemView,
|
||||
itemViewContainer: '#x-indexers',
|
||||
|
@ -15,10 +14,6 @@ define(['app',
|
|||
'click .x-add': 'openSchemaModal'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(App.vent, App.Commands.SaveSettings, this._saveSettings);
|
||||
this.savedCount = 0;
|
||||
},
|
||||
|
||||
openSchemaModal: function () {
|
||||
var self = this;
|
||||
|
@ -36,28 +31,6 @@ define(['app',
|
|||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_saveSettings: function () {
|
||||
var self = this;
|
||||
|
||||
_.each(this.collection.models, function (model, index, list) {
|
||||
model.saveIfChanged(NzbDrone.Settings.SyncNotificaiton.callback({
|
||||
errorMessage : 'Failed to save indexer: ' + model.get('name'),
|
||||
successCallback: self._saveSuccessful,
|
||||
context : self
|
||||
}));
|
||||
});
|
||||
|
||||
if (self.savedCount > 0) {
|
||||
Messenger.show({message: 'Indexer settings saved'});
|
||||
}
|
||||
|
||||
this.savedCount = 0;
|
||||
},
|
||||
|
||||
_saveSuccessful: function () {
|
||||
this.savedCount++;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue