Manual search is persistent through tab changes

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

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

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

@ -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);
}
});

@ -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',
'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();
}
});

@ -1,7 +1 @@

<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>
<div id="episode-search-region"></div>

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