diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index 73e64b1bbbbc43aa4216e915524d1e062a7eec63..fb0ab767abb6c8dee099e1a033047c363cea3bc9 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -151,18 +151,13 @@ function ajaxLoadTab($newTab, tabid, setHash) { var urlroot = '/' + chunks[0] + '/' + chunks[1]; } - $('#record-tabs .tab-pane.active').removeClass('active'); - $('.'+tabid+'-tab').addClass('active'); - $('.'+tabid).tab('show'); - // Request the tab via AJAX: $.ajax({ url: path + urlroot + '/AjaxTab', type: 'POST', data: {tab: tabid}, success: function(data) { - $newTab.html(data).addClass('active'); - $newTab.closest('.record-tabs').find('.'+tabid).tab('show'); + $newTab.html(data); registerTabEvents(); if(typeof syn_get_widget === "function") { syn_get_widget(); @@ -238,7 +233,7 @@ function applyRecordTabHash() { if (newTab.length == 0 || newTab == '#tabnav') { $initiallyActiveTab.click(); } else if (newTab.length > 0 && '#' + activeTab != newTab) { - $(newTab).click(); + $('.'+newTab.substr(1)).click(); } } @@ -286,9 +281,9 @@ function recordDocReady() { var tabid = this.className; var $top = $(this).closest('.record-tabs'); $top.find('.tab-pane.active').removeClass('active'); + $(this).tab('show'); if ($top.find('.'+tabid+'-tab').length > 0) { $top.find('.'+tabid+'-tab').addClass('active'); - $(this).tab('show'); window.location.hash = tabid; return false; } else { @@ -298,10 +293,9 @@ function recordDocReady() { } var newTab = $('<div class="tab-pane active '+tabid+'-tab"><i class="fa fa-spinner fa-spin"></i> '+VuFind.translate('loading')+'...</div>'); $top.find('.tab-content').append(newTab); - return ajaxLoadTab(newTab, tabid); + return ajaxLoadTab(newTab, tabid, !$(this).parent().hasClass('initiallyActive')); } }); - $('.initiallyActive a').click(); applyRecordTabHash(); /* --- LIGHTBOX --- */ diff --git a/themes/bootstrap3/templates/collection/view.phtml b/themes/bootstrap3/templates/collection/view.phtml index b84d64f33de3b6cd145205503d57afbdfdb80086..8f9e9047502d3e643c4bb1171f338f1322da33f1 100644 --- a/themes/bootstrap3/templates/collection/view.phtml +++ b/themes/bootstrap3/templates/collection/view.phtml @@ -78,10 +78,12 @@ <? endif; ?> - <div class="collectionDetails<?=$tree ? 'Tree' : ''?> tab-content" id="record-tabs"> - <div class="tab-pane active" id="<?=$this->activeTab ?>-tab"> - <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> - </div> + <div class="tab-content record-tabs collectionDetails<?=$tree ? 'Tree' : ''?>"> + <? if (!$this->ajaxTabs || !isset($activeTabObj) || !$activeTabObj->supportsAjax()): ?> + <div class="tab-pane active <?=$this->activeTab ?>-tab"> + <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> + </div> + <? endif ?> </div> <?=$this->driver->supportsCoinsOpenURL()?'<span class="Z3988" title="'.$this->escapeHtmlAttr($this->driver->getCoinsOpenURL()).'"></span>':''?> diff --git a/themes/bootstrap3/templates/record/view.phtml b/themes/bootstrap3/templates/record/view.phtml index 0b6f84b25c412a8dedaea75e1e1609c5c8b13f46..934cfb6fb6817cae6852dc590218c28cb3feb13b 100644 --- a/themes/bootstrap3/templates/record/view.phtml +++ b/themes/bootstrap3/templates/record/view.phtml @@ -74,9 +74,9 @@ <? endforeach; ?> </ul> - <div class="tab-content" id="record-tabs"> + <div class="tab-content record-tabs"> <? if (!$this->ajaxTabs || !isset($activeTabObj) || !$activeTabObj->supportsAjax()): ?> - <div class="tab-pane active" id="<?=$this->activeTab ?>-tab"> + <div class="tab-pane active <?=$this->activeTab ?>-tab"> <?=isset($activeTabObj) ? $this->record($this->driver)->getTab($activeTabObj) : '' ?> </div> <? endif; ?>