From ad47125c116d2aa1a151c5376d5708ba18516152 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 11 Nov 2019 19:12:19 +0100 Subject: [PATCH] =?UTF-8?q?[9.2.10]=20Am=C3=A9lioration=20banni=C3=A8re=20?= =?UTF-8?q?responsive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.js.php | 19 ++++++++++++++ core/module/theme/theme.php | 2 +- core/module/theme/view/header/header.js.php | 23 ++++++++++------ core/module/theme/view/header/header.php | 29 ++++++++++++--------- 4 files changed, 51 insertions(+), 22 deletions(-) diff --git a/core/core.js.php b/core/core.js.php index 924dcd92..bede0273 100755 --- a/core/core.js.php +++ b/core/core.js.php @@ -307,6 +307,7 @@ core.start = function() { core.noticeAdd(_this.attr("id"), "Format incorrect"); } }); + /** * Iframes et vidéos responsives */ @@ -329,7 +330,25 @@ core.start = function() { }); }).trigger("resize"); + /* + * Header responsive + */ + $(window).on("resize", function() { + var responsive = "getdata(['theme','header','imageContainer']);?>"; + if (responsive === "cover" || responsive === "contain" ) { + var widthpx = "getdata(['theme','site','width']);?>"; + var width = widthpx.substr(0,widthpx.length-2); + var heightpx = "getdata(['theme','header','height']);?>"; + var height = heightpx.substr(0,heightpx.length-2); + var ratio = width / height; + $("header").height( $(window).width() / ratio ); + $("header").css("line-height", $(window).width() / ratio + "px"); + } + }).trigger("resize"); + }; + + core.start(); /** diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 34d641d2..eeda2779 100755 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -216,8 +216,8 @@ class theme extends common { ]; public static $headerWide = [ 'auto auto' => 'Automatique', - 'cover' => 'Responsive (cover)', '100% 100%' => 'Image étirée (100% 100%)', + 'cover' => 'Responsive (cover)', 'contain' => 'Responsive (contain)' ]; public static $footerTemplate = [ diff --git a/core/module/theme/view/header/header.js.php b/core/module/theme/view/header/header.js.php index 13311523..70afd9a2 100755 --- a/core/module/theme/view/header/header.js.php +++ b/core/module/theme/view/header/header.js.php @@ -12,7 +12,10 @@ * @link http://zwiicms.com/ */ - +$(document).ready(function(){ + $("header").css("line-height", ""); + $("header").css("height", ""); +}); /** * Aperçu en direct @@ -35,21 +38,25 @@ $("input, select").on("change", function() { tmpImgHeight = tmpImg.height; } - //Modifier la dropdown liste - if ($("#themeHeaderImage").val() !== "") { + //Modifier la dropdown liste si une image n'est pas sélectionnée + if ($("#themeHeaderImage").val() !== "" ) { // Une image est ajoutée ou changée - if ($("#themeHeaderHeight option").length === 4) { + if ($("#themeHeaderHeight option").length === 5) { + // Pas d'image précédemment on ajoute l'option $("#themeHeaderHeight ").prepend(''); - } + } // Modifier la valeur $("#themeHeaderHeight option:eq(0)").val(tmpImgHeight + "px"); // Modifier l'option - $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); - } else { - $("#themeHeaderHeight option:first-child").html("Hauteur de l\'image sélectionnée"); + $("#themeHeaderHeight option:eq(0)").html("Hauteur de l\'image sélectionnée (" + tmpImgHeight + "px)"); } }; + if ($("#themeHeaderImage").val() === "" && + $("#themeHeaderHeight option").length === 6 ) { + $("#themeHeaderHeight option:eq(0)").remove(); + } + tmpImg.src= "" + "site/file/source/" + $("#themeHeaderImage").val(); // Import des polices de caractères diff --git a/core/module/theme/view/header/header.php b/core/module/theme/view/header/header.php index 93138573..d65a2132 100755 --- a/core/module/theme/view/header/header.php +++ b/core/module/theme/view/header/header.php @@ -55,24 +55,18 @@
-
+
'Répétition', 'selected' => $this->getData(['theme', 'header', 'imageRepeat']) ]); ?>
-
+
'Position', 'selected' => $this->getData(['theme', 'header', 'imagePosition']) ]); ?>
-
- 'Adaptation', - 'selected' => $this->getData(['theme', 'header', 'imageContainer']) - ]); ?> -
@@ -98,20 +92,29 @@

Configuration

-
+
'Position', 'selected' => $this->getData(['theme', 'header', 'position']) ]); ?>
-
+
+ 'Adaptation', + 'selected' => $this->getData(['theme', 'header', 'imageContainer']), + 'help' => 'Les modes responsives permettent de conserver des dimensions proportionnelles.
+ Cover pour une image plus grande que la bannière, Contain pour une image plus petite. + Les modes Auto et Etiré ne provoquent pas de modification de la hauteur de la bannière.' + ]); ?> +
+
'Hauteur', + 'label' => 'Hauteur maximale', 'selected' => $this->getData(['theme', 'header', 'height']), - 'help' => "Quelque soit la taille de la bannière, la hauteur maximale autorisée est de 600 pixels." + 'help' => 'La hauteur maximale est de 600 pixels, même si les dimensions de l\'image sélectionnée sont supérieures.
Lorsque l\'adaptation est positionnée sur Responsive, la hauteur diminue proportionnellement à la largeur.' ]); ?>
-
+
'Alignement du contenu', 'selected' => $this->getData(['theme', 'header', 'textAlign'])