fixed bug that disabled tabs when navigating from the home page map while not logged in

This commit is contained in:
tworrall 2013-08-23 17:06:33 -04:00
parent dfa1abd2ec
commit fe7106e22b

View file

@ -69,22 +69,25 @@ $(document).ready(function(){
location.hash = location.hash.replace(/\s+/g, ''); location.hash = location.hash.replace(/\s+/g, '');
if ( location.hash.indexOf("map") >= 0 ) { if ( location.hash.indexOf("map") >= 0 ) {
// get the name of the group that contains the geographicFocusOf property. // get the name of the group that contains the geographicFocusOf property.
var tabName = $('h3#geographicFocusOf').parent('article').parent('div').attr("id"); // if it doesn't exist, don't do anything.
tabName = tabName.replace("Group",""); if ( $('h3#geographicFocusOf').length ) {
tabNameCapped = tabName.charAt(0).toUpperCase() + tabName.slice(1); var tabName = $('h3#geographicFocusOf').parent('article').parent('div').attr("id");
// if the name of the first tab section = tabName we don't have to do anything; tabName = tabName.replace("Group","");
// otherwise, select the correct tab and deselect the first one tabNameCapped = tabName.charAt(0).toUpperCase() + tabName.slice(1);
var $firstTab = $('li.clickable').first(); // if the name of the first tab section = tabName we don't have to do anything;
if ( $firstTab.text() != tabNameCapped ) { // otherwise, select the correct tab and deselect the first one
// select the correct tab var $firstTab = $('li.clickable').first();
$('li[groupName="' + tabName + '"]').removeClass("nonSelectedGroupTab clickable"); if ( $firstTab.text() != tabNameCapped ) {
$('li[groupName="' + tabName + '"]').addClass("selectedGroupTab clickable"); // select the correct tab
// deselect the first tab $('li[groupName="' + tabName + '"]').removeClass("nonSelectedGroupTab clickable");
$firstTab.removeClass("selectedGroupTab clickable"); $('li[groupName="' + tabName + '"]').addClass("selectedGroupTab clickable");
$firstTab.addClass("nonSelectedGroupTab clickable"); // deselect the first tab
$('section.property-group:visible').hide(); $firstTab.removeClass("selectedGroupTab clickable");
// show the selected tab section $firstTab.addClass("nonSelectedGroupTab clickable");
$('section#' + tabName).show(); $('section.property-group:visible').hide();
// show the selected tab section
$('section#' + tabName).show();
}
} }
// if there is a more link, "click" more to show all the researchers // if there is a more link, "click" more to show all the researchers
// we need the timeout delay so that the more link can get rendered // we need the timeout delay so that the more link can get rendered