mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
moved most of addseries to use require.js
This commit is contained in:
@@ -1,111 +1,111 @@
|
||||
/// <reference path="../app.js" />
|
||||
/// <reference path="New/AddNewSeriesView.js" />
|
||||
/// <reference path="RootFolders/RootDirView.js" />
|
||||
/// <reference path="../Quality/qualityProfileCollection.js" />
|
||||
/// <reference path="../Shared/SpinnerView.js" />
|
||||
/// <reference path="Existing/ImportSeriesView.js" />
|
||||
define([
|
||||
'app',
|
||||
'AddSeries/RootFolders/RootFolderView',
|
||||
'AddSeries/RootFolders/RootFolderCollection',
|
||||
'AddSeries/New/AddNewSeriesView',
|
||||
'AddSeries/Existing/ImportSeriesView',
|
||||
'Quality/QualityProfileCollection'
|
||||
],
|
||||
function () {
|
||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/addSeriesLayoutTemplate',
|
||||
|
||||
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'AddSeries/addSeriesLayoutTemplate',
|
||||
regions: {
|
||||
addNew: '#add-new',
|
||||
importExisting: '#import-existing',
|
||||
rootFolders: '#root-folders'
|
||||
},
|
||||
|
||||
regions: {
|
||||
addNew: '#add-new',
|
||||
importExisting: '#import-existing',
|
||||
rootFolders: '#root-folders'
|
||||
},
|
||||
ui: {
|
||||
addNewTab: '.x-add-new-tab',
|
||||
importExistingTab: '.x-import-existing-tab',
|
||||
rootFoldersTab: '.x-root-folders-tab'
|
||||
},
|
||||
|
||||
ui: {
|
||||
addNewTab: '.x-add-new-tab',
|
||||
importExistingTab: '.x-import-existing-tab',
|
||||
rootFoldersTab: '.x-root-folders-tab'
|
||||
},
|
||||
events: {
|
||||
'click .x-add-new-tab': 'showAddNew',
|
||||
'click .x-import-existing-tab': 'showImport',
|
||||
'click .x-root-folders-tab': 'showRootFolders'
|
||||
},
|
||||
|
||||
showAddNew: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
events: {
|
||||
'click .x-add-new-tab': 'showAddNew',
|
||||
'click .x-import-existing-tab': 'showImport',
|
||||
'click .x-root-folders-tab': 'showRootFolders'
|
||||
},
|
||||
this.ui.addNewTab.tab('show');
|
||||
NzbDrone.Router.navigate('series/add/new');
|
||||
|
||||
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');
|
||||
},
|
||||
|
||||
showImport: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
showRootFolders: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
this.ui.importExistingTab.tab('show');
|
||||
NzbDrone.Router.navigate('series/add/import');
|
||||
},
|
||||
this.ui.rootFoldersTab.tab('show');
|
||||
NzbDrone.Router.navigate('series/add/rootfolders');
|
||||
},
|
||||
|
||||
showRootFolders: function (e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
rootFolderCollection: new NzbDrone.AddSeries.RootFolders.RootFolderCollection(),
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
|
||||
this.ui.rootFoldersTab.tab('show');
|
||||
NzbDrone.Router.navigate('series/add/rootfolders');
|
||||
},
|
||||
initialize: function (context, action, query) {
|
||||
if (action) {
|
||||
this.action = action.toLowerCase();
|
||||
}
|
||||
|
||||
rootFolderCollection: new NzbDrone.AddSeries.RootDirCollection(),
|
||||
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
||||
if (query) {
|
||||
this.query = query.toLowerCase();
|
||||
}
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
|
||||
initialize: function (context, action, query) {
|
||||
if (action) {
|
||||
this.action = action.toLowerCase();
|
||||
}
|
||||
this.qualityProfileCollection.fetch();
|
||||
this.rootFolderCollection.fetch();
|
||||
|
||||
if (query) {
|
||||
this.query = query.toLowerCase();
|
||||
}
|
||||
},
|
||||
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection, quality: this.qualityProfileCollection }));
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||
|
||||
onRender: function () {
|
||||
this.listenTo(this.rootFolderCollection, 'add', this.evaluateActions, this);
|
||||
this.listenTo(this.rootFolderCollection, 'remove', this.evaluateActions, this);
|
||||
this.listenTo(this.rootFolderCollection, 'reset', this.evaluateActions, this);
|
||||
},
|
||||
|
||||
this.qualityProfileCollection.fetch();
|
||||
this.rootFolderCollection.fetch();
|
||||
onShow: function () {
|
||||
switch (this.action) {
|
||||
case 'import':
|
||||
this.showImport();
|
||||
break;
|
||||
case 'rootfolders':
|
||||
this.showRootFolders();
|
||||
break;
|
||||
default:
|
||||
this.showAddNew();
|
||||
}
|
||||
},
|
||||
|
||||
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
|
||||
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection, quality: this.qualityProfileCollection }));
|
||||
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
|
||||
evaluateActions: function () {
|
||||
if (this.rootFolderCollection.length === 0) {
|
||||
this.ui.addNewTab.hide();
|
||||
this.ui.importExistingTab.hide();
|
||||
this.showRootFolders();
|
||||
} else {
|
||||
this.ui.addNewTab.show();
|
||||
this.ui.importExistingTab.show();
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
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 () {
|
||||
switch (this.action) {
|
||||
case 'import':
|
||||
this.showImport();
|
||||
break;
|
||||
case 'rootfolders':
|
||||
this.showRootFolders();
|
||||
break;
|
||||
default:
|
||||
this.showAddNew();
|
||||
}
|
||||
},
|
||||
|
||||
evaluateActions: function () {
|
||||
if (this.rootFolderCollection.length === 0) {
|
||||
this.ui.addNewTab.hide();
|
||||
this.ui.importExistingTab.hide();
|
||||
this.showRootFolders();
|
||||
} else {
|
||||
this.ui.addNewTab.show();
|
||||
this.ui.importExistingTab.show();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user