1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Settings/Indexers/CollectionView.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

2013-05-01 03:01:54 +03:00
'use strict';
2013-05-28 03:19:07 +03:00
define(['app',
'Settings/Indexers/ItemView',
'Settings/Indexers/EditView'],
function () {
2013-05-01 03:01:54 +03:00
NzbDrone.Settings.Indexers.CollectionView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Settings.Indexers.ItemView,
itemViewContainer : '#x-indexers',
2013-05-28 03:19:07 +03:00
template : 'Settings/Indexers/CollectionTemplate',
events: {
'click .x-add': 'openSchemaModal'
},
openSchemaModal: function () {
//TODO: Is there a better way to deal with changing URLs?
var schema = new NzbDrone.Settings.Indexers.Collection();
schema.url = '/api/indexer/schema';
schema.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);
}
});
}
2013-05-01 03:01:54 +03:00
});
2013-05-01 09:43:14 +03:00
});