Skip to content
Snippets Groups Projects
Unverified Commit f0785c51 authored by Dave St.Germain's avatar Dave St.Germain Committed by GitHub
Browse files

Merge pull request #97 from edx/dcs/modal-popup

Send modal to parent window.
parents 846ccba6 b6676085
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,24 @@ function LtiConsumerXBlock(runtime, element) { ...@@ -17,6 +17,24 @@ function LtiConsumerXBlock(runtime, element) {
var o = options; var o = options;
$(this).click(function (e) { $(this).click(function (e) {
var $modal = $(modal_id); var $modal = $(modal_id);
// If we are already in an iframe, skip creation of the modal, since
// it won't look good, anyway. Instead, we post a message to the parent
// window, requesting creation of a modal there.
// This is used by the courseware microfrontend.
if (window !== window.parent) {
window.parent.postMessage(
{
'type': 'plugin.modal',
'payload': {
'url': window.location.origin + $modal.data('launch-url'),
'title': $modal.find('iframe').attr('title'),
'width': $modal.data('width')
}
},
document.referrer
);
return;
}
// Set iframe src attribute to launch LTI provider // Set iframe src attribute to launch LTI provider
$modal.find('iframe').attr('src', $modal.data('launch-url')); $modal.find('iframe').attr('src', $modal.data('launch-url'));
$("#" + overlay_id).click(function () { $("#" + overlay_id).click(function () {
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
aria-hidden="true" aria-hidden="true"
style="width:${modal_width}%; left:${modal_horizontal_offset}%; top:${modal_vertical_offset}%; bottom:${modal_vertical_offset}%;" style="width:${modal_width}%; left:${modal_horizontal_offset}%; top:${modal_vertical_offset}%; bottom:${modal_vertical_offset}%;"
data-launch-url="${form_url}" data-launch-url="${form_url}"
data-width="${modal_width}%"
> >
<div class="inner-wrapper" role="dialog"> <div class="inner-wrapper" role="dialog">
<button class="close-modal"> <button class="close-modal">
......
...@@ -49,7 +49,7 @@ with open('README.rst') as _f: ...@@ -49,7 +49,7 @@ with open('README.rst') as _f:
setup( setup(
name='lti-consumer-xblock', name='lti-consumer-xblock',
version='2.1.2', version='2.2',
description='This XBlock implements the consumer side of the LTI specification.', description='This XBlock implements the consumer side of the LTI specification.',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment