54 lines
1.9 KiB
Plaintext
54 lines
1.9 KiB
Plaintext
@inherits umbraco.MacroEngines.DynamicNodeContext
|
|
|
|
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
|
|
@if (Model.Children.Where("Visible").Any())
|
|
{
|
|
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
|
|
var naviLevel = Model.Children.Where("Visible").First().Level;
|
|
|
|
@* Add in level for a CSS hook *@
|
|
<ul class="level-@naviLevel">
|
|
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
|
|
@foreach (var childPage in Model.Children.Where("Visible"))
|
|
{
|
|
<li>
|
|
<a href="@childPage.Url">@childPage.Name</a>
|
|
|
|
@* if the current page has any children, where the property umbracoNaviHide is not True *@
|
|
@if (childPage.Children.Where("Visible").Any())
|
|
{
|
|
@* Call our helper to display the children *@
|
|
@childPages(childPage.Children)
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
|
|
|
|
@helper childPages(dynamic pages)
|
|
{
|
|
@* Ensure that we have a collection of pages *@
|
|
if (pages.Any())
|
|
{
|
|
@* Get the first page in pages and get the level *@
|
|
var naviLevel = pages.First().Level;
|
|
|
|
@* Add in level for a CSS hook *@
|
|
<ul class="level-@(naviLevel)">
|
|
@foreach (var page in pages.Where("Visible"))
|
|
{
|
|
<li>
|
|
<a href="@page.Url">@page.Name</a>
|
|
|
|
@* if the current page has any children, where the property umbracoNaviHide is not True *@
|
|
@if (page.Children.Where("Visible").Any())
|
|
{
|
|
@* Call our helper to display the children *@
|
|
@childPages(page.Children)
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
} |