Index: lams_learning/web/includes/javascript/learnerPage.js =================================================================== diff -u -r68f0d8c20848cfdce8fe3d16b7631d48dfa8c4a0 -r1a4b15de76d371c44eb4c84eb971862eac5fca66 --- lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision 68f0d8c20848cfdce8fe3d16b7631d48dfa8c4a0) +++ lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision 1a4b15de76d371c44eb4c84eb971862eac5fca66) @@ -16,68 +16,74 @@ const ACTIVITY_ITEM_TEMPLATE = '
  • '; if (result.support) { let supportBarItems = $('.component-page-wrapper .offcanvas #offcanvas-support-bar') - .removeClass('d-none') + .removeClass('d-none') .find('#support-bar-items') .empty(); $.each(result.support, function (activityIndex, activityData) { let activityItem = $(ACTIVITY_ITEM_TEMPLATE) - .addClass('list-group-item list-group-item-action progress-bar-item-openable').appendTo(supportBarItems), + .addClass('list-group-item list-group-item-action progress-bar-item-openable').appendTo(supportBarItems), activityIcon = $('').attr({ - 'class': 'fa-solid fa-fw fa-lg fa-up-right-from-square progress-bar-icon', - 'title': LABEL_SUPPORT_ACTIVITY - }), - activityLink = $('').text(activityData.name).attr({ - 'target': '_blank', - 'href': activityData.url, - 'role': 'menuitem', - 'title': LABEL_CLICK_TO_OPEN - }); - $(".icon", activityItem).prepend(activityIcon); - $(".col", activityItem).append(activityLink); + 'class': 'fa-solid fa-fw fa-lg fa-up-right-from-square progress-bar-icon', + 'title': LABEL_SUPPORT_ACTIVITY + }), + activityLink = $('').text(activityData.name).attr({ + 'target': '_blank', + 'href': activityData.url, + 'role': 'menuitem', + 'title': LABEL_CLICK_TO_OPEN + }); + $(".icon", activityItem).prepend(activityIcon); + $(".col", activityItem).append(activityLink); }); } let progressBarItems = $('.component-page-wrapper .offcanvas #progress-bar-items').empty(), completedActivityCount = 0; $.each(result.activities, function (activityIndex, activityData) { let activityItem = $(ACTIVITY_ITEM_TEMPLATE) - .addClass('list-group-item list-group-item-action') - .appendTo(progressBarItems), + .addClass('list-group-item list-group-item-action') + .appendTo(progressBarItems), activityName = !activityData.name && activityData.type === 'g' ? 'Gate' : activityData.name, activityIcon = $(''); - $(".icon", activityItem).prepend(activityIcon); + $(".icon", activityItem).prepend(activityIcon); - //current + //current if (activityData.status === 0) { - activityItem.addClass('active'); - $(".col", activityItem).text(activityName); - activityIcon.addClass('fa-regular fa-pen-to-square') - .attr('title', LABEL_CURRENT_ACTIVITY); - - //completed - } else if (activityData.status === 1) { - completedActivityCount++; + activityItem.addClass('active'); + $(".col", activityItem).text(activityName); + activityIcon.addClass('fa-regular fa-pen-to-square') + .attr('title', LABEL_CURRENT_ACTIVITY); - activityItem.addClass('progress-bar-item-complete'); - activityIcon.addClass('fa-solid fa-square-check') - .attr('title', LABEL_COMPLETED_ACTIVITY); + } else { + let target = '_blank'; + + //completed + if (activityData.status === 1) { + completedActivityCount++; + + activityItem.addClass('progress-bar-item-complete'); + activityIcon.addClass('fa-solid fa-square-check') + .attr('title', LABEL_COMPLETED_ACTIVITY); + } else { + target = '_self'; + //not yet finished + activityItem.addClass('progress-bar-item-incomplete'); + activityIcon.addClass('fa-regular fa-square') + .attr('title', LABEL_NOT_STARTED_ACTIVITY); + } + if (activityData.url) { let activityLink = $('').text(activityName).attr({ - 'target': '_blank', + 'target': target, 'href': activityData.url, 'role': 'menuitem', 'title': LABEL_CLICK_TO_OPEN }); activityItem.addClass('progress-bar-item-openable'); $(".col", activityItem).append(activityLink); + } else { + $(".col", activityItem).text(activityName); } - - //not yet finished - } else { - activityItem.addClass('progress-bar-item-incomplete'); - $(".col", activityItem).text(activityName); - activityIcon.addClass('fa-regular fa-square') - .attr('title', LABEL_NOT_STARTED_ACTIVITY); } }); @@ -88,7 +94,6 @@ .attr('aria-valuenow', progressBarWidgetValue); $('#progress-bar-widget-value').text(progressBarWidgetValue + '%'); - initCommandWebsocket(result.lessonID); } }); @@ -152,7 +157,7 @@ progressBar = $('.component-page-wrapper .offcanvas'), topToggleButton = $('header #hamb', pageContent), isExpanded = forceClose || topToggleButton.attr('aria-expanded') == 'true'; - + topToggleButton.attr('aria-expanded', !isExpanded) .children('i').toggleClass(topToggleButton.data('closed-class')).toggleClass(topToggleButton.data('opened-class')); progressBar.toggleClass('active').attr('aria-expanded', !isExpanded);