fix active hierarchy in menu and megamenu

This commit is contained in:
Ludovic CANDELLIER
2023-03-14 21:46:57 +01:00
parent 4e69399309
commit 7454411d27
8 changed files with 74 additions and 15 deletions

View File

@@ -1,8 +1,10 @@
<a class="green-dark @if (($category['id'] ?? false) == $menu_children['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
<div class="w-100"><strong>{{ $menu_children['name'] }}</strong></div>
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
<div class="w-100 @if (in_array($menu_children['id'], [$category['id'], $category['parent_id']])) active @endif">
<strong>{{ $menu_children['name'] }}</strong>
</div>
</a>
@foreach ($menu_children['children'] ?? [] as $leaf)
<a class="green-dark @if (($category['id'] ?? false) == $leaf['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
<div class="w-100">{{ $leaf['name'] }}</div>
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
<div class="w-100 @if (($category['id'] ?? false) == $leaf['id']) active @endif">{{ $leaf['name'] }}</div>
</a>
@endforeach