Skip to content

Commit

Permalink
feat: add selector to rock profile header.latte
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 12, 2023
1 parent 17ec7b2 commit b6e2c00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function getModuleInfo()
{
return [
'title' => 'RockFrontend',
'version' => '2.13.1',
'version' => '2.14.0',
'summary' => 'Module for easy frontend development',
'autoload' => true,
'singular' => true,
Expand Down
19 changes: 11 additions & 8 deletions profiles/rock/files/site/templates/sections/header.latte
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{* here you can exclude items from main + mobile menu, eg template!=blogitem *}
{$wire->mainMenuSelector = ""}
{$wire->mobileMenuSelector = $wire->mainMenuSelector}

<header {alfred($page)}>
<div class="rf-boxed">
<div class="rf-boxed-padding">
Expand Down Expand Up @@ -27,12 +31,11 @@
{define mainmenu, $items, $first}
{foreach $items as $item}{* loop all items*}
{* define variables for inside the loop *}
{var $selector = ""} {* exclude child items here *}
{var $show = ($rockfrontend->isActive($item) or $item->parents->count()===1)}
{var $inDropdown = $item->parents->count()>1}
{var $active = $inDropdown ? $item==$page : $rockfrontend->isActive($item)}
{var $subid = "menu-".$item->id}
{var $numc = ($item->children($selector)->count() && $item!==$first) }
{var $numc = ($item->children($wire->mainMenuSelector)->count() && $item!==$first) }
{* list item markup *}
<li n:class="$active ? 'uk-active'">
<a
Expand All @@ -52,8 +55,8 @@
{include
mainmenu,
$inDropdown
? $item->children($selector)->prepend($item)
: $item->children($selector),
? $item->children($wire->mainMenuSelector)->prepend($item)
: $item->children($wire->mainMenuSelector),
$item
}
</ul>
Expand All @@ -62,7 +65,7 @@
{/foreach}
{/define}
{* now include the block for the first level of items *}
{include mainmenu, $home->children()}
{include mainmenu, $home->children($wire->mainMenuSelector)}
</ul>

{* burger *}
Expand Down Expand Up @@ -95,7 +98,7 @@
{var $show = $rockfrontend->isActive($item)}
{var $active = $item==$page}
{var $subid = "mobile-".$item->id}
{var $numc = ($item->children()->count() && $item!==$first) }
{var $numc = ($item->children($wire->mobileMenuSelector)->count() && $item!==$first) }
{* list item markup *}
<li n:class="$active ? 'uk-active'">
<a
Expand All @@ -112,13 +115,13 @@
class="uk-nav-sub"
{!$show?'hidden'}
>
{include mobilemenu, $item->children()->prepend($item), $item}
{include mobilemenu, $item->children($wire->mobileMenuSelector)->prepend($item), $item}
</ul>
</li>
{/foreach}
{/define}
{* now include the block for the first level of items *}
{include mobilemenu, $home->children()}
{include mobilemenu, $home->children($wire->mobileMenuSelector)}
</ul>

</div>
Expand Down

0 comments on commit b6e2c00

Please sign in to comment.