Skip to content

Instantly share code, notes, and snippets.

@christopher-b
Last active July 5, 2016 14:10
Show Gist options
  • Save christopher-b/16488b5385d4fdc04e2946441b968fca to your computer and use it in GitHub Desktop.
Save christopher-b/16488b5385d4fdc04e2946441b968fca to your computer and use it in GitHub Desktop.
Canvas LMS: Add a button to the sidebar to trigger RTE LTI Launch
$(function(){
var $body = $('body');
// Add a button to launch the Outline Builder, which triggers the RTE LTI Launch
if($body.hasClass('syllabus')) {
// #editor_tabs is only visible when the RTE is active
$('#editor_tabs').prepend('<div style="padding-bottom:1em;"><a class="Button Button--primary icon-compose" id="launch_outline_editor_button">Course Outline Builder</a></div>');
$('#launch_outline_editor_button').click(function(){
// Existing RTE LTI buttons are added with aria-label set to the "Name" of the tool, as defined in the tool settings UI, not the XML
$('div[aria-label="Outline Builder"]').click();
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment