From 6fdc9db102e7a13c65528bef555c5b67a07f670b Mon Sep 17 00:00:00 2001
From: daxid <david.rouquet@tetras-libre.fr>
Date: Thu, 19 Jun 2025 09:23:32 +0200
Subject: [PATCH] Ajout compComment pour survey

---
 macao/assets/quiz.js | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/macao/assets/quiz.js b/macao/assets/quiz.js
index 3a841dc..cabe865 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);
         }
-- 
GitLab