From 41a9f603d2061b0ec815592a90b16794729881bc Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 6 May 2019 21:53:00 +0200 Subject: [PATCH] [9.1.00] full responsive banner --- core/core.php | 27 ++++++- core/layout/common.css | 1 - core/module/theme/theme.php | 11 +-- core/module/theme/view/header/header.js.php | 8 ++ core/module/theme/view/header/header.php | 84 ++++++++++----------- 5 files changed, 81 insertions(+), 50 deletions(-) diff --git a/core/core.php b/core/core.php index b483a9b3..c85621e5 100644 --- a/core/core.php +++ b/core/core.php @@ -987,7 +987,30 @@ class core extends common { } } $css .= 'header{background-size:' . $this->getData(['theme','header','imageContainer']).'}'; - $css .= 'header{background-color:' . $colors['normal'] . ';height:' . $this->getData(['theme', 'header', 'height']) . ';line-height:' . $this->getData(['theme', 'header', 'height']) . ';text-align:' . $this->getData(['theme', 'header', 'textAlign']) . '}'; + $css .= 'header{background-color:' . $colors['normal']; + + + if ($this->getData(['theme', 'header', 'height']) === 'none') { + // Controle de l'existence du fichier + if (file_exists('site/file/source/' . $this->getData(['theme','header','image'])) && + $this->getData(['theme', 'header', 'image']) ) { + // On établie la hauteur du div en proportion de l'image + // (hauteur / largeur) . 100 + $sizes = getimagesize('site/file/source/'.$this->getData(['theme','header','image'])); + //var_dump($sizes); + $css .= ';height: 0; padding-top:'; + $css .= ( $sizes[1] / $sizes[0] )* 100; + $css .= '%'; + } else { + // Le fichier n'existe plus + // largeur par défaut + $css .= ';height: 150px;'; + } + } else { + // Valeur de hauteur traditionnelle + $css .= ';height:' . $this->getData(['theme', 'header', 'height']); + } + $css .= ';line-height:' . $this->getData(['theme', 'header', 'height']) . ';text-align:' . $this->getData(['theme', 'header', 'textAlign']) . '}'; if($themeHeaderImage = $this->getData(['theme', 'header', 'image'])) { $css .= 'header{background-image:url("../file/source/' . $themeHeaderImage . '");background-position:' . $this->getData(['theme', 'header', 'imagePosition']) . ';background-repeat:' . $this->getData(['theme', 'header', 'imageRepeat']) . '}'; } @@ -1889,7 +1912,7 @@ class layout extends common { ($this->getUrl(0) === 'theme' ? 'class="displayNone"' : '') . '> | Connexion'; + '" data-tippy-content="Connexion à l\'administration" rel="noindex, nofollow">Connexion'; } $items .= ''; echo $items; diff --git a/core/layout/common.css b/core/layout/common.css index 66c47c21..ea1d69e3 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -38,7 +38,6 @@ body { } header { margin:0px 0px !important; - background-size: cover !important; } } diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 3db8cca8..948ed776 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -105,6 +105,7 @@ class theme extends common { '2.4vmax' => 'Très grande (240%)' ]; public static $headerHeights = [ + 'none' => 'Automatique', '100px' => 'Très petite (100px) ', '150px' => 'Petite (150px)', '200px' => 'Moyenne (200px)', @@ -185,10 +186,10 @@ class theme extends common { '16px' => '16 pixels' ]; public static $sizes = [ - 'auto' => 'Automatique', 'cover' => 'Responsive', - 'contain' => 'Taille réelle', - '100% 100%' => 'Image étirée' + // 'contain' => 'Responsive (contain)', + 'auto auto' => 'Automatique', + '100% 100%' => 'Image étirée' ]; public static $textTransforms = [ 'none' => 'Standard', @@ -203,9 +204,9 @@ class theme extends common { '100%' => 'Fluide (100%)' ]; public static $headerWide = [ - 'auto auto' => 'Automatique', 'cover' => 'Responsive', - 'contain' => 'Taille réelle', + // 'contain' => 'Responsive (contain)', + 'auto auto' => 'Automatique', '100% 100%' => 'Image étirée' ]; diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index c5e40cdb..43ecf0ba 100755 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -91,6 +91,14 @@ $("input, select").on("change", function() { .appendTo("head"); }); +$("#themeHeaderHeight").on("change", function() { + if($(this).val() === 'none') { + $("#themeHeaderTextHide").prop("disabled", true); + $("#themeHeaderTextHide").prop("checked", true).trigger("change"); + } else { + $("#themeHeaderTextHide").prop("disabled", false); + } +}).trigger("change"); // Affiche / Cache les options de l'image du fond $("#themeHeaderImage").on("change", function() { diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 1c59a67a..b0246bed 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -78,6 +78,48 @@ +
+
+
+

Configuration

+
+
+ 'Position', + 'selected' => $this->getData(['theme', 'header', 'position']) + ]); ?> +
+
+ 'Hauteur', + 'selected' => $this->getData(['theme', 'header', 'height']), + 'help' => 'Pour une bannière image responsive, sélectionnez automatique, + dans ce cas la hauteur est proportionnelle à la largeur de l\'image. + Le titre du site est indisponible en mode responsive.' + ]); ?> +
+
+ 'Alignement du contenu', + 'selected' => $this->getData(['theme', 'header', 'textAlign']) + ]); ?> +
+ +
+
+ $this->getData(['theme', 'header', 'linkHome']) + ]); ?> +
+
+ $this->getData(['theme', 'header', 'margin']) + ]); ?> +
+ +
+
+
@@ -112,46 +154,4 @@
-
-
-
-

Configuration

-
-
- 'Position', - 'selected' => $this->getData(['theme', 'header', 'position']) - ]); ?> -
-
- 'Hauteur', - 'selected' => $this->getData(['theme', 'header', 'height']) - ]); ?> -
-
- 'Alignement du contenu', - 'selected' => $this->getData(['theme', 'header', 'textAlign']) - ]); ?> -
- -
- -
- $this->getData(['theme', 'header', 'linkHome']) - ]); ?> -
- - -
- $this->getData(['theme', 'header', 'margin']) - ]); ?> -
- -
-
-