From 18c3bb5e4884285e19efcf0110a720f3935844b9 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Mon, 26 Oct 2015 14:21:59 -0400 Subject: [PATCH] More fixes to browser history with AJAX tabs. --- themes/bootstrap3/js/record.js | 5 ++++- themes/bootstrap3/templates/record/view.phtml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index da0012ab704..33ead173892 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -226,11 +226,14 @@ function ajaxTagUpdate(tag, remove) { function applyRecordTabHash() { var activeTab = $('ul.recordTabs li.active a').attr('id'); + var initiallyActiveTab = $('ul.recordTabs li.initiallyActive a').attr('id'); var newTab = typeof window.location.hash !== 'undefined' ? window.location.hash.toLowerCase() : ''; // Open tag in url hash - if (newTab.length > 0 && '#' + activeTab != newTab) { + if (newTab.length == 0 || newTab == '#tabnav') { + $('#' + initiallyActiveTab).click(); + } else if (newTab.length > 0 && '#' + activeTab != newTab) { $(newTab).click(); } } diff --git a/themes/bootstrap3/templates/record/view.phtml b/themes/bootstrap3/templates/record/view.phtml index 7ab2b836658..487dc44a715 100644 --- a/themes/bootstrap3/templates/record/view.phtml +++ b/themes/bootstrap3/templates/record/view.phtml @@ -58,6 +58,7 @@ $tab_classes = array(); if (0 === strcasecmp($this->activeTab, $tab)) { $tab_classes[] = 'active'; + $tab_classes[] = 'initiallyActive'; $this->layout()->breadcrumbs .= '<li class="active">' . $this->transEsc($desc) . '</li>'; $activeTabObj = $obj; } -- GitLab