diff --git a/lti_consumer/static/js/xblock_lti_consumer.js b/lti_consumer/static/js/xblock_lti_consumer.js index bebdb129283807f7009b7e83b8511f3b3f565795..9991c4f6649cdd98300c203b10cb95e16e6e10aa 100644 --- a/lti_consumer/static/js/xblock_lti_consumer.js +++ b/lti_consumer/static/js/xblock_lti_consumer.js @@ -105,6 +105,7 @@ function LtiConsumerXBlock(runtime, element) { // If this instance is configured to require username and/or email, ask user if it is okay to send them // Do not launch if it is not okay + var destination = $(this).data('target') function confirmDialog(message) { var def = $.Deferred(); @@ -118,14 +119,14 @@ function LtiConsumerXBlock(runtime, element) { width: 'auto', resizable: false, buttons: { - Yes: function() { + OK: function() { $('body').append('<h1>Confirm Dialog Result: <i>Yes</i></h1>'); def.resolve("OK"); $(this).dialog("close"); }, - No: function() { + Cancel: function() { $('body').append('<h1>Confirm Dialog Result: <i>No</i></h1>'); - def.resolve("No"); + def.resolve("Cancel"); $(this).dialog("close"); } }, @@ -137,20 +138,18 @@ function LtiConsumerXBlock(runtime, element) { return def.promise(); }; - if(askToSendUsername && askToSendEmail) { msg = gettext("Click OK to have your username and e-mail address sent to a 3rd party application.\n\nClick Cancel to return to this page without sending your information."); } else if (askToSendUsername) { msg = gettext("Click OK to have your username sent to a 3rd party application.\n\nClick Cancel to return to this page without sending your information."); } else if (askToSendEmail) { msg = gettext("Click OK to have your e-mail address sent to a 3rd party application.\n\nClick Cancel to return to this page without sending your information."); + } else { + window.open(destination); } - - var destination = $(this).data('target') - $.when(confirmDialog(msg)).then( function(status) { - if (status == "Ok") { + if (status == "OK") { window.open(destination); } }