mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
more import existing series code.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/// <reference path="../app.js" />
|
||||
/// <reference path="AddNewSeries/AddNewSeriesView.js" />
|
||||
/// <reference path="RootDir/RootDirView.js" />
|
||||
/// <reference path="New/AddNewSeriesView.js" />
|
||||
/// <reference path="RootFolders/RootDirView.js" />
|
||||
/// <reference path="../Quality/qualityProfileCollection.js" />
|
||||
/// <reference path="../Shared/SpinnerView.js" />
|
||||
/// <reference path="ImportExistingSeries/ImportSeriesView.js" />
|
||||
/// <reference path="Existing/ImportSeriesView.js" />
|
||||
|
||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/addSeriesLayoutTemplate',
|
||||
@@ -74,12 +74,12 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
this.qualityProfileCollection.fetch();
|
||||
|
||||
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
||||
this.importExisting.show(new NzbDrone.AddSeries.ExistingFolderListView({ collection: this.rootFolderCollection }));
|
||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection }));
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||
|
||||
NzbDrone.vent.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
||||
NzbDrone.vent.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this);
|
||||
NzbDrone.vent.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this);
|
||||
this.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
||||
this.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this);
|
||||
this.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this);
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="row">
|
||||
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign pull-left"></a>
|
||||
<div>{{seriesName}} {{seriesYear}}</div>
|
||||
<div class="btn btn-success x-add pull-right icon-plus"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,65 @@
|
||||
'use strict';
|
||||
/// <reference path="../../app.js" />
|
||||
/// <reference path="UnmappedFolderModel.js" />
|
||||
/// <reference path="../../Series/SeriesModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
|
||||
|
||||
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
||||
template: "AddSeries/Existing/FolderMatchResultViewTemplatate",
|
||||
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||
|
||||
template: "AddSeries/Existing/UnmappedFolderCompositeViewTemplatate",
|
||||
itemViewContainer: ".x-folder-name-match-results",
|
||||
itemView: NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
||||
|
||||
events: {
|
||||
'click .x-search': 'search'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
||||
},
|
||||
|
||||
search: function () {
|
||||
|
||||
this.collection.fetch({
|
||||
data: $.param({ term: 'simpsons' })
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
||||
|
||||
template: "AddSeries/Existing/RootFolderCompositeViewTemplate",
|
||||
itemViewContainer: ".x-existing-folder-container",
|
||||
itemView: NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
||||
|
||||
initialize: function () {
|
||||
|
||||
if (!this.model) {
|
||||
throw "model is required.";
|
||||
}
|
||||
|
||||
this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection();
|
||||
this.collection.importArray(this.model.get('unmappedFolders'));
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
|
||||
|
||||
initialize: function () {
|
||||
if (!this.collection) {
|
||||
throw "root folder collection is required.";
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="accordion result-list span12 offset4 ">
|
||||
<h2>{{path}}</h2>
|
||||
|
||||
<div class="x-existing-folder-container">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- {{#each unmappedFolders}}
|
||||
<div class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a class="accordion-toggle" data-toggle="collapse" href="#{{../id}}_{{@index}}">{{this}}</a>
|
||||
</div>
|
||||
<div id="{{../id}}_{{@index}}" class="accordion-body collapse">
|
||||
<div class="accordion-inner">
|
||||
{{this}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}-->
|
||||
</div>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
{{folder}}
|
||||
<div class="btn x-search"></div>
|
||||
<div class="x-folder-name-match-results">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
/// <reference path="../../app.js" />
|
||||
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
|
||||
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({
|
||||
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
|
||||
|
||||
|
||||
importArray: function (unmappedFolderArray) {
|
||||
|
||||
if (!unmappedFolderArray) {
|
||||
throw "folder array is required";
|
||||
}
|
||||
|
||||
_.each(unmappedFolderArray, function (folder) {
|
||||
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ folder: folder }));
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
'use strict';
|
||||
/*global NzbDrone, Backbone*/
|
||||
|
||||
/// <reference path="../../app.js" />
|
||||
/// <reference path="../../Series/SeriesModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
NzbDrone.AddSeries.ExistingFolderItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/ImportExistingSeries/ImportSeriesTemplate",
|
||||
|
||||
events: {
|
||||
//'click .x-add': 'add'
|
||||
}
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.ExistingFolderListView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.AddSeries.ExistingFolderItemView,
|
||||
|
||||
initialize: function () {
|
||||
|
||||
if (this.collection === undefined) {
|
||||
throw "root folder collection is required.";
|
||||
}
|
||||
|
||||
this.listenTo(this.collection, 'reset', this.render, this);
|
||||
}
|
||||
});
|
||||
+4
-1
@@ -3,7 +3,7 @@
|
||||
/// <reference path="SearchResultView.js" />
|
||||
|
||||
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/AddNewSeries/AddNewSeriesTemplate',
|
||||
template: 'AddSeries/New/AddNewSeriesTemplate',
|
||||
route: 'Series/add/new',
|
||||
|
||||
ui: {
|
||||
@@ -16,6 +16,8 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
|
||||
collection: new NzbDrone.AddSeries.SearchResultCollection(),
|
||||
|
||||
|
||||
|
||||
initialize: function (options) {
|
||||
if (options.rootFolders === undefined) {
|
||||
throw 'rootFolder arg. is required.';
|
||||
@@ -25,6 +27,7 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
throw 'qualityProfiles arg. is required.';
|
||||
}
|
||||
|
||||
|
||||
this.rootFoldersCollection = options.rootFolders;
|
||||
this.qualityProfilesCollection = options.qualityProfiles;
|
||||
},
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/AddNewSeries/SearchResultTemplate",
|
||||
template: "AddSeries/New/SearchResultTemplate",
|
||||
className: 'search-item',
|
||||
|
||||
ui: {
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: 'AddSeries/RootDir/RootDirItemTemplate',
|
||||
template: 'AddSeries/RootFolders/RootDirItemTemplate',
|
||||
tagName: 'tr',
|
||||
|
||||
events: {
|
||||
@@ -31,7 +31,7 @@ NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/RootDir/RootDirTemplate',
|
||||
template: 'AddSeries/RootFolders/RootDirTemplate',
|
||||
route: 'series/add/rootdir',
|
||||
|
||||
ui: {
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference path="../app.js" />
|
||||
/// <reference path="RootDir/RootDirCollection.js" />
|
||||
/// <reference path="RootFolders/RootDirCollection.js" />
|
||||
/// <reference path="../Quality/qualityProfileCollection.js" />
|
||||
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
|
||||
mutators: {
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
/// <reference path="../app.js" />
|
||||
|
||||
NzbDrone.Shared.NotificationCollection = Backbone.Collection.extend({
|
||||
|
||||
model: NzbDrone.Shared.NotificationModel,
|
||||
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
@@ -40,3 +32,10 @@ NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
|
||||
"message": "",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Shared.NotificationCollection = Backbone.Collection.extend({
|
||||
|
||||
model: NzbDrone.Shared.NotificationModel,
|
||||
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/// <reference path="NotificationModel.js" />
|
||||
|
||||
NzbDrone.Shared.NotificationItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: "Shared/NotificationTemplate",
|
||||
template: 'Shared/NotificationTemplate',
|
||||
|
||||
events: {
|
||||
'click .x-close': 'kill'
|
||||
@@ -67,7 +67,7 @@ $(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
|
||||
model.set('title', ajaxOptions.type + " " + ajaxOptions.url + " : " + xmlHttpRequest.statusText);
|
||||
model.set('message', xmlHttpRequest.responseText);
|
||||
model.set('level', 'error');
|
||||
NzbDrone.Shared.NotificationCollectionView.Instance.collection.add(model);
|
||||
NzbDrone.Shared.NotificationCollectionView.Instance.collection.push(model);
|
||||
|
||||
var suppressErrorAlert = false;
|
||||
return suppressErrorAlert;
|
||||
|
||||
@@ -17,10 +17,13 @@ if (typeof console === undefined) {
|
||||
}
|
||||
|
||||
NzbDrone = new Backbone.Marionette.Application();
|
||||
NzbDrone.Series = NzbDrone.module('Series');
|
||||
NzbDrone.AddSeries = NzbDrone.module('AddSeries');
|
||||
NzbDrone.Quality = NzbDrone.module('Quality');
|
||||
NzbDrone.Shared = NzbDrone.module('Shared');
|
||||
NzbDrone.Series = {};
|
||||
NzbDrone.AddSeries = {};
|
||||
NzbDrone.AddSeries.New = {};
|
||||
NzbDrone.AddSeries.Existing = {};
|
||||
NzbDrone.AddSeries.RootFolders = {};
|
||||
NzbDrone.Quality = {};
|
||||
NzbDrone.Shared = {};
|
||||
|
||||
/*
|
||||
_.templateSettings = {
|
||||
|
||||
Reference in New Issue
Block a user