Skip to content
Snippets Groups Projects
Commit 07c3def0 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Manual merge of Pull Request #277 with an additional check for a null response.

parent 5811442c
No related merge requests found
...@@ -151,10 +151,9 @@ function registerTabEvents() { ...@@ -151,10 +151,9 @@ function registerTabEvents() {
function ajaxLoadTab(tabid) { function ajaxLoadTab(tabid) {
var id = $('.hiddenId')[0].value; var id = $('.hiddenId')[0].value;
// Grab the part of the url that is the Controller and Record ID // Grab the part of the url that is the Controller and Record ID
var urlroot = document.URL.match(new RegExp('/[^/]+/'+id+'(/|\\b)')); var urlroot = document.URL.match(new RegExp('/[^/]+/'+id)) + "/";
urlroot = urlroot.slice(-1); if(urlroot == "null/") {
if(urlroot.substring(-1) != '/') { return true;
urlroot += '/';
} }
$.ajax({ $.ajax({
url: path + urlroot + 'AjaxTab', url: path + urlroot + 'AjaxTab',
...@@ -170,6 +169,7 @@ function ajaxLoadTab(tabid) { ...@@ -170,6 +169,7 @@ function ajaxLoadTab(tabid) {
} }
} }
}); });
return false;
} }
$(document).ready(function(){ $(document).ready(function(){
...@@ -178,21 +178,20 @@ $(document).ready(function(){ ...@@ -178,21 +178,20 @@ $(document).ready(function(){
$('ul.recordTabs a').click(function (e) { $('ul.recordTabs a').click(function (e) {
if($(this).parents('li.active').length > 0) { if($(this).parents('li.active').length > 0) {
window.location.href = $(this).attr('href'); return true;
return;
} }
var tabid = $(this).attr('id').toLowerCase(); var tabid = $(this).attr('id').toLowerCase();
if($('#'+tabid+'-tab').length > 0) { if($('#'+tabid+'-tab').length > 0) {
$('#record-tabs .tab-pane.active').removeClass('active'); $('#record-tabs .tab-pane.active').removeClass('active');
$('#'+tabid+'-tab').addClass('active'); $('#'+tabid+'-tab').addClass('active');
$('#'+tabid).tab('show'); $('#'+tabid).tab('show');
return false;
} else { } else {
$('#record-tabs').append('<div class="tab-pane" id="'+tabid+'-tab"><i class="fa fa-spinner fa-spin"></i> '+vufindString.loading+'...</div>'); $('#record-tabs').append('<div class="tab-pane" id="'+tabid+'-tab"><i class="fa fa-spinner fa-spin"></i> '+vufindString.loading+'...</div>');
$('#record-tabs .tab-pane.active').removeClass('active'); $('#record-tabs .tab-pane.active').removeClass('active');
$('#'+tabid+'-tab').addClass('active'); $('#'+tabid+'-tab').addClass('active');
ajaxLoadTab(tabid); return ajaxLoadTab(tabid);
} }
return false;
}); });
/* --- LIGHTBOX --- */ /* --- LIGHTBOX --- */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment