-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added condition to include nav item only if url is not empty (#1449)
* added condition to include nav item only if url is not empty * added conditional rendering of parent only if atleast has one child with url * added missing partial file * added nested checking for valid children * fixed false active tag and fixed span condition
- Loading branch information
1 parent
1e1c759
commit 71b4557
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{ $hasOneValidChild := false }} | ||
|
||
{{ range . }} | ||
{{ $url := partial "nav_url.html" (dict "menuItem" .) }} | ||
|
||
{{ if .HasChildren }} | ||
{{ $hasOneValidChild = partial "nav_item_has_child.html" .Children }} | ||
{{ if $hasOneValidChild }} | ||
{{ break }} | ||
{{ end }} | ||
{{ else }} | ||
{{ if $url }} | ||
{{ $hasOneValidChild = true }} | ||
{{ break }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ return $hasOneValidChild }} |