|
|
@ -4,7 +4,7 @@ define([
|
|
|
|
'AddSeries/RootFolders/RootFolderCollection',
|
|
|
|
'AddSeries/RootFolders/RootFolderCollection',
|
|
|
|
'Quality/QualityProfileCollection',
|
|
|
|
'Quality/QualityProfileCollection',
|
|
|
|
'AddSeries/RootFolders/RootFolderView',
|
|
|
|
'AddSeries/RootFolders/RootFolderView',
|
|
|
|
'AddSeries/New/AddNewSeriesView',
|
|
|
|
'AddSeries/AddSeriesView',
|
|
|
|
'AddSeries/Existing/ImportSeriesView'
|
|
|
|
'AddSeries/Existing/ImportSeriesView'
|
|
|
|
],
|
|
|
|
],
|
|
|
|
function (app, rootFolderCollection, qualityProfileCollection) {
|
|
|
|
function (app, rootFolderCollection, qualityProfileCollection) {
|
|
|
@ -12,96 +12,27 @@ define([
|
|
|
|
template: 'AddSeries/addSeriesLayoutTemplate',
|
|
|
|
template: 'AddSeries/addSeriesLayoutTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
regions: {
|
|
|
|
addNew : '#add-new',
|
|
|
|
workspace: '#add-series-workspace'
|
|
|
|
importExisting: '#import-existing',
|
|
|
|
|
|
|
|
rootFolders : '#root-folders'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui: {
|
|
|
|
|
|
|
|
addNewTab : '.x-add-new-tab',
|
|
|
|
|
|
|
|
importExistingTab: '.x-import-existing-tab',
|
|
|
|
|
|
|
|
rootFoldersTab : '.x-root-folders-tab'
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .x-add-new-tab' : 'showAddNew',
|
|
|
|
'click .x-import': '_importSeries'
|
|
|
|
'click .x-import-existing-tab': 'showImport',
|
|
|
|
|
|
|
|
'click .x-root-folders-tab' : 'showRootFolders'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showAddNew: function (e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.addNewTab.tab('show');
|
|
|
|
|
|
|
|
NzbDrone.Router.navigate('series/add/new');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showImport: function (e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.importExistingTab.tab('show');
|
|
|
|
|
|
|
|
NzbDrone.Router.navigate('series/add/import');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showRootFolders: function (e) {
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.rootFoldersTab.tab('show');
|
|
|
|
|
|
|
|
NzbDrone.Router.navigate('series/add/rootfolders');
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
|
|
|
|
if (options.action) {
|
|
|
|
|
|
|
|
this.action = options.action.toLowerCase();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onRender: function () {
|
|
|
|
onRender: function () {
|
|
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
/* rootFolderCollection.fetch({success: function () {
|
|
|
|
|
|
|
|
self.importExisting.show(new NzbDrone.AddSeries.Existing.RootDirListView({model: rootFolderCollection.at(0)}));
|
|
|
|
rootFolderCollection.fetch({success: function () {
|
|
|
|
}});*/
|
|
|
|
self.importExisting.show(new NzbDrone.AddSeries.Existing.RootFolderCompositeView({model: rootFolderCollection.at(0)}));
|
|
|
|
|
|
|
|
}});
|
|
|
|
|
|
|
|
qualityProfileCollection.fetch();
|
|
|
|
qualityProfileCollection.fetch();
|
|
|
|
|
|
|
|
rootFolderCollection.fetch();
|
|
|
|
|
|
|
|
|
|
|
|
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView());
|
|
|
|
this.workspace.show(new NzbDrone.AddSeries.AddSeriesView());
|
|
|
|
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(rootFolderCollection, 'add', this.evaluateActions, this);
|
|
|
|
|
|
|
|
this.listenTo(rootFolderCollection, 'remove', this.evaluateActions, this);
|
|
|
|
|
|
|
|
this.listenTo(rootFolderCollection, 'reset', this.evaluateActions, this);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
switch (this.action) {
|
|
|
|
|
|
|
|
case 'import':
|
|
|
|
|
|
|
|
this.showImport();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'rootfolders':
|
|
|
|
|
|
|
|
this.showRootFolders();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
this.showAddNew();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
evaluateActions: function () {
|
|
|
|
_importSeries: function () {
|
|
|
|
if (rootFolderCollection.length === 0) {
|
|
|
|
NzbDrone.modalRegion.show(new NzbDrone.AddSeries.RootFolders.Layout());
|
|
|
|
this.ui.addNewTab.hide();
|
|
|
|
|
|
|
|
this.ui.importExistingTab.hide();
|
|
|
|
|
|
|
|
this.showRootFolders();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.ui.addNewTab.show();
|
|
|
|
|
|
|
|
this.ui.importExistingTab.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|