Browse Source

nouvelles options menu burger

master
SylvainLelievre 8 months ago
parent
commit
52d5c7a38e
  1. 22
      core/layout/main.php
  2. 9
      core/module/theme/theme.php
  3. 15
      core/module/theme/view/menu/menu.js.php
  4. 26
      core/module/theme/view/menu/menu.php

22
core/layout/main.php

@ -44,9 +44,12 @@
?>
<!-- Menu Burger -->
<div id="toggle">
<?php if ($this->getData(['theme','menu','burgerTitle']) === true ): ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'title' ): ?>
<div class="notranslate" id="burgerText"><?php echo $this->getData(['locale', 'title']);?></div>
<?php endif; ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'logo' ): ?>
<div class="notranslate" id="burgerLogo"><?php echo '<img src="'.helper::baseUrl(0).self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'logoBurger']).'">';?></div>
<?php endif; ?>
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<div id="menu" class="
<?php if($this->getData(['theme', 'menu', 'position']) === 'top'){echo 'container-large';}else{echo'container';}
@ -83,9 +86,12 @@
<!-- Menu dans le fond du site après la bannière -->
<nav>
<div id="toggle">
<?php if ($this->getData(['theme','menu','burgerTitle']) === true ): ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'title' ): ?>
<div class="notranslate" id="burgerText"><?php echo $this->getData(['locale', 'title']);?></div>
<?php endif; ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'logo' ): ?>
<div class="notranslate" id="burgerLogo"><?php echo '<img src="'.helper::baseUrl(0).self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'logoBurger']).'">';?></div>
<?php endif; ?>
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<div id="menu" class="container"><?php $this->showMenu(); ?></div>
</nav>
@ -96,9 +102,12 @@
<!-- Menu dans le site avant la bannière -->
<nav>
<div id="toggle">
<?php if ($this->getData(['theme','menu','burgerTitle']) === true ): ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'title' ): ?>
<div class="notranslate" id="burgerText"><?php echo $this->getData(['locale', 'title']);?></div>
<?php endif; ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'logo' ): ?>
<div class="notranslate" id="burgerLogo"><?php echo '<img src="'.helper::baseUrl(0).self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'logoBurger']).'">';?></div>
<?php endif; ?>
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<div id="menu" class="container"><?php $this->showMenu(); ?></div>
</nav>
@ -145,9 +154,12 @@
<!-- Menu dans le site après la bannière -->
<nav <?php if($this->getData(['theme', 'menu', 'position']) === 'hide'): ?>class="displayNone"<?php endif; ?>>
<div id="toggle">
<?php if ($this->getData(['theme','menu','burgerTitle']) === true ): ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'title' ): ?>
<div class="notranslate" id="burgerText"><?php echo $this->getData(['locale', 'title']);?></div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->getData(['theme','menu','burgerContent']) === 'logo' ): ?>
<div class="notranslate" id="burgerLogo"><?php echo '<img src="'.helper::baseUrl(0).self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'logoBurger']).'">';?></div>
<?php endif; ?>
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<div id="menu" class="container"><?php $this->showMenu(); ?></div>
</nav>

9
core/module/theme/theme.php

@ -239,6 +239,11 @@ class theme extends common {
'3' => 'Trois colonnes : 1/3 - 1/3 - 1/3',
'4' => 'Trois lignes superposées'
];
public static $burgerContent = [
'no' => 'Aucun',
'title' => 'Titre du site',
'logo' => 'Logo du site'
];
// Variable pour construire la liste des pages du site
public static $pagesList = [];
@ -511,7 +516,9 @@ class theme extends common {
'activeTextColor' => $this->getInput('themeMenuActiveTextColor'),
'radius' => $this->getInput('themeMenuRadius'),
'burgerTitle' => $this->getInput('themeMenuBurgerTitle', helper::FILTER_BOOLEAN),
'memberBar' => $this->getInput('themeMenuMemberBar', helper::FILTER_BOOLEAN)
'memberBar' => $this->getInput('themeMenuMemberBar', helper::FILTER_BOOLEAN),
'logoBurger' => $this->getInput('themeMenuLogoBurger'),
'burgerContent' => $this->getInput('themeMenuBurgerContent')
]]);
// Valeurs en sortie
$this->addOutput([

15
core/module/theme/view/menu/menu.js.php

@ -79,7 +79,7 @@ $("input, select").on("change", function() {
) {
css += 'nav{padding:0 10px;}';
}
// Position du menu
switch($("#themeMenuPosition").val()) {
case 'hide':
@ -173,4 +173,15 @@ $("#themeMenuActiveColorAuto").on("change", function() {
} else {
$("#themeMenuActiveColorWrapper").slideDown();
}
}).trigger("change");
}).trigger("change");
// Affiche / Cache la sélection du logo pour le menu burger
$("#themeMenuBurgerContent").on("change", function() {
console.log( $(this).val());
if($(this).val() === 'logo') {
$("#themeMenuLogoBurgerId").slideDown();
}
else {
$("#themeMenuLogoBurgerId").slideUp();
}
}).trigger("select");

26
core/module/theme/view/menu/menu.php

@ -176,24 +176,38 @@
<div class="block">
<h4>Contenus</h4>
<div class="row">
<div class="col4">
<div class="col3">
<?php echo template::checkbox('themeMenuLoginLink', true, 'Lien de connexion', [
'checked' => $this->getData(['theme', 'menu', 'loginLink'])
]); ?>
</div>
<div class="col4">
<div class="col3">
<?php echo template::checkbox('themeMenuMemberBar', true, 'Barre de membre', [
'checked' => $this->getData(['theme', 'menu', 'memberBar']),
'help' => 'Icônes de gestion de compte et de déconnexion. Uniquement pour les membres connectés'
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('themeMenuBurgerTitle', true, 'Titre du site dans le menu réduit', [
'checked' => $this->getData(['theme', 'menu', 'burgerTitle']),
</div>
<div class="col6">
<?php echo template::select('themeMenuBurgerContent', $module::$burgerContent, [
'label' => 'Affichage dans le menu burger',
'selected' => $this->getData(['theme', 'menu', 'burgerContent']),
'help' => 'Le menu burger remplace le menu complet lorsque la largeur de l\'écran n\'est pas suffisante.'
]); ?>
</div>
</div>
<div class="row">
<div id="themeMenuLogoBurgerId" class="col6 offset6 <?php if( $this->getData(['theme', 'menu', 'burgerContent']) !== 'logo') echo 'displayNone';?>">
<?php
$imageFile = file_exists(self::FILE_DIR.'source/'.$this->getData(['theme', 'menu', 'logoBurger'])) ?
$this->getData(['theme', 'menu', 'logoBurger']) : "";
echo template::file('themeMenuLogoBurger', [
'help' => 'Sélectionner une image de dimensions adaptées',
'label' => 'Logo du menu burger',
'type' => 1,
'value' => $imageFile
]); ?>
</div>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save