mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-24 22:35:49 -04:00
Basis of UI Update.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
var ThingyAddCollectionView = require('../../ThingyAddCollectionView');
|
||||
var ThingyHeaderGroupView = require('../../ThingyHeaderGroupView');
|
||||
var AddItemView = require('./IndexerAddItemView');
|
||||
|
||||
module.exports = ThingyAddCollectionView.extend({
|
||||
itemView : ThingyHeaderGroupView.extend({ itemView : AddItemView }),
|
||||
itemViewContainer : '.add-indexer .items',
|
||||
template : 'Settings/Indexers/Add/IndexerAddCollectionViewTemplate'
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Add Indexer</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
Radarr supports any indexer that uses the Newznab standard, as well as other indexers listed below.<br/>
|
||||
For more information on the individual indexers, click on the info buttons.
|
||||
</div>
|
||||
<div class="add-indexer add-thingies">
|
||||
<ul class="items"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
var _ = require('underscore');
|
||||
var $ = require('jquery');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var EditView = require('../Edit/IndexerEditView');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Settings/Indexers/Add/IndexerAddItemViewTemplate',
|
||||
tagName : 'li',
|
||||
className : 'add-thingy-item',
|
||||
|
||||
events : {
|
||||
'click .x-preset' : '_addPreset',
|
||||
'click' : '_add'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.targetCollection = options.targetCollection;
|
||||
},
|
||||
|
||||
_addPreset : function(e) {
|
||||
var presetName = $(e.target).closest('.x-preset').attr('data-id');
|
||||
var presetData = _.where(this.model.get('presets'), { name : presetName })[0];
|
||||
|
||||
this.model.set(presetData);
|
||||
|
||||
this._openEdit();
|
||||
},
|
||||
|
||||
_add : function(e) {
|
||||
if ($(e.target).closest('.btn,.btn-group').length !== 0 && $(e.target).closest('.x-custom').length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._openEdit();
|
||||
},
|
||||
|
||||
_openEdit : function() {
|
||||
this.model.set({
|
||||
id : undefined,
|
||||
enableRss : this.model.get('supportsRss'),
|
||||
enableSearch : this.model.get('supportsSearch')
|
||||
});
|
||||
|
||||
var editView = new EditView({
|
||||
model : this.model,
|
||||
targetCollection : this.targetCollection
|
||||
});
|
||||
|
||||
AppLayout.modalRegion.show(editView);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="add-thingy">
|
||||
<div>
|
||||
{{implementationName}}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{{#if_gt presets.length compare=0}}
|
||||
<button class="btn btn-xs btn-default x-custom">
|
||||
Custom
|
||||
</button>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
Presets
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{{#each presets}}
|
||||
<li class="x-preset" data-id="{{name}}">
|
||||
<a>{{name}}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if_gt}}
|
||||
{{#if infoLink}}
|
||||
<a class="btn btn-xs btn-default x-info" href="{{infoLink}}">
|
||||
<i class="icon-sonarr-form-info"/>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
var _ = require('underscore');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Backbone = require('backbone');
|
||||
var SchemaCollection = require('../IndexerCollection');
|
||||
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;
|
||||
|
||||
var groupedSchemaCollection = new Backbone.Collection();
|
||||
|
||||
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
|
||||
};
|
||||
});
|
||||
|
||||
groupedSchemaCollection.reset(modelCollection);
|
||||
});
|
||||
|
||||
var view = new AddCollectionView({
|
||||
collection : groupedSchemaCollection,
|
||||
targetCollection : collection
|
||||
});
|
||||
|
||||
AppLayout.modalRegion.show(view);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user