Amélioration aperçu mnu vs header

This commit is contained in:
fredtempez 2019-01-22 13:46:35 +01:00
parent ec1d7807dd
commit c946a07369
4 changed files with 46 additions and 10 deletions

View File

@ -18,12 +18,12 @@
<?php $layout->showStyle(); ?>
<?php $layout->showBar(); ?>
<?php $layout->showNotification(); ?>
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-first' || $this->getData(['theme', 'menu', 'position']) === 'body-top' ): ?>
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-first' || $this->getData(['theme', 'menu', 'position']) === 'top' ): ?>
<!-- Menu dans le fond du site avant la bannière -->
<nav>
<div id="toggle"><?php echo template::ico('menu'); ?></div>
<div id="menu" class="
<?php if($this->getData(['theme', 'menu', 'position']) === 'body-top'){echo 'container-large';}else{echo'container';}
<?php if($this->getData(['theme', 'menu', 'position']) === 'top'){echo 'container-large';}else{echo'container';}
?>">
<?php $layout->showMenu(); ?>

View File

@ -136,14 +136,14 @@ class theme extends common {
public static $menuPositionsSite = [
'site-first' => 'Dans le site avant la bannière',
'site-second' => 'Dans le site après la bannière',
'body-top' => 'Au-dessus et en-dehors du site',
'top' => 'Au-dessus et en-dehors du site',
'hide' => 'Caché'
];
public static $menuPositionsBody = [
'body-first' => 'Au dessus du site avant la bannière',
'body-second' => 'Au dessus du site après la bannière',
'body-top' => 'Au-dessus et en-dehors du site',
'top' => 'Au-dessus et en-dehors du site',
'hide' => 'Caché'
];
@ -317,7 +317,39 @@ class theme extends common {
'linkHome' => $this->getInput('themeHeaderlinkHome',helper::FILTER_BOOLEAN),
'imageContainer' => $this->getInput('themeHeaderImageContainer')
]]);
// Modification de la position du menu selon la position de la bannière
switch ($this->getInput('themeHeaderPosition')) {
case 'site' :
$this->setData(['theme', 'menu',
['position' => str_replace ('site','body',$this->getData(['theme','menu','position'])) ],
'backgroundColor' => $this->getData('themeMenuBackgroundColor'),
'font' => $this->getData('themeMenuFont'),
'fontSize' => $this->getData('themeMenuFontSize'),
'fontWeight' => $this->getData('themeMenuFontWeight'),
'height' => $this->getData('themeMenuHeight'),
'loginLink' => $this->getData('themeMenuLoginLink'),
'margin' => $this->getData('themeMenuMargin', helper::FILTER_BOOLEAN),
'textAlign' => $this->getData('themeMenuTextAlign'),
'textColor' => $this->getData('themeMenuTextColor'),
'textTransform' => $this->getData('themeMenuTextTransform'),
]);
break;
case 'body' :
$this->setData(['theme', 'menu',
['position' => str_replace ('body','site',$this->getData(['theme','menu','position'])) ],
'backgroundColor' => $this->getData('themeMenuBackgroundColor'),
'font' => $this->getData('themeMenuFont'),
'fontSize' => $this->getData('themeMenuFontSize'),
'fontWeight' => $this->getData('themeMenuFontWeight'),
'height' => $this->getData('themeMenuHeight'),
'loginLink' => $this->getData('themeMenuLoginLink'),
'margin' => $this->getData('themeMenuMargin', helper::FILTER_BOOLEAN),
'textAlign' => $this->getData('themeMenuTextAlign'),
'textColor' => $this->getData('themeMenuTextColor'),
'textTransform' => $this->getData('themeMenuTextTransform'),
]);
break;
}
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées',

View File

@ -77,6 +77,9 @@ $("input, select").on("change", function() {
else {
$("header").show().insertAfter("#bar");
}
if(<?php echo json_encode($this->getData(['theme', 'menu', 'position']) === 'top'); ?>) {
$("header").show().insertAfter("nav");
}
break;
}
// Ajout du css au DOM

View File

@ -49,6 +49,7 @@ $("input, select").on("change", function() {
.attr("id", "themePreview")
.text(css)
.appendTo("head");
// Position du menu
switch($("#themeMenuPosition").val()) {
case 'hide':
@ -70,11 +71,6 @@ $("input, select").on("change", function() {
$("#menu").removeClass('container-large');
$("#menu").addClass('container');
break;
case 'body-top':
$("nav").show().insertAfter("#bar");
$("#menu").removeClass('container');
$("#menu").addClass('container-large');
break;
case 'body-second':
if(<?php echo json_encode($this->getData(['theme', 'header', 'position']) === 'body'); ?>) {
$("nav").show().insertAfter("header");
@ -83,6 +79,11 @@ $("input, select").on("change", function() {
$("nav").show().insertAfter("#bar");
}
break;
case 'top':
$("nav").show().insertAfter("#bar");
$("#menu").removeClass('container');
$("#menu").addClass('container-large');
break;
}
});
// Lien de connexion (addClass() et removeClass() au lieu de hide() et show() car ils ne conservent pas le display-inline: block; de #themeMenuLoginLink)