Skip to content
Code-Schnipsel Gruppen Projekte
Commit 21805017 erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

Merge branch 'dev'

Übergeordnete c317176d 4af5e8b1
No related branches found
No related tags found
2 Merge Requests!19Dev,!18Feat menu manager improvement
......@@ -33,6 +33,15 @@
var="menu.control.sidebarDropDownMenu.setting.startId"/>
</setting>
<setting name="menuId" data-qui="package/quiqqer/menu/bin/Controls/Independent/Input" type="text">
<locale group="quiqqer/menu"
var="menu.control.sidebarDropDownMenu.setting.menuId"/>
<description>
<locale group="quiqqer/menu"
var="menu.control.sidebarDropDownMenu.setting.menuId.desc"/>
</description>
</setting>
<setting name="parentLink" type="checkbox">
<locale group="quiqqer/menu"
var="menu.control.sidebarDropDownMenu.setting.parentLink"/>
......
......@@ -79,10 +79,18 @@
<pl><![CDATA[Zaawansowany]]></pl>
</locale>
<locale name="menu.control.sidebarDropDownMenu.setting.startId">
<de><![CDATA[Start-ID]]></de>
<de><![CDATA[Start-ID uu]]></de>
<en><![CDATA[Start ID]]></en>
<pl><![CDATA[Pierwsza strona]]></pl>
</locale>
<locale name="menu.control.sidebarDropDownMenu.setting.menuId">
<de><![CDATA[Menu auswählen]]></de>
<en><![CDATA[Select the menu]]></en>
</locale>
<locale name="menu.control.sidebarDropDownMenu.setting.menuId.desc">
<de><![CDATA[Diese Option ermöglicht, eigenes Menü auszuwählen. <strong>Wichtig!</strong> Diese Option hat Vorrang. Wird ein eigenes Menü ausgewählt, hat die Option "Start-ID" keine Auswirkung mehr.]]></de>
<en><![CDATA[This option allows you to choose your own menu. <strong>Important!</strong> This option takes precedence. If a custom menu is selected, the "Start ID" option has no effect anymore.]]></en>
</locale>
<locale name="menu.control.sidebarDropDownMenu.setting.parentLink">
<de><![CDATA[Eltern-Seite Link anzeigen]]></de>
<en><![CDATA[Show the parent site link]]></en>
......
.quiqqer-sidebar-dropdown-navigation ul,
.quiqqer-sidebar-dropdown-navigation ul li {
list-style: none;
padding-left: 0;
}
.quiqqer-navigation-entry {
align-items: flex-start;
display: flex !important;
flex-direction: row;
justify-content: space-between;
width: 100%;
padding: 6px 0;
transition: all 0.2s;
}
.quiqqer-navigation-entry-image {
align-items: center;
align-self: stretch;
display: flex;
padding-right: 10px;
width: 30px;
}
.quiqqer-navigation-link {
display: flex;
padding: 4px 0;
flex-grow: 2;
/*width: 100%;*/
}
.quiqqer-sub-nav-div {
overflow: hidden;
height: 0;
}
.quiqqer-fa-levels-icon {
cursor: pointer;
}
.quiqqer-fa-list-icon,
.quiqqer-fa-levels-icon,
.quiqqer-fa-list-icon::before,
.quiqqer-fa-levels-icon::before {
margin: auto;
}
.quiqqer-fa-list-icon {
margin-left: 6px;
margin-right: 6px;
}
/* site icon */
.quiqqer-sidebar-dropdown-navigation .quiqqer-icon {
line-height: 1.5em;
margin: 0 6px 0 0;
padding: 4px 0;
}
.quiqqer-sidebar-dropdown-navigation .fa-nav-levels-rotate {
transform: rotate(90deg);
}
.quiqqer-sidebar-dropdown-navigation .quiqqer-fa-list-icon {
padding: 4px 0;
line-height: 1.5em;
margin: 0 6px 0 0;
transition: all 0.2s ease;
}
/* nav toggle */
.quiqqer-navigation-close {
display: none;
}
ul.quiqqer-navigation-level-2 .quiqqer-navigation-entry {
margin-left: 20px;
width: calc(100% - 20px);
}
ul.quiqqer-navigation-level-3 .quiqqer-navigation-entry {
margin-left: 40px;
width: calc(100% - 40px);
}
ul.quiqqer-navigation-level-4 .quiqqer-navigation-entry {
margin-left: 60px;
width: calc(100% - 60px);
}
{if !isset($level)}
{assign var=level value=1}
{else}
{assign var=level value=$level+1}
{/if}
{if $level == 1}
{if $this->getAttribute('showTitle') && $this->getAttribute('frontendTitle')}
<header class="control-header">
<h1>{$this->getAttribute('frontendTitle')}</h1>
</header>
{/if}
{if $this->getAttribute('content') != ""}
<div class="control-content">
{$this->getAttribute('content')}
</div>
{/if}
{/if}
{strip}
{if count( $children )}
<ul class="quiqqer-navigation-level-{$level}">
{*if $parentLink}
{if $level == 1}
<li class="quiqqer-navigation-li">
<div class="quiqqer-navigation-entry">
{if $parentIcon}
<i class="fa quiqqer-fa-list-icon fa-fw {$parentIcon}"></i>
{/if}
<a href="{url site=$FirstPage}" class="quiqqer-navigation-firstpage quiqqer-navigation-link">
{$FirstPage->getAttribute('title')}
</a>
</div>
</li>
{/if}
{/if*}
{foreach from=$children item=Child}
{assign var=siteObj value=0}
{if $Child|get_class === 'QUI\Menu\Independent\Items\Site'}
{assign var=siteObj value=1}
{/if}
<li class="quiqqer-navigation-li">
{assign var=subnavigation value=$Child->getChildren()}
<div class="quiqqer-navigation-entry">
{if count ( $subnavigation ) && ($level < $levels || $levels == 0)}
{if $levelIcon}
<span class="fa quiqqer-fa-list-icon fa-fw {$levelIcon} quiqqer-fa-levels-icon"></span>
{/if}
{else}
{if $listIcon}
<i class="fa quiqqer-fa-list-icon fa-fw {$listIcon}"></i>
{/if}
{/if}
{if $Child->getUrl()}
<a href="{$Child->getUrl()}" class="quiqqer-navigation-link
{if !count($subnavigation)} quiqqer-navigation-link-no-icon{/if}"
title="{$Child->getTitleAttribute()|escape:'html'}"
{if $Child->getTarget()}target="{$Child->getTarget()}"{/if}>
{$Child->getTitle()}
</a>
{else}
<span class="quiqqer-navigation-link {if !count($subnavigation)} quiqqer-navigation-link-no-icon{/if}"
title="{$Child->getTitleAttribute()|escape:'html'}">
{$Child->getTitle()}
</span>
{/if}
</div>
{if $levels === false || $levels-1 >= $level}
<div class="quiqqer-sub-nav-div">
{include file=$navTemplate
children=$Child->getChildren()
level=$level
levels=$levels
}
</div>
{/if}
</li>
{/foreach}
</ul>
{/if}
{/strip}
{if $level == 1}
<script>
let QuiIndependentMenu = document.getElement('.quiqqer-sidebar-dropdown-navigation');
let quiIndependentUrls = QuiIndependentMenu.getElements('.quiqqer-navigation-link');
const setPath = function (Elm) {
const Parent = Elm.getParent('.quiqqer-sub-nav-div');
if (!Parent) {
return false;
}
Parent.style.height = 'initial';
const ParentLi = Parent.getParent('.quiqqer-navigation-li');
if (ParentLi) {
ParentLi.classList.add('open');
const Icon = ParentLi.querySelector('.quiqqer-fa-list-icon');
if (Icon) {
Icon.classList.add('fa-nav-levels-rotate');
}
}
setPath(Parent);
}
quiIndependentUrls.forEach((Item) => {
if (window.location.href.includes(Item.href)) {
const LiElm = Item.closest('.quiqqer-navigation-li');
LiElm.classList.add('quiqqer-navigation-active');
setPath(LiElm);
}
});
</script>
{/if}
\ No newline at end of file
......@@ -28,6 +28,11 @@
flex-grow: 2;
/*width: 100%;*/
}
.quiqqer-sub-nav-div {
overflow: hidden;
}
.quiqqer-fa-levels-icon {
cursor: pointer;
}
......@@ -51,16 +56,15 @@
padding: 4px 0;
}
.fa-nav-levels-rotate {
.quiqqer-sidebar-dropdown-navigation .fa-nav-levels-rotate {
transform: rotate(90deg);
transition: all 0.2s;
transition-timing-function: ease-in-out;
}
i.quiqqer-fa-list-icon {
.quiqqer-sidebar-dropdown-navigation .quiqqer-fa-list-icon {
padding: 4px 0;
line-height: 1.5em;
margin: 0 6px 0 0;
transition: all 0.2s ease;
}
/* nav toggle */
......
......@@ -21,11 +21,12 @@ class SidebarDropDownMenu extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = array())
public function __construct($attributes = [])
{
// defaults values
$this->setAttributes(array(
$this->setAttributes([
'startId' => 1, // id or site link
'menuId' => false,
'parentLink' => false,
'levels' => 0,
'onlyFirstLevelIcons' => false,
......@@ -36,7 +37,7 @@ public function __construct($attributes = array())
'qui-class' => 'package/quiqqer/menu/bin/SidebarDropDownMenu',
'display' => 'simple',
'showAllChildren' => false
));
]);
parent::__construct($attributes);
......@@ -92,35 +93,73 @@ public function getBody()
$levels = false;
}
switch ($this->getAttribute('display')) {
default:
case 'simple':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Simple.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Simple.html';
break;
case 'advanced':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Advanced.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Advanced.html';
break;
if ($this->getAttribute('menuId')) {
$IndependentMenu = Independent\Handler::getMenu($this->getAttribute('menuId'));
$children = $IndependentMenu->getChildren();
switch ($this->getAttribute('display')) {
default:
case 'simple':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Independent.Simple.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Independent.Simple.html';
break;
case 'advanced':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Independent.Advanced.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Independent.Advanced.html';
break;
}
$Engine->assign([
'this' => $this,
'children' => $children,
'Project' => $this->getProject(),
'Site' => $Site,
'FirstPage' => $FirstPage,
'listType' => $this->getAttribute('listType'),
'parentLink' => $this->getAttribute('parentLink'),
'activeId' => $activeId,
'navTemplate' => $template,
'levels' => $levels,
'Rewrite' => QUI::getRewrite(),
'parentIcon' => $this->getAttribute('parentIcon'),
'listIcon' => $this->getAttribute('listIcon'),
'levelIcon' => $this->getAttribute('levelIcon'),
'onlyFirstLevelIcons' => $this->getAttribute('onlyFirstLevelIcons')
]);
} else {
switch ($this->getAttribute('display')) {
default:
case 'simple':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Simple.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Simple.html';
break;
case 'advanced':
$css = dirname(__FILE__).'/SidebarDropDownMenu.Advanced.css';
$template = dirname(__FILE__).'/SidebarDropDownMenu.Advanced.html';
break;
}
$Engine->assign([
'this' => $this,
'Project' => $this->getProject(),
'Site' => $Site,
'FirstPage' => $FirstPage,
'listType' => $this->getAttribute('listType'),
'parentLink' => $this->getAttribute('parentLink'),
'activeId' => $activeId,
'navTemplate' => $template,
'levels' => $levels,
'Rewrite' => QUI::getRewrite(),
'parentIcon' => $this->getAttribute('parentIcon'),
'listIcon' => $this->getAttribute('listIcon'),
'levelIcon' => $this->getAttribute('levelIcon'),
'onlyFirstLevelIcons' => $this->getAttribute('onlyFirstLevelIcons')
]);
}
$Engine->assign(array(
'this' => $this,
'Project' => $this->getProject(),
'Site' => $Site,
'FirstPage' => $FirstPage,
'listType' => $this->getAttribute('listType'),
'parentLink' => $this->getAttribute('parentLink'),
'activeId' => $activeId,
'navTemplate' => $template,
'levels' => $levels,
'Rewrite' => QUI::getRewrite(),
'parentIcon' => $this->getAttribute('parentIcon'),
'listIcon' => $this->getAttribute('listIcon'),
'levelIcon' => $this->getAttribute('levelIcon'),
'onlyFirstLevelIcons' => $this->getAttribute('onlyFirstLevelIcons')
));
$this->addCSSFile($css);
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren