Update Umbraco to 7.12.2
This commit is contained in:
@@ -1,31 +1,36 @@
|
||||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
|
||||
@using Umbraco.Core.Models
|
||||
@using Umbraco.Web
|
||||
|
||||
@*
|
||||
This snippet creates links for every single page (no matter how deep) below
|
||||
the page currently being viewed by the website visitor, displayed as nested unordered html lists.
|
||||
the page currently being viewed by the website visitor, displayed as nested unordered HTML lists.
|
||||
*@
|
||||
|
||||
@{ var selection = CurrentPage.Children.Where("Visible"); }
|
||||
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).ToArray(); }
|
||||
|
||||
@* Ensure that the Current Page has children *@
|
||||
@if (selection.Any())
|
||||
@if (selection.Length > 0)
|
||||
{
|
||||
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
|
||||
var naviLevel = CurrentPage.FirstChild().Where("Visible").Level;
|
||||
var naviLevel = selection[0].Level;
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="level-@naviLevel">
|
||||
@* For each child page where the property umbracoNaviHide is not True *@
|
||||
<ul class="level-@(naviLevel)">
|
||||
@* Loop through the selection *@
|
||||
@foreach (var item in selection)
|
||||
{
|
||||
<li>
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@* if this child page has any children, where the property umbracoNaviHide is not True *@
|
||||
@if (item.Children.Where("Visible").Any())
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@childPages(item.Children)
|
||||
@{
|
||||
var children = item.Children.Where(x => x.IsVisible()).ToArray();
|
||||
if (children.Length > 0)
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@ChildPages(children)
|
||||
}
|
||||
}
|
||||
</li>
|
||||
}
|
||||
@@ -33,26 +38,29 @@
|
||||
}
|
||||
|
||||
|
||||
@helper childPages(dynamic selection)
|
||||
@helper ChildPages(IPublishedContent[] selection)
|
||||
{
|
||||
@* Ensure that we have a collection of pages *@
|
||||
if (selection.Any())
|
||||
if (selection.Length > 0)
|
||||
{
|
||||
@* Get the first page in pages and get the level *@
|
||||
var naviLevel = selection.First().Level;
|
||||
@* Get the first page in pages and get the level *@
|
||||
var naviLevel = selection[0].Level;
|
||||
|
||||
@* Add in level for a CSS hook *@
|
||||
@* Add in level for a CSS hook *@
|
||||
<ul class="level-@(naviLevel)">
|
||||
@foreach (var item in selection.Where("Visible"))
|
||||
@foreach (var item in selection)
|
||||
{
|
||||
<li>
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@* if the this page has any children, where the property umbracoNaviHide is not True *@
|
||||
@if (item.Children.Where("Visible").Any())
|
||||
{
|
||||
@* Call our helper to display the children *@
|
||||
@childPages(item.Children)
|
||||
@* if the page has any children, where the property umbracoNaviHide is not True *@
|
||||
@{
|
||||
var children = item.Children.Where(x => x.IsVisible()).ToArray();
|
||||
if (children.Length > 0)
|
||||
{
|
||||
@* Recurse and call our helper to display the children *@
|
||||
@ChildPages(children)
|
||||
}
|
||||
}
|
||||
</li>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user