From 9d6f7efbf2018a284e59bb3048027e3f021fc845 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 3 Jul 2013 20:04:26 -0700 Subject: [PATCH] Manual search is persistent through tab changes --- NzbDrone.ncrunchsolution | 1 - UI/.idea/jsLibraryMappings.xml | 2 +- UI/Episode/Layout.js | 4 +-- UI/Episode/Search/ButtonsView.js | 11 +++++++ UI/Episode/Search/ButtonsViewTemplate.html | 4 +++ UI/Episode/Search/Layout.js | 33 ++++++++++++++------- UI/Episode/Search/LayoutTemplate.html | 8 +---- UI/Episode/Search/ManualLayoutTemplate.html | 1 + 8 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 UI/Episode/Search/ButtonsView.js create mode 100644 UI/Episode/Search/ButtonsViewTemplate.html diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 444b34b1d..6cb47a29a 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,7 +2,6 @@ 1 False true - true UseDynamicAnalysis Disabled Disabled diff --git a/UI/.idea/jsLibraryMappings.xml b/UI/.idea/jsLibraryMappings.xml index 03911505b..5fe165e16 100644 --- a/UI/.idea/jsLibraryMappings.xml +++ b/UI/.idea/jsLibraryMappings.xml @@ -1,7 +1,7 @@ - + diff --git a/UI/Episode/Layout.js b/UI/Episode/Layout.js index e7481f498..6e51c6670 100644 --- a/UI/Episode/Layout.js +++ b/UI/Episode/Layout.js @@ -30,7 +30,7 @@ define( onShow: function () { this._showSummary(); - this._releaseSearchActivated = false; + this.searchLayout = new SearchLayout({ model: this.model }); }, @@ -58,7 +58,7 @@ define( } this.ui.search.tab('show'); - this.search.show(new SearchLayout({ model: this.model })); + this.search.show(this.searchLayout); } }); diff --git a/UI/Episode/Search/ButtonsView.js b/UI/Episode/Search/ButtonsView.js new file mode 100644 index 000000000..6daa5abb4 --- /dev/null +++ b/UI/Episode/Search/ButtonsView.js @@ -0,0 +1,11 @@ +'use strict'; +define( + [ + 'app', + 'marionette' + ], function (App, Marionette) { + + return Marionette.ItemView.extend({ + template: 'Episode/Search/ButtonsViewTemplate' + }); + }); diff --git a/UI/Episode/Search/ButtonsViewTemplate.html b/UI/Episode/Search/ButtonsViewTemplate.html new file mode 100644 index 000000000..96456d3f4 --- /dev/null +++ b/UI/Episode/Search/ButtonsViewTemplate.html @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/UI/Episode/Search/Layout.js b/UI/Episode/Search/Layout.js index 300b99a87..e6cbd1c61 100644 --- a/UI/Episode/Search/Layout.js +++ b/UI/Episode/Search/Layout.js @@ -3,12 +3,13 @@ define( [ 'app', 'marionette', + 'Episode/Search/ButtonsView', 'Episode/Search/ManualLayout', 'Release/Collection', 'Shared/SpinnerView', 'Shared/Messenger', 'Commands/CommandController' - ], function (App, Marionette, ManualSearchLayout, ReleaseCollection, SpinnerView, Messenger, CommandController) { + ], function (App, Marionette, ButtonsView, ManualSearchLayout, ReleaseCollection, SpinnerView, Messenger, CommandController) { return Marionette.Layout.extend({ template: 'Episode/Search/LayoutTemplate', @@ -18,12 +19,17 @@ define( }, events: { - 'click .x-search-auto': '_searchAuto', - 'click .x-search-manual': '_searchManual' + 'click .x-search-auto' : '_searchAuto', + 'click .x-search-manual': '_searchManual', + 'click .x-search-back' : '_showButtons' + }, + + initialize: function () { + this.mainView = new ButtonsView(); }, onShow: function () { - this._releaseSearchActivated = false; + this._showMainView(); }, _searchAuto: function (e) { @@ -50,22 +56,29 @@ define( e.preventDefault(); } - if (this._releaseSearchActivated) { - return; - } - var self = this; - this.main.show(new SpinnerView()); + this.mainView = new SpinnerView(); + this._showMainView(); var releases = new ReleaseCollection(); var promise = releases.fetchEpisodeReleases(this.model.id); promise.done(function () { if (!self.isClosed) { - self.main.show(new ManualSearchLayout({collection: releases})); + self.mainView = new ManualSearchLayout({collection: releases}); + self._showMainView(); } }); + }, + + _showMainView: function () { + this.main.show(this.mainView); + }, + + _showButtons: function () { + this.mainView = new ButtonsView(); + this._showMainView(); } }); diff --git a/UI/Episode/Search/LayoutTemplate.html b/UI/Episode/Search/LayoutTemplate.html index 547d6d631..a0db76df8 100644 --- a/UI/Episode/Search/LayoutTemplate.html +++ b/UI/Episode/Search/LayoutTemplate.html @@ -1,7 +1 @@ - -
-
- - -
-
\ No newline at end of file +
\ No newline at end of file diff --git a/UI/Episode/Search/ManualLayoutTemplate.html b/UI/Episode/Search/ManualLayoutTemplate.html index d90cd597d..84945e3bb 100644 --- a/UI/Episode/Search/ManualLayoutTemplate.html +++ b/UI/Episode/Search/ManualLayoutTemplate.html @@ -1 +1,2 @@ 
+ \ No newline at end of file