parent
451f2d30e4
commit
dd553b9439
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,39 @@
|
||||
var _ = require('underscore');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Backbone = require('backbone');
|
||||
var SchemaCollection = require('../IndexerCollection');
|
||||
var SchemaCollection = require('../NetImportCollection');
|
||||
var AddCollectionView = require('./IndexerAddCollectionView');
|
||||
|
||||
module.exports = {
|
||||
open : function(collection) {
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
open : function(collection) {
|
||||
var schemaCollection = new SchemaCollection();
|
||||
var originalUrl = schemaCollection.url;
|
||||
schemaCollection.url = schemaCollection.url + '/schema';
|
||||
schemaCollection.fetch();
|
||||
schemaCollection.url = originalUrl;
|
||||
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
|
||||
schemaCollection.on('sync', function() {
|
||||
schemaCollection.on('sync', function() {
|
||||
|
||||
var groups = schemaCollection.groupBy(function(model, iterator) {
|
||||
return model.get('protocol');
|
||||
});
|
||||
var modelCollection = _.map(groups, function(values, key, list) {
|
||||
return {
|
||||
"header" : key,
|
||||
collection : values
|
||||
};
|
||||
});
|
||||
var groups = schemaCollection.groupBy(function(model, iterator) {
|
||||
return model.get('protocol');
|
||||
});
|
||||
var modelCollection = _.map(groups, function(values, key, list) {
|
||||
return {
|
||||
"header" : key,
|
||||
collection : values
|
||||
};
|
||||
});
|
||||
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
});
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
});
|
||||
|
||||
var view = new AddCollectionView({
|
||||
collection : groupedSchemaCollection,
|
||||
targetCollection : collection
|
||||
});
|
||||
var view = new AddCollectionView({
|
||||
collection : groupedSchemaCollection,
|
||||
targetCollection : collection
|
||||
});
|
||||
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
};
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
};
|
||||
|
@ -1,25 +0,0 @@
|
||||
var Marionette = require('marionette');
|
||||
var ItemView = require('./IndexerItemView');
|
||||
var SchemaModal = require('./Add/IndexerSchemaModal');
|
||||
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer : '.indexer-list',
|
||||
template : 'Settings/Indexers/IndexerCollectionViewTemplate',
|
||||
|
||||
ui : {
|
||||
'addCard' : '.x-add-card'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-add-card' : '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml : function(collectionView, itemView, index) {
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
_openSchemaModal : function() {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
@ -1,16 +0,0 @@
|
||||
<fieldset>
|
||||
<legend>Indexers</legend>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="indexer-list thingies">
|
||||
<li>
|
||||
<div class="indexer-item thingy add-card x-add-card">
|
||||
<span class="center well">
|
||||
<i class="icon-sonarr-add"/>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
@ -1,24 +0,0 @@
|
||||
var AppLayout = require('../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./Edit/IndexerEditView');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/IndexerItemViewTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events : {
|
||||
'click' : '_edit'
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_edit : function() {
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
@ -1,27 +0,0 @@
|
||||
<div class="indexer-item thingy">
|
||||
<div>
|
||||
<h3>{{name}}</h3>
|
||||
</div>
|
||||
|
||||
<div class="settings">
|
||||
{{#if supportsRss}}
|
||||
{{#if enableRss}}
|
||||
<span class="label label-success">RSS</span>
|
||||
{{else}}
|
||||
<span class="label label-default">RSS</span>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class="label label-default label-disabled">RSS</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if supportsSearch}}
|
||||
{{#if enableSearch}}
|
||||
<span class="label label-success">Search</span>
|
||||
{{else}}
|
||||
<span class="label label-default">Search</span>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<span class="label label-default label-disabled">Search</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
@ -1,30 +0,0 @@
|
||||
var Marionette = require('marionette');
|
||||
var IndexerCollection = require('./IndexerCollection');
|
||||
var CollectionView = require('./IndexerCollectionView');
|
||||
var OptionsView = require('./Options/IndexerOptionsView');
|
||||
var RestrictionCollection = require('./Restriction/RestrictionCollection');
|
||||
var RestrictionCollectionView = require('./Restriction/RestrictionCollectionView');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Settings/Indexers/IndexerLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
indexers : '#x-indexers-region',
|
||||
indexerOptions : '#x-indexer-options-region',
|
||||
restriction : '#x-restriction-region'
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.indexersCollection = new IndexerCollection();
|
||||
this.indexersCollection.fetch();
|
||||
|
||||
this.restrictionCollection = new RestrictionCollection();
|
||||
this.restrictionCollection.fetch();
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this.indexers.show(new CollectionView({ collection : this.indexersCollection }));
|
||||
this.indexerOptions.show(new OptionsView({ model : this.model }));
|
||||
this.restriction.show(new RestrictionCollectionView({ collection : this.restrictionCollection }));
|
||||
}
|
||||
});
|
@ -1,5 +0,0 @@
|
||||
<div id="x-indexers-region"></div>
|
||||
<div class="form-horizontal">
|
||||
<div id="x-indexer-options-region"></div>
|
||||
<div id="x-restriction-region"></div>
|
||||
</div>
|
@ -0,0 +1,16 @@
|
||||
<fieldset>
|
||||
<legend>Lists</legend>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="list-list thingies">
|
||||
<li>
|
||||
<div class="list-item thingy add-card x-add-card">
|
||||
<span class="center well">
|
||||
<i class="icon-sonarr-add"/>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
@ -0,0 +1,25 @@
|
||||
var Marionette = require('marionette');
|
||||
var ItemView = require('./NetImportItemView');
|
||||
var SchemaModal = require('./Add/IndexerSchemaModal');
|
||||
|
||||
module.exports = Marionette.CompositeView.extend({
|
||||
itemView : ItemView,
|
||||
itemViewContainer : '.list-list',
|
||||
template : 'Settings/NetImport/NetImportCollectionViewTemplate',
|
||||
|
||||
ui : {
|
||||
'addCard' : '.x-add-card'
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-add-card' : '_openSchemaModal'
|
||||
},
|
||||
|
||||
appendHtml : function(collectionView, itemView, index) {
|
||||
collectionView.ui.addCard.parent('li').before(itemView.el);
|
||||
},
|
||||
|
||||
_openSchemaModal : function() {
|
||||
SchemaModal.open(this.collection);
|
||||
}
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
var AppLayout = require('../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('./Edit/IndexerEditView');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/NetImport/NetImportItemViewTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events : {
|
||||
'click' : '_edit'
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.listenTo(this.model, 'sync', this.render);
|
||||
},
|
||||
|
||||
_edit : function() {
|
||||
var view = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.model.collection
|
||||
});
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
<div class="list-item thingy">
|
||||
<div>
|
||||
<h3>{{name}}</h3>
|
||||
</div>
|
||||
|
||||
<div class="settings">
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
var Marionette = require('marionette');
|
||||
var NetImportCollection = require('./NetImportCollection');
|
||||
var CollectionView = require('./NetImportCollectionView');
|
||||
var OptionsView = require('./Options/IndexerOptionsView');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Settings/NetImport/NetImportLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
lists : '#x-lists-region',
|
||||
listOption : '#x-list-options-region',
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
this.indexersCollection = new NetImportCollection();
|
||||
this.indexersCollection.fetch();
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this.lists.show(new CollectionView({ collection : this.indexersCollection }));
|
||||
this.listOption.show(new OptionsView({ model : this.model }));
|
||||
}
|
||||
});
|
@ -0,0 +1,4 @@
|
||||
<div id="x-lists-region"></div>
|
||||
<div class="form-horizontal">
|
||||
<div id="x-list-options-region"></div>
|
||||
</div>
|
Loading…
Reference in new issue