]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6375 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 07:00:34 +0000 (09:00 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2023 07:00:34 +0000 (09:00 +0200)
app/Models/QuizTheme.php

index d1e1b8b5298c420034268f0a722e78602f6a5ab7..6ce0e1b3a94f919ec91ca8a2576669aec8d70eb7 100644 (file)
@@ -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')]);