]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6182 + mixins, css page intro
authorsoufiane <soufiane@cubedesigners.com>
Fri, 28 Jul 2023 14:23:53 +0000 (16:23 +0200)
committersoufiane <soufiane@cubedesigners.com>
Fri, 28 Jul 2023 14:23:53 +0000 (16:23 +0200)
app/Elearning/QuizCompiler.php
resources/quizv2/js/quiz.animations.js
resources/quizv2/js/quiz.js
resources/views/quizv2/header_title.blade.php [new file with mode: 0644]
resources/views/quizv2/index.blade.php
resources/views/quizv2/screens/intro.blade.php [new file with mode: 0644]

index bbd61856bf14ea7c51187c96503cbff34781d609..042a45e490bce179ebb7965d7eefc21fae661f64 100644 (file)
@@ -81,7 +81,8 @@ class QuizCompiler extends Base
     }
 
     /**
-     * Init data object from Quiz and ThemeQuiz Models     * These data will be injected into the quiz at compile time
+     * Init data object from Quiz and ThemeQuiz Models
+     * These data will be injected into the quiz at compile time
      *
      * @return void
      * @throws \Exception
index 94e87a686396ae032e9d78dd6096f5561b286902..a7883bc98c107ebe62516205628af96e513ee51b 100644 (file)
@@ -9,18 +9,20 @@ QuizAnimations.prototype = {
     // Load the animation "name" in container
     load: function (name, container, replace) {
         let json = this.quiz.data.animations[name];
-        $.each(replace, function (k, v) {
-            console.log(k, v);
-            json = json.replace(new RegExp(k, 'g'), v);
-        });
+        if(json) {
+            $.each(replace, function (k, v) {
+                console.log(k, v);
+                json = json.replace(new RegExp(k, 'g'), v);
+            });
 
-        lottie.loadAnimation({
-            container: $(container).get(0),
-            renderer: 'svg',
-            loop: false,
-            autoplay: true,
-            animationData: JSON.parse(json),
-        });
+            lottie.loadAnimation({
+                container: $(container).get(0),
+                renderer: 'svg',
+                loop: false,
+                autoplay: true,
+                animationData: JSON.parse(json),
+            });
+        }
     }
 }
 
index 5c4efd3d7cfa2faa6691fd5e0bcc3da8bb95fca1..2b9ef673fe17f6f91f50eee57cc2ff2a44c8cd51 100644 (file)
@@ -26,6 +26,9 @@ Quiz.prototype = {
         this.data = data;
         console.log(this.data);
         // ICI tout commence vraiment
+        console.log(this.data.theme)
+        $("#quiz").css("background-image","url("+this.data.theme.backgroundImage+")")
+
         this.animations.load('OK', $("#anim"), {'\\$text': 'Salut :)'});
 
         // La fonction resize est appellée à chaque fois qu'un resize de la fenêtre survient (et à l'init de l'app)
diff --git a/resources/views/quizv2/header_title.blade.php b/resources/views/quizv2/header_title.blade.php
new file mode 100644 (file)
index 0000000..38bd053
--- /dev/null
@@ -0,0 +1,4 @@
+<header id="title">
+    <h1 id="quizTitle">{{$data->title}}</h1>
+    <img src="{{$data->theme->logo}}" id="logo"/>
+</header>
index 698171cdcb300aca9c82b07664123ca6befa4557..582ca3c5d1b3ffc6f4321194ce315a710e920e17 100644 (file)
 <body>
 @include("quizv2.sprite")
 <div id="quiz">
-    <header id="title">
-        <h1 id="quizTitle">{{$data->title}}</h1>
-        <img src="{{$data->theme->logo}}" id="logo"/>
-    </header>
     @if($data->intro_enable)
-        <div class="screen" id="welcome">
-            <h2>{{$data->intro_title}}</h2>
-            <p>{{$data->intro_text}}</p>
-            <a class="btn primary radius">{{$data->intro_button}} <span data-icon="running-man"></span></a>
-        </div>
+        @include('quizv2.screens.intro', ['data'=> $data])
     @endif
 </div>
 <div id="anim"></div>
diff --git a/resources/views/quizv2/screens/intro.blade.php b/resources/views/quizv2/screens/intro.blade.php
new file mode 100644 (file)
index 0000000..97e9086
--- /dev/null
@@ -0,0 +1,6 @@
+@include('quizv2.header_title', ['data', $data])
+<div class="screen" id="welcome">
+    <h2>{{$data->intro_title}}</h2>
+    <p>{{$data->intro_text}}</p>
+    <a class="btn primary radius">{{$data->intro_button}} <span data-icon="running-man"></span></a>
+</div>