-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for event handling (#79)
* space fixes in quiz * Ignore plugins dir * Trying to import web component * Dynamically Get Data * Load questions based on content * Add attributes to web component plugins * Add questions on build time * [FIX] Add back toggle nav bar script * Removed by mistake * Add context info * Move to ENUMS for ContentTypes * Raise alert on submit bug report * Default position to bottom right for now * Move button to header * fix bug report desktop view * add floating bug report button for mobile view * switch position of popup menu & bug report button * made bug report feature testing exclusive * Update package-lock * Migrate bug report module script link to virtual labs * Add an event handler * Move bug report event handling * Update bug report event name to vl-bug-report * Notify user on successful bug report * Update bug report title * Push learningUnit and task to dataLayer * Add toast mesages instead of alerts * They are technically still alerts of bootstrap, but they look more like a toast * Also fix duplicate question * Use Sweet alert 2 for toast notification Co-authored-by: b30wulffz <[email protected]>
- Loading branch information
Showing
6 changed files
with
49 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"use-strict"; | ||
|
||
const Toast = Swal.mixin({ | ||
toast: true, | ||
position: 'bottom-end', | ||
showConfirmButton: false, | ||
timer: 3000, | ||
timerProgressBar: true, | ||
didOpen: (toast) => { | ||
toast.addEventListener('mouseenter', Swal.stopTimer) | ||
toast.addEventListener('mouseleave', Swal.resumeTimer) | ||
} | ||
}) | ||
|
||
document.getElementById('bug-report').addEventListener('vl-bug-report', (e)=>{ | ||
if(e.detail.status === 200 || e.detail.status === 201){ | ||
const learningUnit = document.head.querySelector('meta[name="learning-unit"]').content; | ||
const task = document.head.querySelector('meta[name="task-name"]').content; | ||
dataLayer.push({ | ||
event: "vl-bug-report", | ||
"bug-type": e.detail.issues, | ||
"learning-unit": learningUnit ? learningUnit : "", | ||
"task-name": task ? task : "" | ||
}) | ||
Toast.fire({ | ||
icon: 'success', | ||
iconColor: "white", | ||
background:"#a5dc86", | ||
title: 'Bug Reported Succesfully', | ||
}) | ||
}else{ | ||
Toast.fire({ | ||
icon: 'error', | ||
iconColor: "white", | ||
color:"white", | ||
background:"#f27474", | ||
timer: 5000, | ||
title: 'Bug Report Failed, Please Try Again', | ||
}) | ||
} | ||
}) |
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
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