Skip to content
Snippets Groups Projects
Commit c6e7a78f authored by Antoine Lambert's avatar Antoine Lambert
Browse files

browse/top-navigation: Optimize generated HTML size

parent 9e492c52
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
* See top-level LICENSE file for more information
*/
export function initSnapshotNavigation(snapshotContext) {
export function initSnapshotNavigation(snapshotContext, branch) {
function setBranchesTabActive() {
$('.swh-releases-switch').removeClass('active');
......@@ -44,7 +44,7 @@ export function initSnapshotNavigation(snapshotContext) {
});
if (snapshotContext) {
if (snapshotContext.branch) {
if (branch) {
setBranchesTabActive();
} else {
setReleasesTabActive();
......
......@@ -89,6 +89,11 @@ See top-level LICENSE file for more information
</div>
<script>
var snapshotContext = {{ snapshot_context|jsonify }};
swh.browse.initSnapshotNavigation(snapshotContext);
var snapshotContext = false;
var branch = false;
{% if snapshot_context %}
snapshotContext = true;
branch = {{ snapshot_context.branch|jsonify }};
{% endif %}
swh.browse.initSnapshotNavigation(snapshotContext, branch);
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment