Create a new scala template in geodashboard/app/views/detail_view/tabs
Scala Template@()(implicit lang: Lang) <div class="tab-pane" id="dissolved-oxygen-profile"> </div>
- In Geodashboard/app/views/detail.scala.html
Create the tab
Link to the scala template<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
Import the scala template@detail_view.tabs.dissolved_oxygen()
This adds the code from the template to the DOM
- In Geodashboard /src/javascript/views/DetailView.js
Create the following objects:
Initialize variablesvar dissolved_oxygen_params = []; var dissolvedOxygenMap = {};
Where properties are being assigned to a params map for each tab add something similar to:
Fill up the parameters map and params listelse 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.
Toggle on and off the tabif (dissolved_oxygen_params.length > 0) { $("#dissolved-oxygen-tab").toggle(true); } else { $("#dissolved-oxygen-tab").toggle(false); }
Set the tab title
Set the tab valueif (source.get('tabs').dissolvedOxygen) { $('#dissolved-oxygen-tab').find('a').text(source.get('tabs').dissolvedOxygen); }
- Add a Changelog entry
- Define the specifics of the tab on the Seagrant/GLTG/IMLCZO project, so it gets copied over
- Define the functionality for creating the graphs and filling up the tab in 3.c after toggling on the tab.
Sample Pull request: https://opensource.ncsa.illinois.edu/bitbucket/projects/GEOD/repos/geodashboard/pull-requests/543/overview