]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6182 @2:00 question match
authorsoufiane <soufiane@cubedesigners.com>
Fri, 22 Sep 2023 09:57:32 +0000 (11:57 +0200)
committersoufiane <soufiane@cubedesigners.com>
Fri, 22 Sep 2023 09:57:32 +0000 (11:57 +0200)
js/quiz.match.js
views/screens/question_match.blade.php

index dc63906cda3440b26eab81ca78c63ada4d9613f4..f69f0325990d49069f449ca2549045ce518ea9d8 100644 (file)
@@ -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)
     }
 }
 
index 34bf620c152406f1d33a060f8d5fdab6d796cdad..6fa3b0ec4a55db6460216fb9244383dd76208b0a 100644 (file)
@@ -34,5 +34,9 @@
             <div class="swiper-pagination-bottom"></div>
         </div>
     </div>
+    <div class="screen-image">
+        <img src="{{$theme->standardImage}}"/>
+        <img class="mobile question-multiple" src="{{$theme->standardImageMobile}}"/>
+    </div>
     @include('footer', ['question' => $question, 'data' => $data, 'reset' => true, 'text' => $__('Validate answer'), 'info' => true, 'matchMaking' => true])
 </div>