Index: lams_learning/web/includes/javascript/learnerPage.js
===================================================================
diff -u -re820169ce662888b003dbe47ef24a48cf19d124c -rb61438aa2b38fbabbc39cceb7f6b45973a682557
--- lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision e820169ce662888b003dbe47ef24a48cf19d124c)
+++ lams_learning/web/includes/javascript/learnerPage.js (.../learnerPage.js) (revision b61438aa2b38fbabbc39cceb7f6b45973a682557)
@@ -1,4 +1,3 @@
-
// refresh progress bar on first/next activity load
function initLearnerPage(toolSessionId, userId) {
$('.component-page-wrapper .sidebar-toggle-button').click(function () {
@@ -10,40 +9,72 @@
});
$.ajax({
- url : LAMS_URL + 'learning/learner/getLearnerProgress.do',
- data : {
- 'toolSessionID' : toolSessionId,
- 'userID' : userId
+ url: LAMS_URL + 'learning/learner/getLearnerProgress.do',
+ data: {
+ 'toolSessionID': toolSessionId,
+ 'userID': userId
},
- cache : false,
- dataType : 'json',
- success : function(result){
+ cache: false,
+ dataType: 'json',
+ success: function (result) {
$('.component-page-wrapper .component-page-content #lesson-name').text(result.lessonName);
+
+ // draw support activities if they exist
+ if (result.support) {
+ let supportBarItems = $('.component-page-wrapper .component-sidebar #support-bar').removeClass('d-none')
+ .find('#support-bar-items').empty();
+ $.each(result.support, function (activityIndex, activityData) {
+ let activityItem = $('
').attr('role', 'navigation menubaritem')
+ .addClass('support-bar-item progress-bar-item-openable')
+ .prepend('').appendTo(supportBarItems);
+ let activityLink = $('').text(activityData.name).attr({
+ 'target': '_blank',
+ 'href': activityData.url,
+ 'role': 'navigation',
+ 'title': 'Open completed activty "' + activityData.url + '"'
+ });
+ activityItem.addClass('progress-bar-item-openable').append(activityLink);
+ });
+ }
+
let progressBarItems = $('.component-page-wrapper .component-sidebar #progress-bar-items').empty();
+ $.each(result.activities, function (activityIndex, activityData) {
+ let activityItem = $('').attr('role', 'navigation menubaritem').appendTo(progressBarItems),
+ activityName = !activityData.name && activityData.type === 'g' ? 'Gate' : activityData.name,
+ activityIcon = $('');
- for (var activityIndex = 0; activityIndex < result.activities.length; activityIndex++) {
- let activityData = result.activities[activityIndex],
- activityItem = $('').attr('role', 'navigation menubaritem').appendTo(progressBarItems);
if (activityData.status === 0) {
- activityItem.addClass('progress-bar-item-current').text(activityData.name)
- .prepend('');
+ activityItem.addClass('progress-bar-item-current').text(activityName).prepend(activityIcon);
+ if (activityData.type === 'g') {
+ activityIcon.addClass('fa-hourglass-half');
+ } else {
+ activityIcon.addClass('fa-circle');
+ }
} else if (activityData.status === 1) {
- activityItem.addClass('progress-bar-item-complete')
- .prepend('')
+ activityItem.addClass('progress-bar-item-complete').prepend(activityIcon);
+ if (activityData.type === 'g') {
+ activityIcon.addClass('fa-hourglass-full');
+ } else {
+ activityIcon.addClass('fa-check');
+ }
if (activityData.url) {
- let activityLink = $('').text(activityData.name).attr({
- 'target' : '_blank',
- 'href' : activityData.url,
- 'role' : 'navigation',
- 'title' : 'Open completed activty "' + activityData.url + '"'
+ let activityLink = $('').text(activityName).attr({
+ 'target': '_blank',
+ 'href': activityData.url,
+ 'role': 'navigation',
+ 'title': 'Open completed activty "' + activityData.url + '"'
});
activityItem.addClass('progress-bar-item-openable').append(activityLink);
}
} else {
- activityItem.addClass('progress-bar-item-incomplete').text(activityData.name)
- .prepend('');
+ activityItem.addClass('progress-bar-item-incomplete').text(activityName).prepend(activityIcon);
+ if (activityData.type === 'g') {
+ activityIcon.addClass('fa-hourglass-start');
+ } else {
+ activityIcon.addClass('fa-circle');
+ }
}
- }
+ });
}
});
}
\ No newline at end of file