Skip to content
Snippets Groups Projects
Commit 6fdc9db1 authored by David Rouquet's avatar David Rouquet
Browse files

Ajout compComment pour survey

parent 147b5593
No related branches found
No related tags found
No related merge requests found
Pipeline #2070 passed
...@@ -71,6 +71,15 @@ $(function () { ...@@ -71,6 +71,15 @@ $(function () {
visibleIndex: 0, 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 // Load survey model from JSON
const survey = new Survey.Model(jsonStatic); const survey = new Survey.Model(jsonStatic);
const questions = survey.getAllQuestions(); const questions = survey.getAllQuestions();
...@@ -104,11 +113,19 @@ $(function () { ...@@ -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 // Add "Corrigé" button if helpComment is present
if (options.question.helpComment) { if (options.question.helpComment) {
const helpButton = document.createElement('button'); const helpButton = document.createElement('button');
helpButton.innerHTML = 'Corrigé'; 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); helpButton.onclick = () => toggleHelpComment(options.question, options.htmlElement);
options.htmlElement.appendChild(helpButton); options.htmlElement.appendChild(helpButton);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment