Created
August 14, 2024 21:54
-
-
Save jhenry/3ce4d191f40f1f5b13c910cac41b9e44 to your computer and use it in GitHub Desktop.
Self-Enrollment Link Widget for D2L Brightspace
This file contains hidden or 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
| <!-- | |
| Copyright (c) 2024 Justin Henry | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| this software and associated documentation files (the "Software"), to deal in | |
| the Software without restriction, including without limitation the rights to | |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
| the Software, and to permit persons to whom the Software is furnished to do so, | |
| subject to the following conditions: | |
| The above copyright notice and this permission notice shall be included in all | |
| copies or substantial portions of the Software. | |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | |
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | |
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | |
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| --> | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Copy Self Enrollment Link</title> | |
| <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous"> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div class="row"> | |
| <div class="col"> | |
| <h1 class="display-6">Get an Enrollment Link</h1> | |
| <p>You can use the below URL to provide participants with a direct link they can use to self-enroll in this course. Don't forget to make the course active before sending the link to them!</p> | |
| <div class="input-group mb-3 px-1"> | |
| <input type="text" class="form-control" id="share-link" value="" aria-label="Link to self enroll page" aria-describedby="copy-button" readonly> | |
| <button class="btn btn-outline-primary" type="button" id="copy-button" data-clipboard-target="#share-link">Copy</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script> | |
| <script> | |
| var clipboard = new ClipboardJS('.btn'); | |
| let ou = '{OrgUnitId}'; | |
| let path = '/d2l/le/discovery/view/course/'; | |
| let selfEnrollUrl = window.location.origin + path + ou; | |
| document.getElementById("share-link").value = selfEnrollUrl; | |
| clipboard.on('success', function (e) { | |
| const button = document.getElementById('copy-button'); | |
| const currentLabel = button.innerHTML; | |
| // Exit label update when already in progress | |
| if(button.innerHTML === 'Copied!'){ | |
| return; | |
| } | |
| // Update button label | |
| button.innerHTML = 'Copied!'; | |
| // Revert button label after 3 seconds | |
| setTimeout(function(){ | |
| button.innerHTML = currentLabel; | |
| }, 3000); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment