diff --git a/swh/web/assets/src/bundles/browse/snapshot-navigation.js b/swh/web/assets/src/bundles/browse/snapshot-navigation.js index c9a931166..8ade39fbd 100644 --- a/swh/web/assets/src/bundles/browse/snapshot-navigation.js +++ b/swh/web/assets/src/bundles/browse/snapshot-navigation.js @@ -1,56 +1,56 @@ /** * Copyright (C) 2018 The Software Heritage developers * See the AUTHORS file at the top-level directory of this distribution * License: GNU Affero General Public License version 3, or any later version * See top-level LICENSE file for more information */ -export function initSnapshotNavigation(snapshotContext) { +export function initSnapshotNavigation(snapshotContext, branch) { function setBranchesTabActive() { $('.swh-releases-switch').removeClass('active'); $('.swh-branches-switch').addClass('active'); $('#swh-tab-releases').removeClass('active'); $('#swh-tab-branches').addClass('active'); } function setReleasesTabActive() { $('.swh-branches-switch').removeClass('active'); $('.swh-releases-switch').addClass('active'); $('#swh-tab-branches').removeClass('active'); $('#swh-tab-releases').addClass('active'); } $(document).ready(() => { $('.dropdown-menu a.swh-branches-switch').click(e => { setBranchesTabActive(); e.stopPropagation(); }); $('.dropdown-menu a.swh-releases-switch').click(e => { setReleasesTabActive(); e.stopPropagation(); }); let dropdownResized = false; // hack to resize the branches/releases dropdown content, // taking icons into account, in order to make the whole names readable $('#swh-branches-releases-dd').on('show.bs.dropdown', () => { if (dropdownResized) return; let dropdownWidth = $('.swh-branches-releases').width(); $('.swh-branches-releases').width(dropdownWidth + 25); dropdownResized = true; }); if (snapshotContext) { - if (snapshotContext.branch) { + if (branch) { setBranchesTabActive(); } else { setReleasesTabActive(); } } }); } diff --git a/swh/web/templates/includes/top-navigation.html b/swh/web/templates/includes/top-navigation.html index c206291ff..1738d142e 100644 --- a/swh/web/templates/includes/top-navigation.html +++ b/swh/web/templates/includes/top-navigation.html @@ -1,94 +1,99 @@ {% comment %} Copyright (C) 2017-2018 The Software Heritage developers See the AUTHORS file at the top-level directory of this distribution License: GNU Affero General Public License version 3, or any later version See top-level LICENSE file for more information {% endcomment %} {% load swh_templatetags %}
{% if snapshot_context %} {% if snapshot_context.branch or snapshot_context.release %} {% endif %} {% endif %}
{% if top_right_link %} {{ top_right_link_text }} {% endif %} {% if show_actions_menu %} {% endif %}
{% include "includes/breadcrumbs.html" %}