From e166c721cb2632b46ad7c21a723d9b6a195d25fe Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 18 Jun 2025 18:09:05 +0200 Subject: [PATCH] wait #7591 @1.5 --- app/Elearning/QuizCompiler.php | 1 + app/Models/QuizTheme.php | 41 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php index e0d23100c..60e86efed 100644 --- a/app/Elearning/QuizCompiler.php +++ b/app/Elearning/QuizCompiler.php @@ -192,6 +192,7 @@ class QuizCompiler extends Base $this->_addBackgrounds('background'); $this->_addBackgrounds('intro'); + $this->_addBackgrounds('outro'); $this->_addBackgrounds('standard'); $this->_addBackgrounds('draganddrop'); $this->_addBackgrounds('match'); diff --git a/app/Models/QuizTheme.php b/app/Models/QuizTheme.php index 6bd30d2dc..c84d2b8b0 100644 --- a/app/Models/QuizTheme.php +++ b/app/Models/QuizTheme.php @@ -105,30 +105,34 @@ class QuizTheme extends ToolboxModel $this->addField('sectionBackground', FormSection::class, __('Fond')); $this->addField('sectionBackgroundDesc', FormSectionDescription::class, __('Par défaut, le fond utilisé est celui pour desktop.') . ' ' . __('Chargez un fichier dans la partie Mobile pour affecter un fond personnalisé pour Mobile.')); $this->addField('backgroundColor', Color::class, __('Couleur de fond')); - $this->addField('', FormSeparator::class); - $this->addField('backgroundCustom', Checkbox::class, __('Définir un fond personnalisé ou animé')); - $this->addField('backgroundImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => ['backgroundCustom' => 1]]); - $this->addField('backgroundImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => ['backgroundCustom' => 1]]); + $this->_customShape('background', true, __('Image ou animation de fond')); + } + + protected function _customShape($name, $showSeparator = true, $label = null) + { + if ($showSeparator) { + $this->addField('', FormSeparator::class, ''); + } + if (null === $label) { + $label = __('Définir une forme personnalisée'); + } + $this->addField($name . 'Custom', Checkbox::class, $label); + $this->addField($name . 'Image', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => [$name . 'Custom' => 1]]); + $this->addField($name . 'ImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => [$name . 'Custom' => 1]]); } protected function _intro() { $this->addField('sectionIntro', FormSection::class, __('Écran d\'introduction')); $this->addField('introColor', Color::class, __('Couleur et transparence du bloc'), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); - $this->addField('', FormSeparator::class, ''); - $this->addField('introCustom', Checkbox::class, __('Définir une forme personnalisée')); - $this->addField('introImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => ['introCustom' => 1]]); - $this->addField('introImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => ['introCustom' => 1]]); + $this->_customShape('intro'); } protected function _question($name, $title) { $this->addField('sectionQuestion' . $name, FormSection::class, $title); $this->addField($name . 'Color', Color::class, __('Couleur et transparence du bloc'), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); - $this->addField('', FormSeparator::class, ''); - $this->addField($name . 'Custom', Checkbox::class, __('Définir une forme personnalisée')); - $this->addField($name . 'Image', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => [$name . 'Custom' => 1]]); - $this->addField($name . 'ImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => [$name . 'Custom' => 1]]); + $this->_customShape($name); } protected function _standardQuestions() @@ -151,16 +155,13 @@ class QuizTheme extends ToolboxModel protected function _outro() { - return; $this->addField('sectionOutro', FormSection::class, __('Conclusion')); - $this->addField('outroColor', Color::class, __('Couleur et transparence du bloc'), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); - $this->addField('', FormSeparator::class, ''); - $this->addField('outroCustom', Checkbox::class, __('Définir une forme personnalisée')); - $this->addField('outroImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => ['outroCustom' => 1]]); - $this->addField('outroImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => ['outroCustom' => 1]]); + //$this->addField('outroColor', Color::class, __('Couleur et transparence du bloc'), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); + $this->addField('outroOverlayLeft', Checkbox::class, __('Afficher un overlay sur la partie gauche de l\'écran'), ['default' => true]); + $this->_customShape('outro', true); //$this->addField('', FormSeparator::class, ''); - $this->addField('outroSuccessAnimation', Hidden::class, __('Animation de réussite'), ['hint' => __('390 x 390px')]); - $this->addField('outroFailAnimation', Hidden::class, __('Animation d\'échec'), ['hint' => __('390 x 390px')]); + //$this->addField('outroSuccessAnimation', Hidden::class, __('Animation de réussite'), ['hint' => __('390 x 390px')]); + //$this->addField('outroFailAnimation', Hidden::class, __('Animation d\'échec'), ['hint' => __('390 x 390px')]); } public function getTextsColor($opposite = false) -- 2.39.5