diff --git a/macao/assets/quiz.js b/macao/assets/quiz.js index 3a841dcbfcbd01ed2cecd4f1946ab8f10ee5d275..cabe865c1ba1eecaf972239c9986abf2932200b5 100644 --- a/macao/assets/quiz.js +++ b/macao/assets/quiz.js @@ -71,6 +71,15 @@ $(function () { visibleIndex: 0, }); + // Add compComment to the metadata + Survey.JsonObject.metaData.addProperty("question", { + name: "compComment", + type: "text", + category: "general", + default: "", + visibleIndex: 0, + }); + // Load survey model from JSON const survey = new Survey.Model(jsonStatic); const questions = survey.getAllQuestions(); @@ -104,11 +113,19 @@ $(function () { } } + // Display compComment if present + if (options.question.compComment) { + const compCommentElement = document.createElement('div'); + compCommentElement.className = 'comp-comment'; + compCommentElement.innerHTML = options.question.compComment; + options.htmlElement.appendChild(compCommentElement); + } + // Add "Corrigé" button if helpComment is present if (options.question.helpComment) { const helpButton = document.createElement('button'); helpButton.innerHTML = 'Corrigé'; - helpButton.className = 'sd-btn sd-btn--action nav-input'; // Apply the specified class + helpButton.className = 'sd-btn sd-btn--action nav-input'; helpButton.onclick = () => toggleHelpComment(options.question, options.htmlElement); options.htmlElement.appendChild(helpButton); }