[9.1.00] full responsive banner

This commit is contained in:
fredtempez 2019-05-06 21:53:00 +02:00
parent 14fc0eee59
commit 41a9f603d2
5 changed files with 81 additions and 50 deletions

View File

@ -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"' : '') .
'><wbr>&nbsp;|&nbsp;<a href="' . helper::baseUrl() . 'user/login/' .
strip_tags(str_replace('/', '_', $this->getUrl())) .
'" data-tippy-content="Connexion à l\'administration" >Connexion</a></span>';
'" data-tippy-content="Connexion à l\'administration" rel="noindex, nofollow">Connexion</a></span>';
}
$items .= '</span></div>';
echo $items;

View File

@ -38,7 +38,6 @@ body {
}
header {
margin:0px 0px !important;
background-size: cover !important;
}
}

View File

@ -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'
];

View File

@ -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() {

View File

@ -78,6 +78,48 @@
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Configuration</h4>
<div class="row">
<div class="col4">
<?php echo template::select('themeHeaderPosition', $module::$headerPositions, [
'label' => 'Position',
'selected' => $this->getData(['theme', 'header', 'position'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderHeight', $module::$headerHeights, [
'label' => '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.'
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderTextAlign', $module::$aligns, [
'label' => 'Alignement du contenu',
'selected' => $this->getData(['theme', 'header', 'textAlign'])
]); ?>
</div>
</div>
<div id="themeHeaderShow" class="displayNone">
<?php echo template::checkbox('themeHeaderlinkHome', true, 'Bannière cliquable', [
'checked' => $this->getData(['theme', 'header', 'linkHome'])
]); ?>
</div>
<div id="themeHeaderPositionOptions" class="displayNone">
<?php echo template::checkbox('themeHeaderMargin', true, 'Aligner la bannière avec le contenu', [
'checked' => $this->getData(['theme', 'header', 'margin'])
]); ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
@ -112,46 +154,4 @@
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Configuration</h4>
<div class="row">
<div class="col4">
<?php echo template::select('themeHeaderPosition', $module::$headerPositions, [
'label' => 'Position',
'selected' => $this->getData(['theme', 'header', 'position'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderHeight', $module::$headerHeights, [
'label' => 'Hauteur',
'selected' => $this->getData(['theme', 'header', 'height'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('themeHeaderTextAlign', $module::$aligns, [
'label' => 'Alignement du contenu',
'selected' => $this->getData(['theme', 'header', 'textAlign'])
]); ?>
</div>
</div>
<!-- menu image -->
<div id="themeHeaderShow" class="displayNone">
<?php echo template::checkbox('themeHeaderlinkHome', true, 'Bannière cliquable', [
'checked' => $this->getData(['theme', 'header', 'linkHome'])
]); ?>
</div>
<!-- menu image -->
<div id="themeHeaderPositionOptions" class="displayNone">
<?php echo template::checkbox('themeHeaderMargin', true, 'Aligner la bannière avec le contenu', [
'checked' => $this->getData(['theme', 'header', 'margin'])
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>