From 6e6df842a09b0378ca5337244d39a11687f34337 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 26 May 2013 19:53:56 -0700 Subject: [PATCH] removed add series tab --- NzbDrone.Api/Series/SeriesModule.cs | 5 +- NzbDrone.ncrunchsolution | 1 + UI/AddSeries/AddSeriesLayout.js | 89 +++---------------- UI/AddSeries/AddSeriesTemplate.html | 9 ++ .../AddNewSeriesView.js => AddSeriesView.js} | 7 +- UI/AddSeries/Existing/ImportSeriesView.js | 15 +--- .../RootFolderCompositeViewTemplate.html | 7 -- UI/AddSeries/New/AddNewSeriesTemplate.html | 9 -- UI/AddSeries/RootFolders/LayoutTemplate.html | 15 ++++ .../RootFolderSelectionTemplate.html | 7 ++ .../RootFolders/RootFolderTemplate.html | 9 -- .../RootFolders/RootFolderTemplateHelper.js | 11 +++ UI/AddSeries/RootFolders/RootFolderView.js | 7 +- UI/AddSeries/SearchResultTemplate.html | 6 +- UI/AddSeries/SearchResultView.js | 2 +- UI/AddSeries/addSeries.less | 21 +++-- UI/AddSeries/addSeriesLayoutTemplate.html | 15 ++-- UI/Shared/Styles/clickable.less | 3 + 18 files changed, 87 insertions(+), 151 deletions(-) create mode 100644 UI/AddSeries/AddSeriesTemplate.html rename UI/AddSeries/{New/AddNewSeriesView.js => AddSeriesView.js} (91%) delete mode 100644 UI/AddSeries/Existing/RootFolderCompositeViewTemplate.html delete mode 100644 UI/AddSeries/New/AddNewSeriesTemplate.html create mode 100644 UI/AddSeries/RootFolders/LayoutTemplate.html create mode 100644 UI/AddSeries/RootFolders/RootFolderSelectionTemplate.html delete mode 100644 UI/AddSeries/RootFolders/RootFolderTemplate.html create mode 100644 UI/AddSeries/RootFolders/RootFolderTemplateHelper.js create mode 100644 UI/Shared/Styles/clickable.less diff --git a/NzbDrone.Api/Series/SeriesModule.cs b/NzbDrone.Api/Series/SeriesModule.cs index a400baddd..a2ef639f0 100644 --- a/NzbDrone.Api/Series/SeriesModule.cs +++ b/NzbDrone.Api/Series/SeriesModule.cs @@ -31,11 +31,10 @@ namespace NzbDrone.Api.Series SharedValidator.RuleFor(s => s.QualityProfileId).ValidId(); - PutValidator.RuleFor(s => s.Path).NotEmpty().When(s => String.IsNullOrEmpty(s.RootFolderPath)); - PutValidator.RuleFor(s => s.RootFolderPath).NotEmpty().When(s => String.IsNullOrEmpty(s.Path)); + SharedValidator.RuleFor(s => s.Path).NotEmpty().When(s => String.IsNullOrEmpty(s.RootFolderPath)); + SharedValidator.RuleFor(s => s.RootFolderPath).NotEmpty().When(s => String.IsNullOrEmpty(s.Path)); PostValidator.RuleFor(s => s.Title).NotEmpty(); - PostValidator.RuleFor(s => s.Path).NotEmpty(); } private Response GetSeries(string slug) diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 6cb47a29a..444b34b1d 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,6 +2,7 @@ 1 False true + true UseDynamicAnalysis Disabled Disabled diff --git a/UI/AddSeries/AddSeriesLayout.js b/UI/AddSeries/AddSeriesLayout.js index c0ec5320b..64d902ef6 100644 --- a/UI/AddSeries/AddSeriesLayout.js +++ b/UI/AddSeries/AddSeriesLayout.js @@ -4,7 +4,7 @@ define([ 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/RootFolderView', - 'AddSeries/New/AddNewSeriesView', + 'AddSeries/AddSeriesView', 'AddSeries/Existing/ImportSeriesView' ], function (app, rootFolderCollection, qualityProfileCollection) { @@ -12,96 +12,27 @@ define([ template: 'AddSeries/addSeriesLayoutTemplate', 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' + workspace: '#add-series-workspace' }, 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(); - } - - 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(); - } + 'click .x-import': '_importSeries' }, onRender: function () { - var self = this; - - rootFolderCollection.fetch({success: function () { - self.importExisting.show(new NzbDrone.AddSeries.Existing.RootFolderCompositeView({model: rootFolderCollection.at(0)})); - }}); + /* rootFolderCollection.fetch({success: function () { + self.importExisting.show(new NzbDrone.AddSeries.Existing.RootDirListView({model: rootFolderCollection.at(0)})); + }});*/ qualityProfileCollection.fetch(); + rootFolderCollection.fetch(); - this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView()); - 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); + this.workspace.show(new NzbDrone.AddSeries.AddSeriesView()); }, - onShow: function () { - switch (this.action) { - case 'import': - this.showImport(); - break; - case 'rootfolders': - this.showRootFolders(); - break; - default: - this.showAddNew(); - } - }, - evaluateActions: function () { - if (rootFolderCollection.length === 0) { - this.ui.addNewTab.hide(); - this.ui.importExistingTab.hide(); - this.showRootFolders(); - } else { - this.ui.addNewTab.show(); - this.ui.importExistingTab.show(); - } + _importSeries: function () { + NzbDrone.modalRegion.show(new NzbDrone.AddSeries.RootFolders.Layout()); } }); }); diff --git a/UI/AddSeries/AddSeriesTemplate.html b/UI/AddSeries/AddSeriesTemplate.html new file mode 100644 index 000000000..9756cd3fd --- /dev/null +++ b/UI/AddSeries/AddSeriesTemplate.html @@ -0,0 +1,9 @@ +
+ +
+
+
+
\ No newline at end of file diff --git a/UI/AddSeries/New/AddNewSeriesView.js b/UI/AddSeries/AddSeriesView.js similarity index 91% rename from UI/AddSeries/New/AddNewSeriesView.js rename to UI/AddSeries/AddSeriesView.js index 9d3a444b0..f4dddaa4c 100644 --- a/UI/AddSeries/New/AddNewSeriesView.js +++ b/UI/AddSeries/AddSeriesView.js @@ -4,12 +4,11 @@ define(['app', 'AddSeries/SearchResultView', 'Shared/SpinnerView', 'AddSeries/Collection'], function () { - NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({ - template: 'AddSeries/New/AddNewSeriesTemplate', - route : 'Series/add/new', + NzbDrone.AddSeries.AddSeriesView = Backbone.Marionette.Layout.extend({ + template: 'AddSeries/AddSeriesTemplate', ui: { - seriesSearch: '.search input' + seriesSearch: '.x-series-search' }, regions: { diff --git a/UI/AddSeries/Existing/ImportSeriesView.js b/UI/AddSeries/Existing/ImportSeriesView.js index 60fbdc598..8c4515f8e 100644 --- a/UI/AddSeries/Existing/ImportSeriesView.js +++ b/UI/AddSeries/Existing/ImportSeriesView.js @@ -107,21 +107,13 @@ define([ } }); - NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({ + NzbDrone.AddSeries.Existing.ListView = Backbone.Marionette.CollectionView.extend({ - template : "AddSeries/Existing/RootFolderCompositeViewTemplate", - itemViewContainer: ".x-existing-folder-container", - itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView, + itemView: NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView, initialize: function () { - - if (!this.model) { - throw "model is required."; - } - this.collection = new NzbDrone.AddSeries.Existing.UnmappedFolderCollection(); this.refreshItems(); - this.listenTo(qualityProfileCollection, 'reset', this.refreshItems, this); }, refreshItems: function () { @@ -147,5 +139,4 @@ define([ } }); -}) -; +}); diff --git a/UI/AddSeries/Existing/RootFolderCompositeViewTemplate.html b/UI/AddSeries/Existing/RootFolderCompositeViewTemplate.html deleted file mode 100644 index cd89a1501..000000000 --- a/UI/AddSeries/Existing/RootFolderCompositeViewTemplate.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
-

{{path}}

- -
-
-
\ No newline at end of file diff --git a/UI/AddSeries/New/AddNewSeriesTemplate.html b/UI/AddSeries/New/AddNewSeriesTemplate.html deleted file mode 100644 index cf2348abc..000000000 --- a/UI/AddSeries/New/AddNewSeriesTemplate.html +++ /dev/null @@ -1,9 +0,0 @@ -
- -
-
-
-
\ No newline at end of file diff --git a/UI/AddSeries/RootFolders/LayoutTemplate.html b/UI/AddSeries/RootFolders/LayoutTemplate.html new file mode 100644 index 000000000..1db0790e2 --- /dev/null +++ b/UI/AddSeries/RootFolders/LayoutTemplate.html @@ -0,0 +1,15 @@ + +