mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Model driven indexer settings
This commit is contained in:
parent
e03ab2ebea
commit
9d5cb6f3e0
14 changed files with 576 additions and 17 deletions
6
UI/Settings/Indexers/Collection.js
Normal file
6
UI/Settings/Indexers/Collection.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
define(['app', 'Settings/Indexers/Model'], function () {
|
||||
NzbDrone.Settings.Indexers.Collection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/indexer',
|
||||
model: NzbDrone.Settings.Indexers.Model
|
||||
});
|
||||
});
|
5
UI/Settings/Indexers/CollectionTemplate.html
Normal file
5
UI/Settings/Indexers/CollectionTemplate.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-indexers" class="form-horizontal"></div>
|
||||
</div>
|
||||
</div>
|
10
UI/Settings/Indexers/CollectionView.js
Normal file
10
UI/Settings/Indexers/CollectionView.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
define(['app', 'Settings/Indexers/ItemView'], function (app) {
|
||||
|
||||
NzbDrone.Settings.Indexers.CollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
itemView : NzbDrone.Settings.Indexers.ItemView,
|
||||
itemViewContainer : '#x-indexers',
|
||||
template : 'Settings/Indexers/CollectionTemplate'
|
||||
});
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
<div>
|
||||
Indexer settings will go here
|
||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
define([
|
||||
'app', 'Settings/SettingsModel'
|
||||
|
||||
], function () {
|
||||
|
||||
NzbDrone.Settings.Indexers.IndexersView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/IndexersTemplate'
|
||||
});
|
||||
});
|
38
UI/Settings/Indexers/ItemTemplate.html
Normal file
38
UI/Settings/Indexers/ItemTemplate.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<fieldset>
|
||||
<legend>{{name}}</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Enable</label>
|
||||
|
||||
<div class="controls">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="enable"/>
|
||||
<p>
|
||||
<span>On</span>
|
||||
<span>Off</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"></div>
|
||||
</label>
|
||||
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="Do you want to use {{name}} to download NZBs?"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{debug}}
|
||||
|
||||
{{#each fields}}
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{title}}</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="text" name="fields.{{@index}}.value"/>
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="{{helpText}}"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</fieldset>
|
38
UI/Settings/Indexers/ItemView.js
Normal file
38
UI/Settings/Indexers/ItemView.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Settings/Indexers/Collection'
|
||||
|
||||
], function () {
|
||||
|
||||
NzbDrone.Settings.Indexers.ItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/ItemTemplate',
|
||||
initialize: function () {
|
||||
this.model.set('fields', [
|
||||
{ key: 'username', title: 'Username', helpText: 'HALP!', value: 'mark' },
|
||||
{ key: 'apiKey', title: 'API Key', helpText: 'HALP!', value: 'private' }
|
||||
]);
|
||||
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
||||
},
|
||||
|
||||
saveSettings: function () {
|
||||
var test = 1;
|
||||
//this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
|
||||
},
|
||||
|
||||
|
||||
syncNotification: function (success, error) {
|
||||
return {
|
||||
success: function () {
|
||||
window.alert(success);
|
||||
},
|
||||
|
||||
error: function () {
|
||||
window.alert(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
13
UI/Settings/Indexers/Model.js
Normal file
13
UI/Settings/Indexers/Model.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
define(['app'], function (app) {
|
||||
NzbDrone.Settings.Indexers.Model = Backbone.DeepModel.extend({
|
||||
mutators: {
|
||||
fields: function () {
|
||||
return [
|
||||
{ key: 'username', title: 'Username', helpText: 'HALP!', value: 'mark', index: 0 },
|
||||
{ key: 'apiKey', title: 'API Key', helpText: 'HALP!', value: '', index: 1 }
|
||||
];
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue