forked from goffee/core
check child items to active nav
This commit is contained in:
parent
e43ace6679
commit
30746a0602
1 changed files with 7 additions and 1 deletions
|
|
@ -3,9 +3,15 @@
|
|||
{{range $item := .NavItems}}
|
||||
|
||||
{{if gt (len $item.ChildItems) 0}}
|
||||
{{ $hasActiveChild := false }}
|
||||
{{range $child := $item.ChildItems}}
|
||||
{{if $child.IsActive}}
|
||||
{{ $hasActiveChild = true }}
|
||||
{{end}}
|
||||
{{end}}
|
||||
<li class="nav-item dropdown">
|
||||
<a href="{{$item.Link}}" {{if eq .IsDisabled true}}disabled{{end}} data-bs-toggle="dropdown"
|
||||
class="nav-link dropdown-toggle {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}">{{$item.Text}}</a>
|
||||
class="nav-link dropdown-toggle {{if eq .IsActive true or $hasActiveChild}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}">{{$item.Text}}</a>
|
||||
<ul class="dropdown-menu">
|
||||
{{ range $item.ChildItems}}
|
||||
{{template "content_dropdown_item" .}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue