From 2293b83c2cf4ccdd82f567d1441d51d1f33fbb4a Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Sun, 12 Jan 2025 21:10:52 +0100 Subject: [PATCH] Convert Markdown to HTML in feedback --- macao/assets/custom.js | 3 ++- macao/assets/quiz.js | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/macao/assets/custom.js b/macao/assets/custom.js index 8aa5571..034a11d 100644 --- a/macao/assets/custom.js +++ b/macao/assets/custom.js @@ -1,5 +1,6 @@ +console.log('Custom JS loaded'); $(document).ready(function() { - console.log('Custom JS loaded'); + console.log('Custom JS executed'); // Add specific classes to play buttons $('button:contains("Play")').html('<i class="fa-solid fa-play"></i>'); }); diff --git a/macao/assets/quiz.js b/macao/assets/quiz.js index e441f1a..1690efe 100644 --- a/macao/assets/quiz.js +++ b/macao/assets/quiz.js @@ -1,7 +1,7 @@ /** * Checks whether all questions are correctly answered and displays the overall feedback. */ -function checkAllQuestions(questions, surveyConfig) { +function checkAllQuestions(questions, surveyConfig, converter) { let allCorrect = true; questions.forEach((question) => { @@ -12,10 +12,10 @@ function checkAllQuestions(questions, surveyConfig) { if (allCorrect) { 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 { 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 () { id: "sv-nav-check", title: "Vérifier", action: () => { - checkAllQuestions(survey.currentPage.questions, jsonStatic); + checkAllQuestions(survey.currentPage.questions, jsonStatic, converter); }, css: "nav-button", innerCss: "sd-btn sd-btn--action nav-input" -- GitLab