|
|
@ -2,9 +2,9 @@
|
|
|
|
define([
|
|
|
|
define([
|
|
|
|
'app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'Shared/NotificationCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
|
|
|
'app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'Shared/NotificationCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
|
|
|
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
|
|
|
|
template: 'AddSeries/Existing/FolderMatchResultViewTemplate',
|
|
|
|
template: 'AddSeries/SearchResultTemplate',
|
|
|
|
|
|
|
|
className: 'search-item',
|
|
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .x-btn-add': 'addSeries'
|
|
|
|
'click .x-btn-add': 'addSeries'
|
|
|
@ -26,7 +26,6 @@ define([
|
|
|
|
path : path
|
|
|
|
path : path
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
|
|
|
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
|
|
|
seriesCollection.add(model);
|
|
|
|
seriesCollection.add(model);
|
|
|
|
|
|
|
|
|
|
|
@ -44,17 +43,18 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
|
|
|
|
|
|
|
|
template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplate',
|
|
|
|
template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplate',
|
|
|
|
itemViewContainer: '.x-folder-name-match-results',
|
|
|
|
itemViewContainer: '.x-folder-name-match-results',
|
|
|
|
|
|
|
|
className : 'unmapped-folder-view',
|
|
|
|
itemView : NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
|
|
|
itemView : NzbDrone.AddSeries.Existing.FolderMatchResultView,
|
|
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .x-btn-search': 'search'
|
|
|
|
'click .x-btn-search': 'search',
|
|
|
|
|
|
|
|
'keydown .x-txt-search': 'keydown'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
ui: {
|
|
|
|
ui: {
|
|
|
@ -64,20 +64,25 @@ define([
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
initialize: function () {
|
|
|
|
this.collection = new NzbDrone.AddSeries.SearchResultCollection();
|
|
|
|
this.collection = new NzbDrone.Series.SeriesCollection();
|
|
|
|
|
|
|
|
this.collection.bind('reset', this.collectionReset, this);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
search: function () {
|
|
|
|
onRender: function () {
|
|
|
|
|
|
|
|
this.collection.url = NzbDrone.Constants.ApiRoot + '/series/lookup';
|
|
|
|
|
|
|
|
this.resultView = new NzbDrone.AddSeries.SearchResultView({ collection: this.collection });
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
search: function () {
|
|
|
|
var icon = this.ui.searchButton.find('icon');
|
|
|
|
var icon = this.ui.searchButton.find('icon');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.collection.reset();
|
|
|
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
|
|
|
icon.removeClass('icon-search').addClass('icon-spin icon-spinner disabled');
|
|
|
|
|
|
|
|
|
|
|
|
this.collection.fetch({
|
|
|
|
this.collection.fetch({
|
|
|
|
data : { term: this.ui.searchText.val() },
|
|
|
|
data : { term: this.ui.searchText.val() },
|
|
|
|
success: function () {
|
|
|
|
success: function (collection) {
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fail : function () {
|
|
|
|
fail : function () {
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
|
|
@ -85,6 +90,19 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
keydown: function (e) {
|
|
|
|
|
|
|
|
var code = (e.keyCode ? e.keyCode : e.which);
|
|
|
|
|
|
|
|
if(code === 13) {
|
|
|
|
|
|
|
|
this.search();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
collectionReset: function () {
|
|
|
|
|
|
|
|
_.each(this.collection.models, function (model){
|
|
|
|
|
|
|
|
model.set('isExisting', true);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
itemViewOptions: function () {
|
|
|
|
itemViewOptions: function () {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
qualityProfile: this.ui.profileList,
|
|
|
|
qualityProfile: this.ui.profileList,
|
|
|
@ -92,15 +110,13 @@ define([
|
|
|
|
folder : this.model.get('folder')
|
|
|
|
folder : this.model.get('folder')
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
|
|
|
|
|
|
|
|
template : "AddSeries/Existing/RootFolderCompositeViewTemplate",
|
|
|
|
template : "AddSeries/Existing/RootFolderCompositeViewTemplate",
|
|
|
|
itemViewContainer: ".x-existing-folder-container",
|
|
|
|
itemViewContainer: ".x-existing-folder-container",
|
|
|
|
|
|
|
|
className : 'row',
|
|
|
|
itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
|
|
|
itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function () {
|
|
|
|
initialize: function () {
|
|
|
@ -117,9 +133,6 @@ define([
|
|
|
|
refreshItems: function () {
|
|
|
|
refreshItems: function () {
|
|
|
|
this.collection.importItems(this.model);
|
|
|
|
this.collection.importItems(this.model);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
|
|
|
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
|
|
|
@ -129,6 +142,5 @@ define([
|
|
|
|
initialize: function () {
|
|
|
|
initialize: function () {
|
|
|
|
this.collection = rootFolders;
|
|
|
|
this.collection = rootFolders;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|