From 3653bb6f98e862a66699177326e4b9b02cf830c2 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 20 Sep 2016 13:42:12 -0400
Subject: [PATCH] Fixed noajax handling for embedded records. (#800)

---
 themes/bootstrap3/js/embedded_record.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/themes/bootstrap3/js/embedded_record.js b/themes/bootstrap3/js/embedded_record.js
index 0d4eeb028eb..e4543804e8b 100644
--- a/themes/bootstrap3/js/embedded_record.js
+++ b/themes/bootstrap3/js/embedded_record.js
@@ -38,8 +38,14 @@ VuFind.register('embedded', function embedded() {
     var id = $result.find('.hiddenId')[0].value;
     var source = $result.find('.hiddenSource')[0].value;
     if ($tab.parent().hasClass('noajax')) {
-      window.location.href = $tab.attr('href');
-      return true;
+      if ($tab.is('a')) {
+        // tab case:
+        window.location.href = $tab.attr('href');
+      } else {
+        // accordion case:
+        window.location.href = $tab.find('a').attr('data-href');
+      }
+      return false;
     }
     var urlroot;
     if (source === VuFind.defaultSearchBackend) {
@@ -144,12 +150,11 @@ VuFind.register('embedded', function embedded() {
               }
               // Bind tab clicks
               longNode.find('.list-tab-toggle').click(function embeddedTabLoad() {
-                addToStorage(divID, this.id);
+                if (!$(this).parent().hasClass('noajax')) {
+                  addToStorage(divID, this.id);
+                }
                 return ajaxLoadTab(this.id);
               });
-              longNode.find('.noajax .list-tab-toggle').click(function accordionNoAjax() {
-                window.location.href = $(this).attr('data-href');
-              });
               longNode.find('[id^=usercomment]').find('input[type=submit]').unbind('click').click(
                 function embeddedComments() {
                   return registerAjaxCommentRecord(
-- 
GitLab