From 8790171dbba6ee50a159426f93db6f83347e46c8 Mon Sep 17 00:00:00 2001 From: connorhaugh <chaugh21@amherst.edu> Date: Mon, 15 Nov 2021 09:38:48 -0500 Subject: [PATCH] fix: navigate with no usr/pwd --- lti_consumer/static/js/xblock_lti_consumer.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lti_consumer/static/js/xblock_lti_consumer.js b/lti_consumer/static/js/xblock_lti_consumer.js index bebdb12..9991c4f 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); } } -- GitLab