Create a new scala template in geodashboard/app/views/detail_view/tabs
@()(implicit lang: Lang) <div class="tab-pane" id="dissolved-oxygen-profile"> </div> |
Create the tab
<li id="dissolved-oxygen-tab"><a href="#dissolved-oxygen-profile" data-toggle="tab">Dissolved Oxygen</a></li> |
Note: The href needs to match the id in the Scala Template
Import the scala template
@detail_view.tabs.dissolved_oxygen() |
This adds the code from the template to the DOM
Create the following objects:
var dissolved_oxygen_params = []; var dissolvedOxygenMap = {}; |
Where properties are being assigned to a params map for each tab add something similar to:
else if (parr[0].id.indexOf('ignored') == -1 && parr[0].get('detailView') === 'dissolved_oxygen') { dissolvedOxygenMap[parr[0].id] = key; dissolved_oxygen_params.push(parr[0].id); } |
Add code to toggle on and off the tab based on if there is at least one parameter for that tab.
if (dissolved_oxygen_params.length > 0) { $("#dissolved-oxygen-tab").toggle(true); } else { $("#dissolved-oxygen-tab").toggle(false); } |
Set the tab title
if (source.get('tabs').dissolvedOxygen) { $('#dissolved-oxygen-tab').find('a').text(source.get('tabs').dissolvedOxygen); } |
Sample Pull request: https://opensource.ncsa.illinois.edu/bitbucket/projects/GEOD/repos/geodashboard/pull-requests/543/overview