Skip to content
Snippets Groups Projects
Commit 5d07f423 authored by Anthony's avatar Anthony
Browse files

Merge branch '13-css-hideDisabledCheckboxes' into 'main'

Resolve "Implémentation types d'exercice manquants"

Closes #13

See merge request macao/macao-hugo!3
parents 8f988429 2293b83c
No related branches found
No related tags found
1 merge request!3Resolve "Implémentation types d'exercice manquants"
Pipeline #2032 canceled
......@@ -51,7 +51,7 @@ select.sd-dropdown.inline-dropdown, input.sd-input.inline-input {
// ***********************************
// Hide disabled checkboxes in some quizz
// ***********************************
[data-name="pg665"] {
.hide-disabled-checkboxes {
.sd-checkbox--readonly {
span.sd-checkbox__decorator {
display: none;
......
$(document).ready(function() {
console.log('Custom JS loaded');
$(document).ready(function() {
console.log('Custom JS executed');
// Add specific classes to play buttons
$('button:contains("Play")').html('<i class="fa-solid fa-play"></i>');
});
/**
* 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!";
}
}
......@@ -63,9 +63,14 @@ $(function () {
});
survey.onAfterRenderQuestion.add((survey, options) => {
if (options.question.customFormat && options.question.customFormat === "one_line") {
if (options.question.customFormat) {
if (options.question.customFormat === "one_line") {
$(options.htmlElement).addClass("one-line");
}
if(options.question.customFormat === "hide_disabled-checkboxes") {
$(options.htmlElement).addClass("hide-disabled-checkboxes");
}
}
});
......@@ -74,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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment