From: soufiane Date: Fri, 28 Jul 2023 14:23:53 +0000 (+0200) Subject: wip #6182 + mixins, css page intro X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=338ce134888a0068576cf80e8fb96364a7878264;p=fluidbook-toolbox.git wip #6182 + mixins, css page intro --- diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php index bbd61856b..042a45e49 100644 --- a/app/Elearning/QuizCompiler.php +++ b/app/Elearning/QuizCompiler.php @@ -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 diff --git a/resources/quizv2/js/quiz.animations.js b/resources/quizv2/js/quiz.animations.js index 94e87a686..a7883bc98 100644 --- a/resources/quizv2/js/quiz.animations.js +++ b/resources/quizv2/js/quiz.animations.js @@ -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), + }); + } } } diff --git a/resources/quizv2/js/quiz.js b/resources/quizv2/js/quiz.js index 5c4efd3d7..2b9ef673f 100644 --- a/resources/quizv2/js/quiz.js +++ b/resources/quizv2/js/quiz.js @@ -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 index 000000000..38bd0537d --- /dev/null +++ b/resources/views/quizv2/header_title.blade.php @@ -0,0 +1,4 @@ +
+

{{$data->title}}

+ +
diff --git a/resources/views/quizv2/index.blade.php b/resources/views/quizv2/index.blade.php index 698171cdc..582ca3c5d 100644 --- a/resources/views/quizv2/index.blade.php +++ b/resources/views/quizv2/index.blade.php @@ -12,16 +12,8 @@ @include("quizv2.sprite")
-
-

{{$data->title}}

- -
@if($data->intro_enable) -
-

{{$data->intro_title}}

-

{{$data->intro_text}}

- {{$data->intro_button}} -
+ @include('quizv2.screens.intro', ['data'=> $data]) @endif
diff --git a/resources/views/quizv2/screens/intro.blade.php b/resources/views/quizv2/screens/intro.blade.php new file mode 100644 index 000000000..97e9086c3 --- /dev/null +++ b/resources/views/quizv2/screens/intro.blade.php @@ -0,0 +1,6 @@ +@include('quizv2.header_title', ['data', $data]) +
+

{{$data->intro_title}}

+

{{$data->intro_text}}

+ {{$data->intro_button}} +