]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wait #6397 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Oct 2023 07:34:20 +0000 (09:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 16 Oct 2023 07:34:20 +0000 (09:34 +0200)
js/quiz.draganddrop.js
style/100-global.sass
style/106-question-draganddrop.sass
views/header_question.blade.php

index c693bdbb907306ef50cfbe44b6135ad3577ac923..98c06ac7a51bd1714273550cfdebcab37b76e89d 100644 (file)
@@ -49,7 +49,7 @@ QuizDragAndDrop.prototype = {
             return;
         }
         //this.quiz.screens.currentQuestionAnswers.push(area === 'zone-1' ? 1 : 2);
-        console.log("index",index)
+        console.log("index", index)
         this.quiz.screens.currentQuestionAnswers.splice(index, 0, area === 'zone-1' ? 1 : 2)
 
         this.animating = true;
@@ -67,7 +67,7 @@ QuizDragAndDrop.prototype = {
                 height: slot.h,
                 x: slot.x,
                 y: slot.y,
-                fontSize: "14px",
+                fontSize: "12px",
                 padding: "7px 8px",
                 borderRadius: "8px",
                 position: 'absolute',
@@ -211,7 +211,13 @@ QuizDragAndDrop.prototype = {
 
         if (!this.quiz.resize.isMobile()) {
             let freeSlot = this.getAreaElement(zone).find(".slot:not(.active)")
-            freeSlot.eq(0).addClass("active").append("<h4>" + title + "</h4><p>" + text + "</p>").attr('data-order', target.data("id"))
+            let slotContent = "<h4>" + title + "</h4>";
+            if (text !== '') {
+                slotContent = "<p>" + text + "</p>";
+            } else {
+                freeSlot.addClass('onlyh4');
+            }
+            freeSlot.eq(0).addClass("active").html(slotContent).attr('data-order', target.data("id"))
         }
         target.remove()
     },
@@ -247,7 +253,7 @@ QuizDragAndDrop.prototype = {
     getSlotInformations: function (zone) {
         let a = this.getAreaElement(zone);
         let freeSlot = $(a).find('.slot:not(.active)')
-        if(freeSlot.index() > 5) {
+        if (freeSlot.index() > 5) {
             freeSlot = $(a).find('.slot:nth-child(6)')
         }
         freeSlot = freeSlot.eq(0);
index a2a4a9a60e4363ec1423dbd77c07ad5a32b3e7c7..db2e7b902b21ba72f0eca8dab3e4e335bd14e86a 100644 (file)
@@ -289,38 +289,3 @@ body
             object-fit: fill
 
 
-.card-holder
-    transition: background-color .2s ease
-    +opacity(.08, background-color, $texts-color)
-    +radius(16px)
-    padding: 8px
-    display: grid
-    gap: 8px
-
-    .slot
-        width: 100%
-        height: 51px
-        transition: all .3s
-        +radius(8px)
-        padding: 7px 8px
-        font-size: 12px
-
-        h4
-            font-size: 1.25em
-            font-weight: 600
-            max-height: 1.1em
-            overflow: hidden
-            text-align: left
-
-        p
-            font-size: 1em
-            font-weight: 400
-            max-height: 1em
-            overflow: hidden
-            text-align: left
-            white-space: pre-line
-            margin-top: 3px
-
-        &.active
-            background-color: rgba($opposite-texts-color, 0.24)
-            border: 1px solid rgba($texts-color, .24)
index 1e783b4973f666aa519a6ccb6ae84d86b6d08f97..833e0b308d6f815e53731e0f041aa582882f91f6 100644 (file)
             border: 1px dashed rgba($texts-color, .24)
             z-index: 3
 
+.card-holder
+    transition: background-color .2s ease
+    +opacity(.08, background-color, $texts-color)
+    +radius(16px)
+    padding: 8px
+    display: grid
+    gap: 8px
+
+    .slot
+        width: 100%
+        height: 51px
+        transition: all .3s
+        +radius(8px)
+        padding: 7px 8px
+        font-size: 12px
+
+        &.onlyh4
+            h4
+                max-height: 2.05em
+
+        h4
+            font-size: 1.25em
+            font-weight: 600
+            max-height: 1.05em
+            overflow: hidden
+            text-align: left
+
+        p
+            font-size: 1em
+            font-weight: 400
+            max-height: 1em
+            overflow: hidden
+            text-align: left
+            white-space: pre-line
+            margin-top: 3px
+
+        &.active
+            background-color: rgba($opposite-texts-color, 0.24)
+            border: 1px solid rgba($texts-color, .24)
+
+
 .m
     .container-screen.question-draganddrop
         .controls
index 03f16484adf6754658df7c5c4a3f4447b2622ee6..7b48ab10b67665f49f96e3bb62939850cbd4dc82 100644 (file)
@@ -1,5 +1,11 @@
 @php
     $h1class='';
+
+    $limit=105;
+    if($question['type'] === "draganddrop"){
+        $limit=40;
+    }
+
     if(mb_strlen($question['question'])>105){
         $h1class='small';
     }
     </div>
 
     @if($question['type'] === "draganddrop")
-        <h1 id="titleQuestion">
-            <span class="only-desktop">{{$__('Drag and drop each card in the right container')}}</span>
-            <span class="only-mobile">{{$__('Swipe up or down each card in the right container')}}</span>
+        <h1 class="{{$h1class}}" id="titleQuestion">
+            <span
+                class="only-desktop">{{$__('Drag and drop each card in the right container')}}{{__(': ')}}<br>{{$question['question']}}</span>
+            <span class="only-mobile">{{$__('Swipe up or down each card in the right container')}}{{__(': ')}}<br>{{$question['question']}}</span>
         </h1>
         <h2 class="subtitle only-desktop">{{$__('Use arrow keys to move the cards to the corresponding zone')}}</h2>
     @elseif($question['type']==='match')