Merge branch 'master' into dev10

This commit is contained in:
fredtempez 2019-11-11 20:43:48 +01:00
commit 4ea76eb239
6 changed files with 66 additions and 54 deletions

View File

@ -316,6 +316,7 @@ core.start = function() {
core.noticeAdd(_this.attr("id"), "Format incorrect");
}
});
/**
* Iframes et vidéos responsives
*/
@ -338,7 +339,25 @@ core.start = function() {
});
}).trigger("resize");
/*
* Header responsive
*/
$(window).on("resize", function() {
var responsive = "<?php echo $this->getdata(['theme','header','imageContainer']);?>";
if (responsive === "cover" || responsive === "contain" ) {
var widthpx = "<?php echo $this->getdata(['theme','site','width']);?>";
var width = widthpx.substr(0,widthpx.length-2);
var heightpx = "<?php echo $this->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();
/**

View File

@ -1286,22 +1286,9 @@ class core extends common {
$css .= 'header{background-size:' . $this->getData(['theme','header','imageContainer']).'}';
$css .= 'header{background-color:' . $colors['normal'];
// Valeur de hauteur traditionnelle
$css .= ';height:' . $this->getData(['theme', 'header', 'height']) . ';line-height:' . $this->getData(['theme', 'header', 'height']) ;
if ($this->getData(['theme', 'header', 'height']) === 'none') {
// Controle de l'existence du fichier
if (file_exists(self::FILE_DIR.'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(self::FILE_DIR.'source/'.$this->getData(['theme','header','image']));
$css .= ';height: 0; padding-top:';
$css .= ( $sizes[1] / $sizes[0] )* 100;
$css .= '%';
}
} else {
// Valeur de hauteur traditionnelle
$css .= ';height:' . $this->getData(['theme', 'header', 'height']) . ';line-height:' . $this->getData(['theme', 'header', 'height']) ;
}
$css .= ';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']) . '}';

View File

@ -57,19 +57,17 @@
<?php
if ($this->getData(['theme','header','linkHomePage'])){
echo "<a href='" . helper::baseUrl(false) . "'>" ;} ?>
<div id="headerContainer" class="container">
<?php if(
$this->getData(['theme', 'header', 'textHide']) === false
// Affiche toujours le titre de la bannière pour l'édition du thème
OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header')
): ?>
<div class="container">
<span id="themeHeaderTitle"><?php echo $this->getData(['config', 'title']); ?></span>
</div> <!--fin container -->
<?php else: ?>
<div class="container">
<span id="themeHeaderTitle">&nbsp;</span>
</div> <!--fin container -->
<?php endif; ?>
</div> <!--fin container -->>
<?php
if ($this->getData(['theme','header','linkHomePage'])){echo "</a>";}
?>
@ -129,19 +127,17 @@
if ($this->getData(['theme','header','linkHomePage'])){
echo "<a href='" . helper::baseUrl(false) . "'>" ;} ?>
<header <?php if($this->getData(['theme', 'header', 'position']) === 'hide'): ?>class="displayNone"<?php endif; ?>>
<?php if(
$this->getData(['theme', 'header', 'textHide']) === false
// Affiche toujours le titre de la bannière pour l'édition du thème
OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header')
): ?>
<div class="container">
<span id="themeHeaderTitle"><?php echo $this->getData(['config', 'title']); ?></span>
</div>
<?php else: ?>
<div class="container">
<span id="themeHeaderTitle">&nbsp;</span>
</div> <!--fin container -->
<?php endif; ?>
<div id="headerContainer" class="container">
<?php if(
$this->getData(['theme', 'header', 'textHide']) === false
// Affiche toujours le titre de la bannière pour l'édition du thème
OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header')
): ?>
<span id="themeHeaderTitle"><?php echo $this->getData(['config', 'title']); ?></span>
<?php else: ?>
<span id="themeHeaderTitle">&nbsp;</span>
<?php endif; ?>
</div> <!--fin container -->
</header>
<?php
if ($this->getData(['theme','header','linkHomePage'])){echo "</a>";} ?>

View File

@ -221,8 +221,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 = [

View File

@ -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").not("#barSelectLanguage").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('<option selected="selected" value="0"> Hauteur de l\'image sélectionnée </option>');
}
}
// 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= "<?php echo helper::baseUrl(false); ?>" + "site/file/source/" + $("#themeHeaderImage").val();
// Import des polices de caractères

View File

@ -55,24 +55,18 @@
</div>
<div id="themeHeaderImageOptions" class="displayNone">
<div class="row">
<div class="col4">
<div class="col6">
<?php echo template::select('themeHeaderImageRepeat', $module::$repeats, [
'label' => 'Répétition',
'selected' => $this->getData(['theme', 'header', 'imageRepeat'])
]); ?>
</div>
<div class="col4">
<div class="col6">
<?php echo template::select('themeHeaderImagePosition', $module::$imagePositions, [
'label' => 'Position',
'selected' => $this->getData(['theme', 'header', 'imagePosition'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderImageContainer', $module::$headerWide, [
'label' => 'Adaptation',
'selected' => $this->getData(['theme', 'header', 'imageContainer'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
@ -98,20 +92,29 @@
<div class="block">
<h4>Configuration</h4>
<div class="row">
<div class="col4">
<div class="col3">
<?php echo template::select('themeHeaderPosition', $module::$headerPositions, [
'label' => 'Position',
'selected' => $this->getData(['theme', 'header', 'position'])
]); ?>
</div>
<div class="col4">
<div class="col3">
<?php echo template::select('themeHeaderImageContainer', $module::$headerWide, [
'label' => 'Adaptation',
'selected' => $this->getData(['theme', 'header', 'imageContainer']),
'help' => 'Les modes responsives permettent de conserver des dimensions proportionnelles.<br />
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.'
]); ?>
</div>
<div class="col3">
<?php echo template::select('themeHeaderHeight', $module::$headerHeights, [
'label' => '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. <br />Lorsque l\'adaptation est positionnée sur Responsive, la hauteur diminue proportionnellement à la largeur.'
]); ?>
</div>
<div class="col4">
<div class="col3">
<?php echo template::select('themeHeaderTextAlign', $module::$aligns, [
'label' => 'Alignement du contenu',
'selected' => $this->getData(['theme', 'header', 'textAlign'])