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() {
function ajaxLoadTab(tabid) {
var id = $('.hiddenId')[0].value;
// Grab the part of the url that is the Controller and Record ID
var urlroot = document.URL.match(new RegExp('/[^/]+/'+id+'(/|\\b)'));
urlroot = urlroot.slice(-1);
if(urlroot.substring(-1) != '/') {
urlroot += '/';
var urlroot = document.URL.match(new RegExp('/[^/]+/'+id)) + "/";
if(urlroot == "null/") {
return true;
}
$.ajax({
url: path + urlroot + 'AjaxTab',
......@@ -170,6 +169,7 @@ function ajaxLoadTab(tabid) {
}
}
});
return false;
}
$(document).ready(function(){
......@@ -178,21 +178,20 @@ $(document).ready(function(){
$('ul.recordTabs a').click(function (e) {
if($(this).parents('li.active').length > 0) {
window.location.href = $(this).attr('href');
return;
return true;
}
var tabid = $(this).attr('id').toLowerCase();
if($('#'+tabid+'-tab').length > 0) {
$('#record-tabs .tab-pane.active').removeClass('active');
$('#'+tabid+'-tab').addClass('active');
$('#'+tabid).tab('show');
return false;
} else {
$('#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');
$('#'+tabid+'-tab').addClass('active');
ajaxLoadTab(tabid);
return ajaxLoadTab(tabid);
}
return false;
});
/* --- 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