Skip to content

Instantly share code, notes, and snippets.

@ps-team
Last active December 15, 2022 08:28
Show Gist options
  • Save ps-team/38e2e447f02adb31c969 to your computer and use it in GitHub Desktop.
Save ps-team/38e2e447f02adb31c969 to your computer and use it in GitHub Desktop.

Revisions

  1. ps-team revised this gist Apr 2, 2015. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions Local view menu
    Original file line number Diff line number Diff line change
    @@ -11,8 +11,6 @@
    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)){
  2. ps-team created this gist Apr 2, 2015.
    47 changes: 47 additions & 0 deletions Local view menu
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    @using Contensis.Framework.Web
    @using Contensis.Framework.Web.Search

    <ul class="sys_menu">
    @{
    // Loading jQuery through the Contensis API
    AppContext.Current.Page.Scripts.RegisterJQuery();


    if(CurrentNode != null) {
    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>