Améliorations menu et menu burger
This commit is contained in:
parent
ae1cec427c
commit
9706ac64e4
|
@ -598,15 +598,12 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
/* Affichage / masquage des items du sous-menu
|
/* En petit écran, affichage / masquage des items du sous-menu
|
||||||
* après appui sur l'icône plus / minus
|
* ou signalisation que la page est désactivée par ouverture du sous-menu
|
||||||
* substitution des icônes down, plus, minus
|
|
||||||
*/
|
*/
|
||||||
$(window).on("resize", function() {
|
$(window).on("resize", function() {
|
||||||
if($(window).width() < 800) {
|
if($(window).width() < 800) {
|
||||||
$("nav #menu ul li span").click(function() {
|
function displaySubPages( parentId ){
|
||||||
// id de la page parent
|
|
||||||
var parentId = $(this).parents().attr("id");
|
|
||||||
var select = "ul#_"+parentId+".navSub";
|
var select = "ul#_"+parentId+".navSub";
|
||||||
var select2 = 'nav #menu ul li #' + parentId + ' span.iconSubExistSmallScreen';
|
var select2 = 'nav #menu ul li #' + parentId + ' span.iconSubExistSmallScreen';
|
||||||
if( $(select).css("z-index") === "-1" ) {
|
if( $(select).css("z-index") === "-1" ) {
|
||||||
|
@ -621,6 +618,16 @@ $(document).ready(function(){
|
||||||
$(select).css("position","absolute");
|
$(select).css("position","absolute");
|
||||||
$(select2).removeClass('zwiico-minus').addClass('zwiico-plus');
|
$(select2).removeClass('zwiico-minus').addClass('zwiico-plus');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$("nav #menu ul li span").click(function() {
|
||||||
|
// id de la page parent
|
||||||
|
var parentId = $(this).parents().attr("id");
|
||||||
|
displaySubPages( parentId);
|
||||||
|
});
|
||||||
|
$("nav #menu a.disabled-link").click(function() {
|
||||||
|
// id de la page parent
|
||||||
|
var parentId = $(this).parents().parents().attr("id");
|
||||||
|
displaySubPages( parentId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).trigger("resize");
|
}).trigger("resize");
|
||||||
|
@ -634,15 +641,4 @@ $(document).ready(function(){
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signalisation qu'une page est désactivée en petit écran
|
|
||||||
* pour la page ou la sous-page cliquée
|
|
||||||
*/
|
|
||||||
if($(window).width() < 800) {
|
|
||||||
$("nav #menu a.disabled-link").click(function() {
|
|
||||||
var parentIdSubPage = $(this).parents("ul").attr("id");
|
|
||||||
var parentIdPage = $(this).parents().parents().attr("id");
|
|
||||||
$("nav #menu ul li ul li #"+parentIdSubPage+" .linkDisabledSmallScreen").css("display","inline");
|
|
||||||
$("nav #menu ul li #"+parentIdPage+" .linkDisabledSmallScreen").css("display","inline");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1767,6 +1767,8 @@ class common {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu" <?php echo $menuClass; ?> > <?php
|
<div id="menu" <?php echo $menuClass; ?> > <?php
|
||||||
|
// Groupe du client connecté (1, 2, 3, 4) ou non connecté (0)
|
||||||
|
$groupUser = $this->getUser('group') === false ? 0 : $this->getUser('group');
|
||||||
// Met en forme les items du menu
|
// Met en forme les items du menu
|
||||||
$itemsLeft = '';
|
$itemsLeft = '';
|
||||||
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
|
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
|
||||||
|
@ -1778,8 +1780,7 @@ class common {
|
||||||
// Propriétés de l'item
|
// Propriétés de l'item
|
||||||
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
|
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
|
||||||
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
|
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
|
||||||
// Cas où les pages enfants enfant sont toutes masquées dans le menu
|
// Cas où les pages enfants enfant sont toutes desactivées dans le menu, ne pas afficher de symbole lorsqu'il n'y a rien à afficher et que le client est < éditeur
|
||||||
// ne pas afficher de symbole lorsqu'il n'y a rien à afficher
|
|
||||||
$totalChild = 0;
|
$totalChild = 0;
|
||||||
$disableChild = 0;
|
$disableChild = 0;
|
||||||
foreach($childrenPageIds as $childKey) {
|
foreach($childrenPageIds as $childKey) {
|
||||||
|
@ -1788,17 +1789,22 @@ class common {
|
||||||
}
|
}
|
||||||
$iconSubExistLargeScreen='';
|
$iconSubExistLargeScreen='';
|
||||||
$iconSubExistSmallScreen='';
|
$iconSubExistSmallScreen='';
|
||||||
if($childrenPageIds && $disableChild !== $totalChild && $this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
|
if($childrenPageIds && ( $disableChild !== $totalChild || $groupUser >= 2 ) && $this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
|
||||||
$iconSubExistLargeScreen= '<span class="zwiico-down iconSubExistLargeScreen" style="font-size:1em"><!----></span>';
|
$iconSubExistLargeScreen= '<span class="zwiico-down iconSubExistLargeScreen" style="font-size:1em"><!----></span>';
|
||||||
$iconSubExistSmallScreen= '<span class="zwiico-plus zwiico-margin-left iconSubExistSmallScreen" style="font-size:1em"><!----></span>';
|
$iconSubExistSmallScreen= '<span class="zwiico-plus zwiico-margin-left iconSubExistSmallScreen" style="font-size:1em"><!----></span>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Si la page est désactivée et sans sous-page active et client < éditeur => elle n'est pas affichée
|
||||||
|
if ( $this->getData(['page',$parentPageId,'disable']) && (empty($childrenPageIds) || $disableChild === $totalChild) && $groupUser < 2){
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
// Mise en page de l'item
|
// Mise en page de l'item
|
||||||
$itemsLeft .= '<li>';
|
$itemsLeft .= '<li>';
|
||||||
$pageDesactived = false;
|
$pageDesactived = false;
|
||||||
if ( ( $this->getData(['page',$parentPageId,'disable']) === true AND $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD'))
|
/*if ( ( $this->getData(['page',$parentPageId,'disable']) === true AND $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD'))
|
||||||
OR ( $this->getData(['page',$parentPageId,'disable']) === true AND $this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD')AND $this->getUser('group') < self::GROUP_EDITOR ))
|
OR ( $this->getData(['page',$parentPageId,'disable']) === true AND $this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD')AND $this->getUser('group') < self::GROUP_EDITOR ))
|
||||||
{
|
{*/
|
||||||
|
if ( $this->getData(['page',$parentPageId,'disable']) === true && $groupUser < 2 ){
|
||||||
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
||||||
$itemsLeft .= '<div id="'.$parentPageId.'" class="box" style="display:flex; align-items:center;"><div><a class="A ' . $active . $parentPageId . ' disabled-link">';
|
$itemsLeft .= '<div id="'.$parentPageId.'" class="box" style="display:flex; align-items:center;"><div><a class="A ' . $active . $parentPageId . ' disabled-link">';
|
||||||
$pageDesactived = true;
|
$pageDesactived = true;
|
||||||
|
@ -1830,14 +1836,11 @@ class common {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$fileIcon = './site/file/source/icones/disabledPage.gif';
|
|
||||||
if( file_exists($fileIcon) && $pageDesactived) $itemsLeft .='<span class="linkDisabledSmallScreen" style="font-size:1em"><img src="'. $fileIcon .'" style="height:15px; width:auto;" alt=""></span>';
|
|
||||||
$itemsLeft .= $iconSubExistLargeScreen;
|
$itemsLeft .= $iconSubExistLargeScreen;
|
||||||
$itemsLeft .= '</a>';
|
$itemsLeft .= '</a>';
|
||||||
$itemsLeft .= '</div>';
|
$itemsLeft .= '</div>';
|
||||||
$itemsLeft .= $iconSubExistSmallScreen;
|
$itemsLeft .= $iconSubExistSmallScreen;
|
||||||
$itemsLeft .= '</div>';
|
$itemsLeft .= '</div>';
|
||||||
|
|
||||||
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
|
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
|
||||||
empty($childrenPageIds)) {
|
empty($childrenPageIds)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1847,17 +1850,14 @@ class common {
|
||||||
// Propriétés de l'item
|
// Propriétés de l'item
|
||||||
$active = ($childKey === $currentPageId) ? 'active ' : '';
|
$active = ($childKey === $currentPageId) ? 'active ' : '';
|
||||||
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
|
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
|
||||||
|
//Si la sous-page est désactivée et que le client est < éditeur on ne l'affiche pas
|
||||||
|
if( $this->getData(['page',$childKey,'disable']) === true && $groupUser < 2 ){
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
// Mise en page du sous-item
|
// Mise en page du sous-item
|
||||||
$itemsLeft .= '<li>';
|
$itemsLeft .= '<li>';
|
||||||
$pageDesactived = false;
|
$pageDesactived = false;
|
||||||
if ( ( $this->getData(['page',$childKey,'disable']) === true
|
if ( $this->getData(['page',$childKey,'disable']) === true && $groupUser < 2 ){
|
||||||
AND $this->getUser('password') !== $this->getInput('DELTA_USER_PASSWORD')
|
|
||||||
) OR (
|
|
||||||
$this->getData(['page',$childKey,'disable']) === true
|
|
||||||
AND $this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD')
|
|
||||||
AND $this->getUser('group') < self::GROUP_EDITOR
|
|
||||||
)
|
|
||||||
){
|
|
||||||
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
|
||||||
$itemsLeft .= '<a class="disabled-link">';
|
$itemsLeft .= '<a class="disabled-link">';
|
||||||
$pageDesactived = true;
|
$pageDesactived = true;
|
||||||
|
@ -1896,12 +1896,12 @@ class common {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$fileIcon = './site/file/source/icones/disabledPage.gif';
|
|
||||||
if( file_exists($fileIcon) && $pageDesactived) $itemsLeft .='<span class="linkDisabledSmallScreen" style="font-size:1em"><img src="'. $fileIcon .'" style="height:15px; width:auto;" alt=""></span>';
|
|
||||||
$itemsLeft .= '</a></li>';
|
$itemsLeft .= '</a></li>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$itemsLeft .= '</ul>';
|
$itemsLeft .= '</ul>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Lien de connexion
|
// Lien de connexion
|
||||||
$itemsRight = '';
|
$itemsRight = '';
|
||||||
$spaceMenu = '<li id="menuSpace"> </li>';
|
$spaceMenu = '<li id="menuSpace"> </li>';
|
||||||
|
|
|
@ -46,9 +46,6 @@
|
||||||
nav .iconSubExistSmallScreen{
|
nav .iconSubExistSmallScreen{
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
nav .linkDisabledSmallScreen{
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
/* Corps */
|
/* Corps */
|
||||||
section {
|
section {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
@ -194,9 +191,8 @@
|
||||||
nav .iconSubExistSmallScreen{
|
nav .iconSubExistSmallScreen{
|
||||||
display:inline;
|
display:inline;
|
||||||
}
|
}
|
||||||
nav .linkDisabledSmallScreen{
|
nav a.disabled-link{
|
||||||
display:none;
|
font-style:italic;
|
||||||
margin-left:20px;
|
|
||||||
}
|
}
|
||||||
/*bandeau flex*/
|
/*bandeau flex*/
|
||||||
nav #toggle {
|
nav #toggle {
|
||||||
|
|
Loading…
Reference in New Issue