Skip to content
Snippets Groups Projects
Commit 2293b83c authored by Anthony's avatar Anthony
Browse files

Convert Markdown to HTML in feedback

parent a86a3ad5
No related branches found
No related tags found
No related merge requests found
$(document).ready(function() {
console.log('Custom JS loaded'); console.log('Custom JS loaded');
$(document).ready(function() {
console.log('Custom JS executed');
// Add specific classes to play buttons // Add specific classes to play buttons
$('button:contains("Play")').html('<i class="fa-solid fa-play"></i>'); $('button:contains("Play")').html('<i class="fa-solid fa-play"></i>');
}); });
/** /**
* Checks whether all questions are correctly answered and displays the overall feedback. * Checks whether all questions are correctly answered and displays the overall feedback.
*/ */
function checkAllQuestions(questions, surveyConfig) { function checkAllQuestions(questions, surveyConfig, converter) {
let allCorrect = true; let allCorrect = true;
questions.forEach((question) => { questions.forEach((question) => {
...@@ -12,10 +12,10 @@ function checkAllQuestions(questions, surveyConfig) { ...@@ -12,10 +12,10 @@ function checkAllQuestions(questions, surveyConfig) {
if (allCorrect) { if (allCorrect) {
correctIndic.node.className = "correct"; correctIndic.node.className = "correct";
correctIndic.commentNode.innerHTML = surveyConfig.correctComment || "All answers are correct!"; correctIndic.commentNode.innerHTML = converter.renderInline(surveyConfig.correctComment) || "All answers are correct!";
} else { } else {
correctIndic.node.className = "incorrect"; correctIndic.node.className = "incorrect";
correctIndic.commentNode.innerHTML = surveyConfig.incorrectComment || "Some answers are incorrect!"; correctIndic.commentNode.innerHTML = converter.renderInline(surveyConfig.incorrectComment) || "Some answers are incorrect!";
} }
} }
...@@ -79,7 +79,7 @@ $(function () { ...@@ -79,7 +79,7 @@ $(function () {
id: "sv-nav-check", id: "sv-nav-check",
title: "Vérifier", title: "Vérifier",
action: () => { action: () => {
checkAllQuestions(survey.currentPage.questions, jsonStatic); checkAllQuestions(survey.currentPage.questions, jsonStatic, converter);
}, },
css: "nav-button", css: "nav-button",
innerCss: "sd-btn sd-btn--action nav-input" innerCss: "sd-btn sd-btn--action nav-input"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment