mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-31 07:52:37 +01:00
fully working add series
This commit is contained in:
parent
57ccc51393
commit
96810c489c
@ -5,6 +5,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="jQuery-1.9.1" level="application" />
|
||||
<orderEntry type="library" name="backbone.backgrid.filter.js" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4" />
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="PROJECT" libraries="{backbone.backgrid.filter.js, jQuery-1.9.1}" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
67
UI/.idea/libraries/backbone_backgrid_filter_js.xml
Normal file
67
UI/.idea/libraries/backbone_backgrid_filter_js.xml
Normal file
@ -0,0 +1,67 @@
|
||||
<component name="libraryTable">
|
||||
<library name="backbone.backgrid.filter.js" type="javaScript">
|
||||
<properties>
|
||||
<sourceFilesUrls>
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.backstretch.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/lodash.underscore.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.signalR.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.knob.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.mutators.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/lunr.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/bootstrap.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.debug.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.relational.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/handlebars.helpers.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.paginator.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.filter.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.deep.model.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/messenger.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.pageable.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/require.js" />
|
||||
</sourceFilesUrls>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.backstretch.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/lodash.underscore.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.signalR.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.knob.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.mutators.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/lunr.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.debug.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.relational.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/handlebars.helpers.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.paginator.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.backgrid.filter.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.deep.model.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/messenger.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.pageable.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/require.js" />
|
||||
</CLASSES>
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
@ -7,16 +7,12 @@
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.pager.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.bootstrap.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/bootstrap.slider.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<item url="file://$PROJECT_DIR$/JsLibraries/require.js" />
|
||||
@ -26,21 +22,21 @@
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrapSwitch.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/toastr-1.1.5.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.pager.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.slider.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.debug.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/sugar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.shortcuts.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.pager.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/handlebars.runtime.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.bootstrap.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/jquery.tablesorter.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.modelbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.collectionbinder.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/fullcalendar.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/underscore.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/bootstrap.slider.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.marionette.viewswapper.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.js" />
|
||||
<root url="file://$PROJECT_DIR$/JsLibraries/backbone.mutators.js" />
|
||||
|
@ -7,8 +7,9 @@ define(
|
||||
'AddSeries/Existing/CollectionView',
|
||||
'AddSeries/AddSeriesView',
|
||||
'Quality/QualityProfileCollection',
|
||||
'AddSeries/RootFolders/Collection'
|
||||
], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection) {
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'Series/SeriesCollection',
|
||||
], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection, SeriesCollection) {
|
||||
|
||||
return Marionette.Layout.extend({
|
||||
template: 'AddSeries/AddSeriesLayoutTemplate',
|
||||
@ -21,7 +22,14 @@ define(
|
||||
'click .x-import': '_importSeries'
|
||||
},
|
||||
|
||||
attributes: {
|
||||
id: 'add-series-screen'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
|
||||
SeriesCollection.fetch();
|
||||
|
||||
this.rootFolderLayout = new RootFolderLayout();
|
||||
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
<div class="row">
|
||||
<div class="input-prepend nz-input-large add-series-search span11 x-search-bar">
|
||||
<div class="row unmapped-folder-path">
|
||||
<div class="span11">
|
||||
{{#if folder.path}}
|
||||
{{folder.path}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row x-search-bar">
|
||||
<div class="input-prepend nz-input-large add-series-search span11">
|
||||
<i class="add-on icon-search"/>
|
||||
<input type="text" class="input-block-level x-series-search" placeholder="Start typing the name of series you want to add ...">
|
||||
</div>
|
||||
@ -8,5 +15,6 @@
|
||||
<div id="search-result" class="result-list span12"/>
|
||||
</div>
|
||||
<div class="text-center new-series-loadmore x-load-more" style="display: none;">
|
||||
<i class="icon-angle-down"/> more
|
||||
</div>
|
||||
<i class="icon-angle-down"/>
|
||||
more
|
||||
</div>{{debug}}
|
||||
|
@ -1,32 +1,62 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'AddSeries/Collection',
|
||||
'AddSeries/SearchResultCollectionView',
|
||||
'Shared/SpinnerView'
|
||||
], function (Marionette, AddSeriesCollection, SearchResultCollectionView, SpinnerView) {
|
||||
], function (App, Marionette, AddSeriesCollection, SearchResultCollectionView, SpinnerView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'AddSeries/AddSeriesTemplate',
|
||||
|
||||
regions: {
|
||||
searchResult: '#search-result'
|
||||
},
|
||||
|
||||
ui: {
|
||||
seriesSearch: '.x-series-search',
|
||||
searchBar : '.x-search-bar',
|
||||
loadMore : '.x-load-more'
|
||||
},
|
||||
|
||||
regions: {
|
||||
searchResult: '#search-result'
|
||||
events: {
|
||||
'click .x-load-more': '_onLoadMore'
|
||||
},
|
||||
|
||||
_onLoadMore: function () {
|
||||
this.ui.loadMore.hide();
|
||||
this.ui.searchBar.show();
|
||||
this.resultCollectionView.showAll();
|
||||
},
|
||||
|
||||
|
||||
initialize: function (options) {
|
||||
this.collection = new AddSeriesCollection();
|
||||
this.collection = new AddSeriesCollection({unmappedFolderModel: this.model});
|
||||
this.isExisting = options.isExisting;
|
||||
|
||||
if (this.isExisting) {
|
||||
this.className = 'existing-series';
|
||||
this.listenTo(App.vent, App.Events.SeriesAdded, this._onSeriesAdded);
|
||||
}
|
||||
else {
|
||||
this.className = 'new-series';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_onSeriesAdded: function (options) {
|
||||
if (options.series.get('path') === this.model.get('folder').path) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.$el.addClass(this.className);
|
||||
|
||||
this.ui.seriesSearch.data('timeout', null).keyup(function () {
|
||||
window.clearTimeout(self.$el.data('timeout'));
|
||||
self.$el.data('timeout', window.setTimeout(function () {
|
||||
@ -40,8 +70,8 @@ define(
|
||||
this.ui.searchBar.hide();
|
||||
}
|
||||
|
||||
this.resultView = new SearchResultCollectionView({
|
||||
fullResult: this.collection,
|
||||
this.resultCollectionView = new SearchResultCollectionView({
|
||||
collection: this.collection,
|
||||
isExisting: this.isExisting
|
||||
});
|
||||
},
|
||||
@ -50,7 +80,7 @@ define(
|
||||
|
||||
var self = this;
|
||||
|
||||
this.abortExistingRequest();
|
||||
this.abortExistingSearch();
|
||||
|
||||
this.collection.reset();
|
||||
|
||||
@ -59,22 +89,24 @@ define(
|
||||
}
|
||||
else {
|
||||
this.searchResult.show(new SpinnerView());
|
||||
this.currentSearchRequest = this.collection.fetch({
|
||||
this.currentSearchPromise = this.collection.fetch({
|
||||
data: { term: options.term }
|
||||
}).done(function () {
|
||||
self.searchResult.show(self.resultView);
|
||||
|
||||
if (!self.isClosed) {
|
||||
self.searchResult.show(self.resultCollectionView);
|
||||
if (!self.showingAll && self.isExisting) {
|
||||
self.ui.loadMore.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return this.currentSearchPromise;
|
||||
},
|
||||
|
||||
abortExistingRequest: function () {
|
||||
if (this.currentSearchRequest && this.currentSearchRequest.readyState > 0 && this.currentSearchRequest.readyState < 4) {
|
||||
abortExistingSearch: function () {
|
||||
if (this.currentSearchPromise && this.currentSearchPromise.readyState > 0 && this.currentSearchPromise.readyState < 4) {
|
||||
console.log('aborting previous pending search request.');
|
||||
this.currentSearchRequest.abort();
|
||||
this.currentSearchPromise.abort();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
@ -8,10 +8,21 @@ define(
|
||||
url : window.ApiRoot + '/series/lookup',
|
||||
model: SeriesModel,
|
||||
|
||||
initialize: function (options) {
|
||||
this.unmappedFolderModel = options.unmappedFolderModel;
|
||||
},
|
||||
|
||||
|
||||
parse: function (response) {
|
||||
|
||||
var self = this;
|
||||
|
||||
_.each(response, function (model) {
|
||||
model.id = undefined;
|
||||
|
||||
if (self.unmappedFolderModel) {
|
||||
model.path = self.unmappedFolderModel.get('folder').path;
|
||||
}
|
||||
});
|
||||
|
||||
return response;
|
||||
|
@ -12,10 +12,6 @@ define(
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new UnmappedFolderCollection();
|
||||
this.refreshItems();
|
||||
},
|
||||
|
||||
refreshItems: function () {
|
||||
this.collection.importItems(this.model);
|
||||
},
|
||||
|
||||
@ -28,12 +24,12 @@ define(
|
||||
var model = this.collection.at(index);
|
||||
|
||||
if (model) {
|
||||
var that = this;
|
||||
var self = this;
|
||||
var currentIndex = index;
|
||||
var folderName = model.get('folder').name;
|
||||
this.addItemView(model, this.getItemView(), index);
|
||||
$.when(this.children.findByModel(model).search({term: folderName})).then(function () {
|
||||
that._showAndSearch(currentIndex + 1);
|
||||
self._showAndSearch(currentIndex + 1);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -1,104 +0,0 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/Collection',
|
||||
'AddSeries/SearchResultView'
|
||||
], function (Marionette, AddSeriesCollection, SearchResultView) {
|
||||
|
||||
return Marionette.CompositeView.extend({
|
||||
|
||||
template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplate',
|
||||
itemViewContainer: '.x-folder-name-match-results',
|
||||
itemView : SearchResultView,
|
||||
|
||||
events: {
|
||||
'click .x-btn-search' : 'search',
|
||||
'click .x-load-more' : '_loadMore',
|
||||
'keydown .x-txt-search': 'keyDown'
|
||||
},
|
||||
|
||||
ui: {
|
||||
searchButton: '.x-btn-search',
|
||||
searchText : '.x-txt-search',
|
||||
searchBar : '.x-search-bar',
|
||||
loadMore : '.x-load-more'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.collection = new AddSeriesCollection();
|
||||
|
||||
this.on('item:removed', function () {
|
||||
this.close();
|
||||
}, this);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.ui.loadMore.show();
|
||||
},
|
||||
|
||||
search: function () {
|
||||
var icon = this.ui.searchButton.find('icon');
|
||||
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
||||
|
||||
var self = this;
|
||||
var deferred = $.Deferred();
|
||||
|
||||
this.collection.reset();
|
||||
|
||||
this.searchCollection = new AddSeriesCollection();
|
||||
|
||||
this.searchCollection.fetch({
|
||||
data: { term: this.ui.searchText.val() }
|
||||
}).done(function () {
|
||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||
deferred.resolve();
|
||||
self.collection.add(self.searchCollection.shift());
|
||||
|
||||
if (self.showall) {
|
||||
self._showAll();
|
||||
}
|
||||
|
||||
}).fail(function () {
|
||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||
deferred.reject();
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
},
|
||||
|
||||
|
||||
keyDown: function (e) {
|
||||
//Check for enter being pressed
|
||||
var code = (e.keyCode ? e.keyCode :e.which);
|
||||
if (code === 13) {
|
||||
this.search();
|
||||
}
|
||||
},
|
||||
|
||||
_loadMore: function () {
|
||||
this.showall = true;
|
||||
|
||||
this.ui.searchBar.fadeIn();
|
||||
this.ui.loadMore.fadeOut();
|
||||
|
||||
this._showAll();
|
||||
},
|
||||
|
||||
_showAll: function () {
|
||||
var self = this;
|
||||
this.searchCollection.each(function (searchResult) {
|
||||
self.collection.add(searchResult);
|
||||
});
|
||||
},
|
||||
|
||||
itemViewOptions: function () {
|
||||
return {
|
||||
rootFolder: this.model.get('rootFolder'),
|
||||
folder : this.model.get('folder').path,
|
||||
isExisting: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
});
|
@ -1,23 +0,0 @@
|
||||
<div class="unmapped-folder-view">
|
||||
<div class="text-center">
|
||||
<h2>
|
||||
<icon class="icon-folder-open"></icon>
|
||||
{{folder.path}}
|
||||
</h2>
|
||||
</div>
|
||||
<div class="row x-search-bar" style="display: none;">
|
||||
<div class="folder-header span11">
|
||||
<div class="input-prepend">
|
||||
<i class="add-on icon-search"/>
|
||||
<input class="x-txt-search input-xlarge" type="text" value="{{folder.name}}" placeholder="{{folder.name}}">
|
||||
</div>
|
||||
|
||||
<div class="btn btn-primary x-btn-search pull-right">
|
||||
<icon class="icon-search"></icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="x-folder-name-match-results folder-name-matches"/>
|
||||
</div>
|
||||
</div>
|
@ -8,7 +8,7 @@
|
||||
<input class="span5" type="text" placeholder="Path of the folder to add ...">
|
||||
<button class="btn btn-success x-add"><i class="icon-plus"/></button>
|
||||
</div>
|
||||
<div class="result-list" id="current-dirs"/>
|
||||
<div id="current-dirs"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal">close</button>
|
||||
|
@ -3,9 +3,8 @@ define(
|
||||
[
|
||||
'marionette',
|
||||
'AddSeries/SearchResultView',
|
||||
'AddSeries/Collection'
|
||||
|
||||
], function (Marionette, SearchResultView, SearchResultCollection) {
|
||||
], function (Marionette, SearchResultView) {
|
||||
|
||||
return Marionette.CollectionView.extend({
|
||||
|
||||
@ -13,34 +12,19 @@ define(
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
|
||||
this.isExisting = options.isExisting;
|
||||
this.fullResult = options.fullResult;
|
||||
|
||||
this.listenTo(this.fullResult, 'sync', this._processResultCollection);
|
||||
},
|
||||
|
||||
|
||||
showAll: function () {
|
||||
|
||||
this.showingAll = true;
|
||||
this.fullResult.each(function (searchResult) {
|
||||
this.collection.add(searchResult);
|
||||
});
|
||||
|
||||
this.render();
|
||||
},
|
||||
|
||||
_processResultCollection: function () {
|
||||
if (!this.showingAll && this.isExisting) {
|
||||
this.collection = new SearchResultCollection();
|
||||
this.collection.add(this.fullResult.shift());
|
||||
}
|
||||
else {
|
||||
this.collection = this.fullResult;
|
||||
appendHtml: function (collectionView, itemView, index) {
|
||||
if (!this.isExisting || this.showingAll || index === 0) {
|
||||
collectionView.$el.append(itemView.el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -2,7 +2,8 @@
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<a href="{{traktUrl}}" target="_blank">
|
||||
<img class="add-series-poster" src="{{remotePoster}}" {{defaultImg}}>
|
||||
<img class="new-series-poster" src="{{remotePoster}}"
|
||||
{{defaultImg}} >
|
||||
</a>
|
||||
</div>
|
||||
<div class="span9">
|
||||
@ -14,16 +15,23 @@
|
||||
{{overview}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="btn btn-success x-add pull-right new-series-add">
|
||||
{{#if existing}}
|
||||
<div class="btn pull-right add-series disabled">
|
||||
Already Exists
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="btn btn-success x-add pull-right add-series">
|
||||
Add
|
||||
<icon class="icon-plus"></icon>
|
||||
</div>
|
||||
{{#unless isExisting}}
|
||||
{{#unless path}}
|
||||
{{> RootFolderSelectionPartial rootFolders}}
|
||||
{{/unless}}
|
||||
<div class='pull-right'>
|
||||
{{> QualityProfileSelectionPartial qualityProfiles}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -22,7 +22,7 @@ define(
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add' : 'addSeries',
|
||||
'click .x-add' : '_addSeries',
|
||||
'change .x-quality-profile': '_qualityProfileChanged'
|
||||
},
|
||||
|
||||
@ -32,10 +32,8 @@ define(
|
||||
throw 'model is required';
|
||||
}
|
||||
|
||||
this.model.set('isExisting', this.options.isExisting);
|
||||
this.model.set('path', this.options.folder);
|
||||
|
||||
App.vent.on(Config.Events.ConfigUpdatedEvent, this._onConfigUpdated, this);
|
||||
this.listenTo(App.vent, Config.Events.ConfigUpdatedEvent, this._onConfigUpdated);
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
},
|
||||
|
||||
|
||||
@ -51,7 +49,6 @@ define(
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
|
||||
var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId);
|
||||
|
||||
@ -60,7 +57,6 @@ define(
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
addSeries: function () {
|
||||
var icon = this.ui.addButton.find('icon');
|
||||
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
|
||||
@ -76,8 +72,7 @@ define(
|
||||
SeriesCollection.add(this.model);
|
||||
|
||||
|
||||
this.model.save()
|
||||
.done(function () {
|
||||
this.model.save().done(function () {
|
||||
self.close();
|
||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||
Messenger.show({
|
||||
@ -85,17 +80,27 @@ define(
|
||||
});
|
||||
|
||||
App.vent.trigger(App.Events.SeriesAdded, { series: self.model });
|
||||
})
|
||||
.fail(function () {
|
||||
}).fail(function () {
|
||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
serializeData: function () {
|
||||
var data = this.model.toJSON();
|
||||
data.rootFolders = RootFolders.toJSON();
|
||||
|
||||
var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')});
|
||||
|
||||
if (existingSeries.length > 0) {
|
||||
data.existing = existingSeries[0].toJSON();
|
||||
}
|
||||
|
||||
data.qualityProfiles = QualityProfiles.toJSON();
|
||||
|
||||
if (!data.isExisting) {
|
||||
data.rootFolders = RootFolders.toJSON();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
});
|
||||
|
@ -1,28 +1,50 @@
|
||||
@import "../shared/Styles/card.less";
|
||||
@import "../shared/Styles/clickable.less";
|
||||
|
||||
.result-list {
|
||||
font-size : 14px;
|
||||
text-align : left;
|
||||
padding-bottom : 30px;
|
||||
#add-series-screen {
|
||||
|
||||
.folder-path, .folder-free-space {
|
||||
.operations-row {
|
||||
margin-left : 0px;
|
||||
}
|
||||
|
||||
.existing-series {
|
||||
|
||||
@highLight : rgb(134, 129, 130);
|
||||
|
||||
.card();
|
||||
margin : 20px 0px;
|
||||
|
||||
.add-series-search {
|
||||
width : 970px;
|
||||
}
|
||||
|
||||
.unmapped-folder-path {
|
||||
padding: 20px;
|
||||
margin-left : 0px;
|
||||
font-weight : 100;
|
||||
font-size : 25px;
|
||||
text-align : center;
|
||||
background : @highLight;
|
||||
}
|
||||
|
||||
.new-series-loadmore {
|
||||
.clickable;
|
||||
font-size : 30px;
|
||||
font-weight : 300;
|
||||
padding-top : 10px;
|
||||
padding-bottom : 10px;
|
||||
background : @highLight;
|
||||
}
|
||||
}
|
||||
|
||||
.existing-root-folder-view {
|
||||
h1 {
|
||||
padding : 10px 0 20px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.add-series-import-btn {
|
||||
margin : 0px 40px;
|
||||
width : 1080px;
|
||||
}
|
||||
.new-series {
|
||||
.search-item {
|
||||
.card();
|
||||
margin : 40px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.add-series-search {
|
||||
.add-series-search {
|
||||
margin-top : 20px;
|
||||
margin-bottom : 20px;
|
||||
padding-left : 20px;
|
||||
@ -36,38 +58,24 @@
|
||||
input {
|
||||
height : 50px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.search-item {
|
||||
|
||||
.folder-name-matches {
|
||||
padding-left : 20px;
|
||||
padding-top : 10px;
|
||||
}
|
||||
.new-series-overview {
|
||||
text-overflow : ellipsis;
|
||||
white-space : pre-line;
|
||||
overflow : hidden;
|
||||
height : 125px;
|
||||
}
|
||||
|
||||
.add-series-poster {
|
||||
.new-series-poster {
|
||||
min-width : 138px;
|
||||
min-height : 203px;
|
||||
max-width : 138px;
|
||||
max-height : 203px;
|
||||
}
|
||||
|
||||
.unmapped-folder-view {
|
||||
.card;
|
||||
margin-top : 20px;
|
||||
padding : 20px;
|
||||
.folder-header {
|
||||
font-weight : 300;
|
||||
select {
|
||||
margin-bottom : 0;
|
||||
font-size : 16px;
|
||||
margin : 10px;
|
||||
}
|
||||
input {
|
||||
margin-bottom : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-item {
|
||||
|
||||
padding-bottom : 20px;
|
||||
a {
|
||||
@ -79,27 +87,10 @@
|
||||
select {
|
||||
font-size : 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.search-item-new {
|
||||
.card;
|
||||
}
|
||||
|
||||
.new-series-overview {
|
||||
text-overflow : ellipsis;
|
||||
white-space : pre-line;
|
||||
overflow : hidden;
|
||||
height : 125px;
|
||||
}
|
||||
|
||||
.new-series-add {
|
||||
.add-series {
|
||||
margin-left : 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loadmore {
|
||||
.clickable;
|
||||
font-size : 30px;
|
||||
font-weight : 300;
|
||||
padding-top : 10px;
|
||||
padding-bottom : 10px;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<div class="row operations-row">
|
||||
<div class="btn-block btn btn-large add-series-import-btn x-import">
|
||||
<i class="icon-hdd"/> Import existing series on disk
|
||||
<i class="icon-hdd"/>
|
||||
Import existing series on disk
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="add-series-workspace"/>
|
@ -1,18 +1,11 @@
|
||||
'use strict';
|
||||
define({
|
||||
register: function (Handlebars) {
|
||||
Handlebars.registerHelper("debug", function (optionalValue) {
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper("debug", function () {
|
||||
console.group('Handlebar context');
|
||||
|
||||
console.log(this);
|
||||
if (optionalValue) {
|
||||
|
||||
console.group('optional values');
|
||||
console.log('optinal values');
|
||||
console.groupEnd();
|
||||
}
|
||||
console.groupEnd();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -4,6 +4,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete '{{title}}'?</p>
|
||||
<p>{{path}}</p>
|
||||
|
||||
<div class="series-delete-files">
|
||||
<label class="checkbox">
|
||||
|
@ -4,7 +4,7 @@ define(
|
||||
'backbone',
|
||||
'Series/SeriesModel'
|
||||
], function (Backbone, SeriesModel) {
|
||||
var collection = Backbone.Collection.extend({
|
||||
var Collection = Backbone.Collection.extend({
|
||||
url : window.ApiRoot + '/series',
|
||||
model: SeriesModel,
|
||||
|
||||
@ -18,5 +18,8 @@ define(
|
||||
}
|
||||
});
|
||||
|
||||
return new collection();
|
||||
var collection = new Collection();
|
||||
collection.fetch();
|
||||
|
||||
return collection;
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
|
Loading…
Reference in New Issue
Block a user