mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Settings/Indexers/Model',
|
||||
'Form/FormBuilder'
|
||||
], function (IndexerModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/indexer',
|
||||
model: IndexerModel
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
<fieldset>
|
||||
<legend>Indexers</legend>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<ul id="x-indexers" class="indexer-list">
|
||||
<li>
|
||||
<div class="indexer-settings-item add-card x-add-card">
|
||||
<span class="center well">
|
||||
<i class="icon-plus" title="Add Newznab"/>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
define(['app',
|
||||
'marionette',
|
||||
'Settings/Indexers/ItemView',
|
||||
'Settings/Indexers/EditView',
|
||||
'Settings/Indexers/Collection'],
|
||||
function (App, Marionette, IndexerItemView, IndexerEditView, IndexerCollection) {
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : IndexerItemView,
|
||||
itemViewContainer: '#x-indexers',
|
||||
template : 'Settings/Indexers/CollectionTemplate',
|
||||
|
||||
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 () {
|
||||
var self = this;
|
||||
//TODO: Is there a better way to deal with changing URLs?
|
||||
var schemaCollection = new IndexerCollection();
|
||||
schemaCollection.url = '/api/indexer/schema';
|
||||
schemaCollection.fetch({
|
||||
success: function (collection) {
|
||||
collection.url = '/api/indexer';
|
||||
var model = _.first(collection.models);
|
||||
|
||||
model.set({
|
||||
id: undefined,
|
||||
name: '',
|
||||
enable: true
|
||||
});
|
||||
|
||||
var view = new IndexerEditView({ model: model, indexerCollection: self.collection});
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>Delete Indexer</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete '{{name}}'?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
<button class="btn btn-danger x-confirm-delete">delete</button>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
define(['app', 'marionette'], function (App, Marionette) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/DeleteTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-confirm-delete': '_removeIndexer'
|
||||
},
|
||||
|
||||
_removeIndexer: function () {
|
||||
this.model.destroy({
|
||||
wait : true,
|
||||
success: function () {
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
{{#if id}}
|
||||
<h3>Edit</h3>
|
||||
{{else}}
|
||||
<h3>Add Newznab</h3>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Name</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="text" name="name"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>Yes</span>
|
||||
<span>No</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{formBuilder}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{{#if id}}
|
||||
<button class="btn btn-danger pull-left x-remove">delete</button>
|
||||
{{/if}}
|
||||
|
||||
<span class="x-activity"></span>
|
||||
|
||||
<button class="btn" data-dismiss="modal">cancel</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary x-save">save</button>
|
||||
<button class="btn btn-icon-only btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="save-and-add x-save-and-add">
|
||||
save and add
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (App, Marionette, AsModelBoundView, AsValidatedView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/EditTemplate',
|
||||
|
||||
ui : {
|
||||
activity: '.x-activity'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-save' : '_save',
|
||||
'click .x-save-and-add': '_saveAndAdd'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.indexerCollection = options.indexerCollection;
|
||||
},
|
||||
|
||||
_save: function () {
|
||||
this.ui.activity.html('<i class="icon-nd-spinner"></i>');
|
||||
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
App.vent.trigger(App.Commands.CloseModalCommand);
|
||||
});
|
||||
|
||||
promise.fail(function () {
|
||||
self.ui.activity.empty();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_saveAndAdd: function () {
|
||||
this.ui.activity.html('<i class="icon-nd-spinner"></i>');
|
||||
|
||||
var self = this;
|
||||
var promise = this.model.saveSettings();
|
||||
|
||||
if (promise) {
|
||||
promise.done(function () {
|
||||
self.indexerCollection.add(self.model, { merge: true });
|
||||
|
||||
self.model.set({
|
||||
id : undefined,
|
||||
name : '',
|
||||
enable: false
|
||||
});
|
||||
|
||||
_.each(self.model.get('fields'), function (value, key, list) {
|
||||
self.model.set('fields.' + key + '.value', '');
|
||||
});
|
||||
});
|
||||
|
||||
promise.fail(function () {
|
||||
self.ui.activity.empty();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
return view;
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Settings/Indexers/CollectionView',
|
||||
'Settings/Indexers/Options/IndexerOptionsView'
|
||||
], function (Marionette, CollectionView, OptionsView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Settings/Indexers/IndexerLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
indexersRegion : '#indexers-collection',
|
||||
indexerOptions : '#indexer-options'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.settings = options.settings;
|
||||
this.indexersCollection = options.indexersCollection;
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
this.indexersRegion.show(new CollectionView({ collection: this.indexersCollection }));
|
||||
this.indexerOptions.show(new OptionsView({ model: this.settings }));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div id="indexers-collection"></div>
|
||||
|
||||
<div class="form-horizontal">
|
||||
<div id="indexer-options"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
<div class="indexer-settings-item">
|
||||
<div>
|
||||
<h3>{{name}}</h3>
|
||||
{{#if_eq implementation compare="Newznab"}}
|
||||
<span class="btn-group pull-right">
|
||||
<button class="btn btn-mini btn-icon-only x-delete">
|
||||
<i class="icon-nd-delete"/>
|
||||
</button>
|
||||
</span>
|
||||
{{/if_eq}}
|
||||
</div>
|
||||
|
||||
<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>Yes</span>
|
||||
<span>No</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{formBuilder}}
|
||||
|
||||
{{#if_eq name compare="WomblesIndex"}}
|
||||
<div class="alert">
|
||||
<i class="icon-nd-warning"></i>
|
||||
Does not support searching
|
||||
</div>
|
||||
{{/if_eq}}
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Settings/Notifications/DeleteView',
|
||||
'Mixins/AsModelBoundView',
|
||||
'Mixins/AsValidatedView'
|
||||
], function (App, Marionette, DeleteView, AsModelBoundView, AsValidatedView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/ItemTemplate',
|
||||
tagName : 'li',
|
||||
|
||||
events: {
|
||||
'click .x-delete': '_deleteIndexer'
|
||||
},
|
||||
|
||||
_deleteIndexer: function () {
|
||||
var view = new DeleteView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
return AsValidatedView.call(view);
|
||||
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
define([
|
||||
'Settings/SettingsModelBase'], function (ModelBase) {
|
||||
return ModelBase.extend({
|
||||
|
||||
baseInitialize: ModelBase.prototype.initialize,
|
||||
|
||||
initialize: function () {
|
||||
var name = this.get('name');
|
||||
|
||||
this.successMessage = 'Saved indexer: ' + name;
|
||||
this.errorMessage = 'Couldn\'t save indexer: ' + name;
|
||||
|
||||
this.baseInitialize.call(this);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (Marionette, AsModelBoundView) {
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Settings/Indexers/Options/IndexerOptionsViewTemplate'
|
||||
});
|
||||
|
||||
return AsModelBoundView.call(view);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
<fieldset>
|
||||
<legend>Options</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Retention</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="number" min="0" name="retention"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group advanced-setting">
|
||||
<label class="control-label">RSS Sync Interval</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="number" min="10" max="120" name="rssSyncInterval"/>
|
||||
|
||||
<span class="help-inline">
|
||||
<i class="icon-nd-form-warning" title="This will apply to all indexers, please follow the rules set forth by them"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group advanced-setting">
|
||||
<label class="control-label">Release Restrictions</label>
|
||||
|
||||
<div class="controls">
|
||||
<textarea rows="3" name="releaseRestrictions" class="release-restrictions"></textarea>
|
||||
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="Blacklist NZBs based on these words (case-insensitive)"/>
|
||||
</span>
|
||||
|
||||
<span class="text-area-help">Newline-delimited set of rules</span>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -0,0 +1,36 @@
|
||||
@import "../../Shared/Styles/card";
|
||||
|
||||
.indexer-list {
|
||||
li {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
|
||||
.indexer-settings-item {
|
||||
|
||||
.card;
|
||||
|
||||
width: 220px;
|
||||
height: 260px;
|
||||
padding: 10px 15px;
|
||||
|
||||
h3 {
|
||||
margin-top: 0px;
|
||||
display: inline-block;
|
||||
width: 190px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
&.add-card {
|
||||
.center {
|
||||
margin-top: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user