You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/UI/Settings/Indexers/CollectionView.js

33 lines
1.2 KiB

'use strict';
define(['app',
'Settings/Indexers/ItemView',
'Settings/Indexers/EditView'],
function () {
NzbDrone.Settings.Indexers.CollectionView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Settings.Indexers.ItemView,
itemViewContainer : '#x-indexers',
template : 'Settings/Indexers/CollectionTemplate',
events: {
'click .x-add': 'openSchemaModal'
},
openSchemaModal: function () {
//TODO: Is there a better way to deal with changing URLs?
12 years ago
var schemaCollection = new NzbDrone.Settings.Indexers.Collection();
schemaCollection.url = '/api/indexer/schema';
schemaCollection.fetch({
success: function (collection) {
collection.url = '/api/indexer';
var model = _.first(collection.models);
model.set('id', undefined);
model.set('name', '');
var view = new NzbDrone.Settings.Indexers.EditView({ model: model});
NzbDrone.modalRegion.show(view);
}
});
}
});
});