-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added Multi AUs support for iframe #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Talha-Rizwan I have few suggestions.
@@ -11,6 +11,8 @@ <h3 class="xblock-title mb-2">{{title}}</h3> | |||
height="{% if cmi5_xblock.height %}{{ cmi5_xblock.height }}{% else %}450{% endif %}" | |||
> | |||
</iframe> | |||
<button id="nextButton">Next Assessment</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of buttons we should show list of hyperlinks each representing an AU. Clicking on the relevant link should open AU in currentWindow or ownWindow. Let me try to explain possible scenarios
-
Single AU and launchMethod is "AnyWindow"
We can use iframe as it is being used currently insideopenedx_cmi5_xblock.html
and src should be url of AU -
Single AU and launchMethod is "OwnWindow"
openedx_cmi5_xblock.html
file should have a single link with titleLaunch AU
and click on that should open new window having url of AU with launch params -
Multiple AU and launchMethod is "AnyWindow"
openedx_cmi5_xblock.html
file should a navigation menu on left side and iframe on right side. Navigation should have list of all AUs. Clicking on any AU should open its in iframe on the right side -
Multiple AU and launchMethod is "OwnWindow"
openedx_cmi5_xblock.html
file should just have a navigation menu having list of all AUs. Click on any AU link should open it up in a new browser window with launch params
@@ -260,6 +284,22 @@ def studio_submit(self, request, _suffix): | |||
response['errors'].append(e.args[0]) | |||
return json_response(response) | |||
|
|||
def launch_au_url(self, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of the code in this function is copy of code used in index_page_url
property we should make a new method e.g make_launch_url
and move common code inside that method to reuse it at both places.
if au_url is not None: | ||
self.index_page_path = au_url.text | ||
au_urls = root.findall('.//{prefix}au/{prefix}url'.format(prefix=prefix)) | ||
if au_urls is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : if au_urls
should be sufficient here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{% if index_page_url %} | ||
<h5 class="xblock-title mb-2">Available Assignables:</h5> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark string for translations using trans
<ol> | ||
{% for au_url in cmi5_xblock.au_urls %} | ||
<li> | ||
<a href="{{ au_url.url }}" target="_blank">AU No. {{ forloop.counter }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mark string for translations using trans
@ziafazal the issue of xapi statements tracking for multiple AUs is resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
function updateIframeSrc(href, liText) { | ||
if(liText.includes('AnyWindow')){ | ||
$('.cmi5-embedded').attr('src', href); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation needed here
7f0e5cd
to
37a7db5
Compare
Added support for cmi5 content having multiple AUs.
AUs with different launch methods ('OwnWindow', 'AnyWindow') are displayed differently.
Merge checklist:
Check off if complete or not applicable: