From: soufiane Date: Fri, 22 Sep 2023 09:57:32 +0000 (+0200) Subject: wip #6182 @2:00 question match X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4162ff2d31bf408a0ea7fe80b44200673f8bd957;p=fluidbook-toolbox-quiz.git wip #6182 @2:00 question match --- diff --git a/js/quiz.match.js b/js/quiz.match.js index dc63906..f69f032 100644 --- a/js/quiz.match.js +++ b/js/quiz.match.js @@ -15,6 +15,7 @@ QuizMatch.prototype = { let posInit = 0 this.positionsX = [{top: "10"},{top: "39"}] this.counter = 0 + this.quiz.screens.currentQuestionAnswers = []; $(document).on("click", ".move-slide", function () { let move = $(this).attr("aria-keyshortcuts") @@ -99,13 +100,23 @@ QuizMatch.prototype = { },*/ confirmTheMatch: function() { - let lastIndex = this.swiperBottom.slides.length - 1 + let lastIndex = this.swiperTop.slides.length - 1 + let answer = this.swiperBottom.activeIndex + this.quiz.screens.currentQuestionAnswers.push(answer) + if(this.swiperTop.activeIndex === lastIndex) { - let response = "validate" - } else { - let response = this.swiperBottom.activeIndex - this.swiperTop.slideNext() + this.validateButton() + return false } + + this.swiperTop.slideNext() + }, + + validateButton: function() { + let btn = $(".active-screen").find(".confirmMatch"), + text = this.quiz.l10n.__('Validate answer'); + + btn.removeClass("confirmMatch").addClass("action validate").find('.text').text(text) } } diff --git a/views/screens/question_match.blade.php b/views/screens/question_match.blade.php index 34bf620..6fa3b0e 100644 --- a/views/screens/question_match.blade.php +++ b/views/screens/question_match.blade.php @@ -34,5 +34,9 @@
+
+ + +
@include('footer', ['question' => $question, 'data' => $data, 'reset' => true, 'text' => $__('Validate answer'), 'info' => true, 'matchMaking' => true])