Skip to content

Commit

Permalink
Enable toggling between analyze and BigCZ results
Browse files Browse the repository at this point in the history
Allow the user to switch between the AoI analyze results, and the BigCZ
search page. This implementation is based on the analyze and modeling
tabs of MMW. Some views, templates, and CSS rules from that implementation
were duplicated and adjusted rather than abstracting the MMW
implementation and making it reusable.

Refs #2095
  • Loading branch information
caseycesari committed Aug 8, 2017
1 parent e694705 commit df4e326
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/mmw/js/src/data_catalog/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ var DataCatalogController = {
})
]);

var view = new views.DataCatalogWindow({
model: form,
collection: catalogs
});
App.rootView.sidebarRegion.show(view);
var resultsWindow = new views.ResultsWindow({
model: form,
collection: catalogs
}),
header = new views.HeaderView();

App.rootView.subHeaderRegion.show(header);
App.rootView.sidebarRegion.show(resultsWindow);
},

dataCatalogCleanUp: function() {
Expand Down
29 changes: 29 additions & 0 deletions src/mmw/js/src/data_catalog/templates/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<header id="model-header" class="bigcz">
<div id="project-menu-region">
<div class="project">
<div class="project-left">
<div class="project-title">
<button class="btn dropdown-toggle project-dropdown" type="button" data-toggle="dropdown" aria-expanded="true">
{{ aoiName }}
</button>
</div>
<div class="model-analyze-toggle-tab-header" role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation">
<a aria-controls="home" aria-expanded="false"
data-toggle="tab" href="#analyze-tab-contents" role="tab">
<div> Analyze </div>
</a>
</li>
<li class="active" role="presentation">
<a aria-controls="home" aria-expanded="true"
data-toggle="tab" href="#data-catalog-tab-contents" role="tab">
<div> Data </div>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</header>
6 changes: 6 additions & 0 deletions src/mmw/js/src/data_catalog/templates/resultsWindow.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="tab-contents-region">
<div class="tab-content">
<div role="tabpanel" id="analyze-tab-contents" class="tab-pane data-catalog-stage-results-tab-pane"></div>
<div role="tabpanel" id="data-catalog-tab-contents" class="tab-pane data-catalog-stage-results-tab-pane"></div>
</div>
</div>
46 changes: 44 additions & 2 deletions src/mmw/js/src/data_catalog/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var $ = require('jquery'),
Marionette = require('../../shim/backbone.marionette'),
moment = require('moment'),
App = require('../app'),
analyzeViews = require('../analyze/views.js'),
settings = require('../core/settings'),
utils = require('./utils'),
errorTmpl = require('./templates/error.html'),
Expand All @@ -14,7 +15,9 @@ var $ = require('jquery'),
cuahsiSearchResultTmpl = require('./templates/cuahsiSearchResult.html'),
tabContentTmpl = require('./templates/tabContent.html'),
tabPanelTmpl = require('./templates/tabPanel.html'),
windowTmpl = require('./templates/window.html');
headerTmpl = require('./templates/header.html'),
windowTmpl = require('./templates/window.html'),
resultsWindowTmpl = require('./templates/resultsWindow.html');

var ENTER_KEYCODE = 13,
PAGE_SIZE = settings.get('data_catalog_page_size'),
Expand All @@ -24,6 +27,44 @@ var ENTER_KEYCODE = 13,
cuahsi: cuahsiSearchResultTmpl,
};

var HeaderView = Marionette.LayoutView.extend({
template: headerTmpl,

templateHelpers: function() {
return {
aoiName: App.map.get('areaOfInterestName')
};
}
});

var ResultsWindow = Marionette.LayoutView.extend({
id: 'model-output-wrapper',
tagName: 'div',
template: resultsWindowTmpl,

regions: {
analyzeRegion: '#analyze-tab-contents',
dataCatalogRegion: '#data-catalog-tab-contents'
},

onShow: function() {
var analyzeCollection = App.getAnalyzeCollection();

this.analyzeRegion.show(new analyzeViews.AnalyzeWindow({
collection: analyzeCollection
}));

this.dataCatalogRegion.show(new DataCatalogWindow({
model: this.model,
collection: this.collection
}));
},

onRender: function() {
this.$el.find('.tab-pane:last').addClass('active');
}
});

var DataCatalogWindow = Marionette.LayoutView.extend({
template: windowTmpl,
className: 'data-catalog-window',
Expand Down Expand Up @@ -386,5 +427,6 @@ var PagerView = Marionette.ItemView.extend({
});

module.exports = {
DataCatalogWindow: DataCatalogWindow
HeaderView: HeaderView,
ResultsWindow: ResultsWindow
};
4 changes: 4 additions & 0 deletions src/mmw/sass/base/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ header {
background-color: $ui-secondary;
height: $height-xl*2;

&.bigcz {
height: $height-xl;
}

.project {
position: relative;
top: -15px;
Expand Down
7 changes: 7 additions & 0 deletions src/mmw/sass/components/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
}
}

.data-catalog-stage-results-tab-pane {
.tab-content {
// Set a specific height to allow y-scroll:
height: 100% !important;
}
}

//Model Output Tabs
.output-tabs-wrapper {
.nav-tabs {
Expand Down
4 changes: 3 additions & 1 deletion src/mmw/sass/pages/_data-catalog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: column;
position: absolute;
bottom: 0;
top: 44px;
top: 90px;

.tab-contents-region {
background-color: rgba(0, 0, 0, 0.06);
Expand All @@ -16,6 +16,8 @@
}

.result-region {
height: auto !important;
width: auto !important;
padding: 6px 0px;

&.paginated {
Expand Down

0 comments on commit df4e326

Please sign in to comment.