Created
October 27, 2017 10:06
-
-
Save ps-team/5bd90ab67d1d35a30b5a4416985eeece to your computer and use it in GitHub Desktop.
Revisions
-
ps-team created this gist
Oct 27, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ @using Contensis.Framework.Web @using Contensis.Framework.Web.Search <ul class="sys_menu"> @{ AppContext.Current.Page.Scripts.RegisterJQuery(); if(CurrentNode != null) { //This will be replaced by a function in future releases var currentFolder = CurrentNode.Parent; var currentDepth = CurrentNode.Parent.Depth; var test = CurrentNode.Data.MD_Description; for(int i=1; i<currentDepth; i++){ var currentAncestor = CurrentNode.Parent.AncestorAtDepth(i); foreach (var aPage in currentAncestor.Children<ContentNode>().Where(aP => aP.IsHomePage == true && aP.IncludeInMenu == true && aP.IsWebPage == true ).OrderBy(aP => aP.MenuOrder)){ <li><a href="@aPage.Path" title="@aPage.Title">@aPage.Parent.MenuName</a></li> } } foreach (var page in currentFolder.Children<ContentNode>().Where(p => p.IsHomePage == true && p.IncludeInMenu == true && p.IsWebPage == true && p.Depth <= CurrentNode.Depth)){ if(CurrentNode.Depth == page.Depth) { <li class="sys_current-folder"><a href="@page.Path" title="@page.Title">@page.Parent.MenuName</a> <ul class="sys_sub-menu"> @foreach (var subPage in CurrentNode.Parent.Children<ContentNode>().Where(sP => sP.IsHomePage == false && sP.IncludeInMenu == true && sP.IsWebPage == true).OrderBy(sP => sP.MenuOrder)) { //If the currnet node matches the current node in the loop add current page class //Otherwise, output link as normal if(subPage.ID == CurrentNode.ID) { <li class="sys_selected"><a href="@subPage.Path" title="@subPage.Title">@subPage.MenuName</a></li> }else { <li><a href="@subPage.Path" title="@subPage.Title">@subPage.MenuName</a></li> } } </ul> </li> } } }else { <h1>CurrentNode is Null</h1> } } </ul>