Index: lams_central/web/includes/javascript/main.js =================================================================== diff -u -r81a68a722a832bb9c94d9a73e66d27ad0c3d48bb -rf9b834818dc5ef33a5534001481b70975ea7d529 --- lams_central/web/includes/javascript/main.js (.../main.js) (revision 81a68a722a832bb9c94d9a73e66d27ad0c3d48bb) +++ lams_central/web/includes/javascript/main.js (.../main.js) (revision f9b834818dc5ef33a5534001481b70975ea7d529) @@ -55,7 +55,7 @@ rows += ''; rows += orgData["name"]; if (activeOrgId == orgId) { - rows += ''; + rows += ''; } rows += ''; rows += ''; @@ -134,7 +134,7 @@ //add active CSS class $("#org-row-" + newOrgId + ", #favorite-li-" + newOrgId + " a").addClass("active"); - $("#org-row-" + newOrgId + " a").append( "" ) + $("#org-row-" + newOrgId + " a").append( "" ) activeOrgId = newOrgId; loadOrganisation(); @@ -150,35 +150,34 @@ function loadOrganisation() { - //display loading animation - $("#page-wrapper>footer").hide(); - $("#org-container").html('
'); - - $("#org-container").load( - "displayGroup.do", - { - orgId : activeOrgId - }, - function( response, status, xhr ) { - //in case of any server error - open offcanvas bar so user can select another course - if ( status == "error" ) { - $("body").removeClass("offcanvas-hidden"); - return; + $("#page-wrapper").finish().fadeOut(200, function() { + $("#org-container").load( + "displayGroup.do", + { + orgId : activeOrgId + }, + function( response, status, xhr ) { + //in case of any server error - open offcanvas bar so user can select another course + if ( status == "error" ) { + $("body").removeClass("offcanvas-hidden"); + return; + } + + initDataTables(); + + // if screen is smaller than 768px (i.e. offcanvas occupies 100%) and offcanvas is shown - then hide it on user selecting an organisation + if (window.matchMedia('(max-width: 768px)').matches && !$("body").hasClass("offcanvas-hidden")) { + //do it with a small delay so it will be understood that the new organisation is selected indeed + $("body").addClass('offcanvas-hidden', 300); + } + + //in case there is no lessons-table, show page back (instead of doing it in datatables init event) + if ($('.lessons-table').length == 0) { + $("#page-wrapper").finish().fadeTo(400, 1); + } } - - //display footer back - $("#page-wrapper>footer").show(); - - initDataTables(); - - // if screen is smaller than 768px (i.e. offcanvas occupies 100%) and offcanvas is shown - then hide it on user selecting an organisation - if (window.matchMedia('(max-width: 768px)').matches && !$("body").hasClass("offcanvas-hidden")) { - //do it with a small delay so it will be understood that the new organisation is selected indeed - $("body").addClass('offcanvas-hidden', 300); - } - - } - ); + ); + }); }