Manual search is persistent through tab changes

pull/2/head
Mark McDowall 12 years ago
parent a2d993138c
commit 9d6f7efbf2

@ -2,7 +2,6 @@
<FileVersion>1</FileVersion> <FileVersion>1</FileVersion>
<AutoEnableOnStartup>False</AutoEnableOnStartup> <AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution> <AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit> <FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio> <FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec> <FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="JavaScriptLibraryMappings"> <component name="JavaScriptLibraryMappings">
<file url="PROJECT" libraries="{backbone.backgrid.filter.js, jQuery-1.9.1}" /> <file url="PROJECT" libraries="{backbone.backgrid.filter.js}" />
</component> </component>
</project> </project>

@ -30,7 +30,7 @@ define(
onShow: function () { onShow: function () {
this._showSummary(); this._showSummary();
this._releaseSearchActivated = false; this.searchLayout = new SearchLayout({ model: this.model });
}, },
@ -58,7 +58,7 @@ define(
} }
this.ui.search.tab('show'); this.ui.search.tab('show');
this.search.show(new SearchLayout({ model: this.model })); this.search.show(this.searchLayout);
} }
}); });

@ -0,0 +1,11 @@
'use strict';
define(
[
'app',
'marionette'
], function (App, Marionette) {
return Marionette.ItemView.extend({
template: 'Episode/Search/ButtonsViewTemplate'
});
});

@ -0,0 +1,4 @@
<div class="search-buttons">
<button class="btn btn-large btn-block x-search-auto"><i class="icon-rocket"/> Automatic Search</button>
<button class="btn btn-large btn-block btn-primary x-search-manual"><i class="icon-user"/> Manual Search</button>
</div>

@ -3,12 +3,13 @@ define(
[ [
'app', 'app',
'marionette', 'marionette',
'Episode/Search/ButtonsView',
'Episode/Search/ManualLayout', 'Episode/Search/ManualLayout',
'Release/Collection', 'Release/Collection',
'Shared/SpinnerView', 'Shared/SpinnerView',
'Shared/Messenger', 'Shared/Messenger',
'Commands/CommandController' 'Commands/CommandController'
], function (App, Marionette, ManualSearchLayout, ReleaseCollection, SpinnerView, Messenger, CommandController) { ], function (App, Marionette, ButtonsView, ManualSearchLayout, ReleaseCollection, SpinnerView, Messenger, CommandController) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'Episode/Search/LayoutTemplate', template: 'Episode/Search/LayoutTemplate',
@ -18,12 +19,17 @@ define(
}, },
events: { events: {
'click .x-search-auto': '_searchAuto', 'click .x-search-auto' : '_searchAuto',
'click .x-search-manual': '_searchManual' 'click .x-search-manual': '_searchManual',
'click .x-search-back' : '_showButtons'
},
initialize: function () {
this.mainView = new ButtonsView();
}, },
onShow: function () { onShow: function () {
this._releaseSearchActivated = false; this._showMainView();
}, },
_searchAuto: function (e) { _searchAuto: function (e) {
@ -50,22 +56,29 @@ define(
e.preventDefault(); e.preventDefault();
} }
if (this._releaseSearchActivated) {
return;
}
var self = this; var self = this;
this.main.show(new SpinnerView()); this.mainView = new SpinnerView();
this._showMainView();
var releases = new ReleaseCollection(); var releases = new ReleaseCollection();
var promise = releases.fetchEpisodeReleases(this.model.id); var promise = releases.fetchEpisodeReleases(this.model.id);
promise.done(function () { promise.done(function () {
if (!self.isClosed) { 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();
} }
}); });

@ -1,7 +1 @@
 <div id="episode-search-region"></div>
<div id="episode-search-region">
<div class="search-buttons">
<button class="btn btn-large btn-block x-search-auto"><i class="icon-rocket"/> Automatic Search</button>
<button class="btn btn-large btn-block btn-primary x-search-manual"><i class="icon-user"/> Manual Search</button>
</div>
</div>

@ -1 +1,2 @@
<div id="episode-release-grid"/> <div id="episode-release-grid"/>
<button class="btn x-search-back">Back</button>
Loading…
Cancel
Save