-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
243 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,23 @@ | ||
/* JavaScript for LTIBlock. */ | ||
// /* JavaScript for LTIBlock. */ | ||
|
||
(function() { | ||
function LTIBlock(element) { | ||
'use strict'; | ||
|
||
/** | ||
* This function will process all the attributes from the DOM element passed, taking all of | ||
* the configuration attributes. It uses the request-username and request-email | ||
* to prompt the user to decide if they want to share their personal information | ||
* with the third party application connecting through LTI. | ||
* @constructor | ||
* @param {jQuery} element DOM element with the lti container. | ||
*/ | ||
this.LTI = function(element) { | ||
var dataAttrs = $(element).find('.lti').data(), | ||
askToSendUsername = (dataAttrs.askToSendUsername === 'True'), | ||
askToSendEmail = (dataAttrs.askToSendEmail === 'True'); | ||
const $lti = $(element).find('.lti'); | ||
const askToSendUsername = $lti.data('ask-to-send-username') === 'True'; | ||
const askToSendEmail = $lti.data('ask-to-send-email') === 'True'; | ||
|
||
// When the lti button is clicked, provide users the option to | ||
// accept or reject sending their information to a third party | ||
$(element).on('click', '.link_lti_new_window', function() { | ||
if (askToSendUsername && askToSendEmail) { | ||
// eslint-disable-next-line no-alert | ||
return confirm(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) { | ||
// eslint-disable-next-line no-alert | ||
return confirm(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) { | ||
// eslint-disable-next-line no-alert | ||
return confirm(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 { | ||
return true; | ||
} | ||
}); | ||
}; | ||
}).call(this); | ||
// When the lti button is clicked, provide users the option to | ||
// accept or reject sending their information to a third party | ||
$(element).on('click', '.link_lti_new_window', function() { | ||
if (askToSendUsername && askToSendEmail) { | ||
return confirm('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) { | ||
return confirm('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) { | ||
return confirm('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 { | ||
return true; | ||
} | ||
}); | ||
} |
Oops, something went wrong.