mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Able to create new Newznab indexers
This commit is contained in:
parent
5660b5086c
commit
e4410d8cb7
8 changed files with 117 additions and 13 deletions
|
@ -5,23 +5,22 @@ define(['app', 'Settings/SettingsModel', 'Shared/Messenger'], function () {
|
|||
template: 'Settings/General/GeneralTemplate',
|
||||
|
||||
initialize: function () {
|
||||
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
||||
},
|
||||
|
||||
saveSettings: function () {
|
||||
if (!this.model.isSaved) {
|
||||
this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
|
||||
this.model.save(undefined, this.syncNotification("General Settings Saved", "Couldn't Save General Settings"));
|
||||
}
|
||||
},
|
||||
|
||||
syncNotification: function (success, error) {
|
||||
return {
|
||||
success: function () {
|
||||
NzbDrone.Shared.Messenger.show({message: 'General Settings Saved'});
|
||||
NzbDrone.Shared.Messenger.show({message: success});
|
||||
},
|
||||
error : function () {
|
||||
NzbDrone.Shared.Messenger.show({message: "Couldn't Save General Settings", type: 'error'});
|
||||
NzbDrone.Shared.Messenger.show({message: error, type: 'error'});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,7 +12,12 @@ define(['app',
|
|||
'click .x-add': 'openSchemaModal'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
||||
},
|
||||
|
||||
openSchemaModal: function () {
|
||||
var self = this;
|
||||
//TODO: Is there a better way to deal with changing URLs?
|
||||
var schemaCollection = new NzbDrone.Settings.Indexers.Collection();
|
||||
schemaCollection.url = '/api/indexer/schema';
|
||||
|
@ -23,10 +28,29 @@ define(['app',
|
|||
model.set('id', undefined);
|
||||
model.set('name', '');
|
||||
|
||||
var view = new NzbDrone.Settings.Indexers.EditView({ model: model});
|
||||
var view = new NzbDrone.Settings.Indexers.EditView({ model: model, indexerCollection: self.collection});
|
||||
NzbDrone.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
saveSettings: function () {
|
||||
//TODO: check if any models in the collection have changed and sync them only
|
||||
// this.collection.sync();
|
||||
// if (!this.model.isSaved) {
|
||||
// this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
|
||||
// }
|
||||
},
|
||||
|
||||
syncNotification: function (success, error) {
|
||||
return {
|
||||
success: function () {
|
||||
NzbDrone.Shared.Messenger.show({message: 'General Settings Saved'});
|
||||
},
|
||||
error : function () {
|
||||
NzbDrone.Shared.Messenger.show({message: "Couldn't Save General Settings", type: 'error'});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,18 +13,23 @@ define([
|
|||
'click .x-save': 'save'
|
||||
},
|
||||
|
||||
save: function () {
|
||||
this.model.save();
|
||||
|
||||
// window.alert('saving');
|
||||
// this.model.save(undefined, this.syncNotification("Notification Settings Saved", "Couldn't Save Notification Settings"));
|
||||
initialize: function (options) {
|
||||
this.indexerCollection = options.indexerCollection;
|
||||
},
|
||||
|
||||
save: function () {
|
||||
this.model.save(undefined, this.syncNotification("Indexer Saved", "Couldn't Save Indexer", this));
|
||||
},
|
||||
|
||||
syncNotification: function (success, error) {
|
||||
syncNotification: function (success, error, context) {
|
||||
return {
|
||||
success: function () {
|
||||
window.alert(success);
|
||||
NzbDrone.Shared.Messenger.show({
|
||||
message: success
|
||||
});
|
||||
|
||||
context.indexerCollection.add(context.model);
|
||||
context.$el.parent().modal('hide');
|
||||
},
|
||||
|
||||
error: function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue