Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/lib/xmodule/xmodule/js/src/sequence/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@
}
});
}
// Reload progress bar
this.$('#progress-frame').attr('src', this.$('#progress-frame').attr('src'));
Comment thread
gabor-boros marked this conversation as resolved.
};

Sequence.prototype.mark_active = function(position) {
Expand Down
4 changes: 4 additions & 0 deletions common/lib/xmodule/xmodule/seq_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from functools import reduce

import six
from django.conf import settings
from django.contrib.auth.models import User
from lxml import etree
from opaque_keys.edx.keys import UsageKey
Expand Down Expand Up @@ -493,6 +494,9 @@ def _student_or_public_view(self, context, prereq_met, prereq_meta_info, banner_

fragment = Fragment()
params = self._get_render_metadata(context, display_items, prereq_met, prereq_meta_info, banner_text, view, fragment)
if settings.FEATURES.get('SHOW_PROGRESS_BAR', False) and getattr(settings, 'COMPLETION_AGGREGATOR_URL', ''):
parent_block_id = self.get_parent().scope_ids.usage_id.block_id
params['chapter_completion_aggregator_url'] = '/'.join([settings.COMPLETION_AGGREGATOR_URL, str(self.course_id), parent_block_id]) + '/'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkulkark this will raise an attribute error if COMPLETION_AGGREGATOR_URL is not set. Also, the setting has no default value and not documented.

@pkulkark pkulkark Oct 27, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! Good catch. Fixed it. Also added it in the testing instructions.

fragment.add_content(self.system.render_template("seq_module.html", params))

self._capture_full_seq_item_metrics(display_items)
Expand Down
8 changes: 8 additions & 0 deletions lms/templates/courseware/courseware.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
settings.FEATURES.get('ENABLE_SPECIAL_EXAMS', False) and
(course.enable_proctored_exams or course.enable_timed_exams)
)

completion_aggregator_url = settings.COMPLETION_AGGREGATOR_URL if settings.FEATURES.get("SHOW_PROGRESS_BAR", False) else ""
%>

% if display_reset_dates_banner:
Expand Down Expand Up @@ -197,6 +199,12 @@
% endif
<span class="nav-item nav-item-sequence">${sequence_title}</span>
</div>
% if settings.FEATURES.get("SHOW_PROGRESS_BAR", False):
<div class="container">
<iframe style="border: none; height: 50px; position: relative; top: 10px; width: -webkit-fill-available" src="${completion_aggregator_url}/${course.id}/">
</iframe>
</div>
% endif
</div>
</nav>
</div>
Expand Down
10 changes: 9 additions & 1 deletion lms/templates/seq_module.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<%page expression_filter="h"/>
<%! from django.utils.translation import pgettext, ugettext as _ %>
<%!
from django.utils.translation import pgettext, ugettext as _
from django.conf import settings
%>

<div id="sequence_${element_id}" class="sequence" data-id="${item_id}"
data-position="${position}" data-ajax-url="${ajax_url}"
Expand Down Expand Up @@ -110,6 +113,11 @@ <h2 class="hd hd-2 unit-title">
${gated_sequence_fragment | n, decode.utf8}
% else:
<div class="sr-is-focusable" tabindex="-1"></div>
% if settings.FEATURES.get("SHOW_PROGRESS_BAR", False):
<div class="progress-container">
<iframe id="progress-frame" style="border: none; width: 100%; height: 70px;" src="${chapter_completion_aggregator_url}"></iframe>
</div>
% endif

% for idx, item in enumerate(items):
<div id="seq_contents_${idx}"
Expand Down