From 5b3e97a1c6110cc15764aa0f828843b76605ceef Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Oct 2023 09:00:34 +0200 Subject: [PATCH] wip #6375 @0.5 --- app/Models/QuizTheme.php | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/app/Models/QuizTheme.php b/app/Models/QuizTheme.php index d1e1b8b52..6ce0e1b3a 100644 --- a/app/Models/QuizTheme.php +++ b/app/Models/QuizTheme.php @@ -35,6 +35,11 @@ class QuizTheme extends ToolboxModel public $registerMediaConversionsUsingModelInstance = false; + const DESKTOP_SIZE = '1200 x 680px'; + const MOBILE_SIZE = '390 x 844px'; + + const ICON_SIZE = '512 x 512px'; + public function setFields() { parent::setFields(); @@ -78,8 +83,9 @@ class QuizTheme extends ToolboxModel protected function _logo() { $this->addField('sectionLogo', FormSection::class, __('Logo')); - $this->addField('logo', FluidbookThemeImage::class, __('Logo'), ['accept' => '.svg,.png,.jpg', 'hint' => __('Hauteur 40px')]); - $this->addField('favicon', FluidbookThemeImage::class, __('Icône pour favicon et apps'), ['hint' => 'Carré de 512x512px']); + $h = __('hauteur de 40px'); + $this->addField('logo', FluidbookThemeImage::class, __('Logo'), ['accept' => '.svg,.png,.jpg', 'hint' => __('Taille recommandée : :size', ['size' => $h])]); + $this->addField('favicon', FluidbookThemeImage::class, __('Icône pour favicon et apps'), ['hint' => __('Taille recommandée : :size', ['size' => self::ICON_SIZE])]); } protected function _background() @@ -89,9 +95,8 @@ class QuizTheme extends ToolboxModel $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, __('Image ou animation'), ['hint' => __('Taille recommandée : :size', ['size' => '1200 x 680px']), 'when' => ['backgroundCustom' => 1]]); - $this->addField('', FormSeparator::class, '', ['when' => ['backgroundCustom' => 1]]); - $this->addField('backgroundImageMobile', FluidbookThemeImage::class, __('Image ou animation'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['backgroundCustom' => 1]]); + $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]]); } protected function _intro() @@ -100,8 +105,8 @@ class QuizTheme extends ToolboxModel $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' => '1200 x 680px']), 'when' => ['introCustom' => 1]]); - $this->addField('introImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['introCustom' => 1]]); + $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]]); } protected function _standardQuestions() @@ -110,24 +115,18 @@ class QuizTheme extends ToolboxModel $this->addField('standardColor', 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('standardCustom', Checkbox::class, __('Définir une forme personnalisée')); - $this->addField('standardImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => '1200 x 160px']), 'when' => ['standardCustom' => 1]]); - $this->addField('standardImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 174px']), 'when' => ['standardCustom' => 1]]); + $this->addField('standardImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => ['standardCustom' => 1]]); + $this->addField('standardImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => ['standardCustom' => 1]]); } protected function _draganddropQuestions() { - $areas = [1 => 150, 2 => 210]; - $this->addField('sectionDraganddrop', FormSection::class, __('Questions "drag & drop"')); - foreach ($areas as $i => $h) { - $this->addField('draganddropArea' . $i . 'Color', Color::class, __('Couleur et transparence du bloc de la zone :zone', ['zone' => $i]), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); - } + $this->addField('draganddropColor', Color::class, __('Couleur et transparence des zones'), ['hint' => __('Par défaut, la couleur neutre du thème'), 'allows_empty' => true]); $this->addField('', FormSeparator::class, ''); $this->addField('draganddropCustom', Checkbox::class, __('Définir une forme personnalisée')); - foreach ($areas as $i => $h) { - $this->addField('draganddropArea' . $i . 'Image', FluidbookThemeImage::class, __('Desktop Zone :zone', ['zone' => $i]), ['hint' => __('Taille recommandée : :size', ['size' => '260 x 680px']), 'when' => ['draganddropCustom' => 1]]); - $this->addField('draganddropArea' . $i . 'ImageMobile', FluidbookThemeImage::class, __('Mobile Zone :zone', ['zone' => $i]), ['hint' => __('Taille recommandée : :size', ['size' => '390 x ' . $h . 'px']), 'when' => ['draganddropCustom' => 1]]); - } + $this->addField('draganddropImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => self::DESKTOP_SIZE]), 'when' => ['draganddropCustom' => 1]]); + $this->addField('draganddropImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => self::MOBILE_SIZE]), 'when' => ['draganddropCustom' => 1]]); } protected function _outro() @@ -137,8 +136,8 @@ class QuizTheme extends ToolboxModel $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' => '1200 x 680px']), 'when' => ['outroCustom' => 1]]); - $this->addField('outroImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['outroCustom' => 1]]); + $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('', 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')]); -- 2.39.5