Beispiel #1
0
        public PartialViewResult TopMenu()
        {
            // Top menu for the current language starts at the nearest language root
            ContentItem branchRoot    = Find.ClosestLanguageRoot;
            var         selected      = Find.AncestorAtLevel(2, Find.EnumerateParents(CurrentPage, branchRoot, true), CurrentPage);
            var         topLevelPages = branchRoot.GetChildren(new NavigationFilter());
            var         model         = new TopMenuModel(GetTranslations(), selected ?? branchRoot, topLevelPages);

            return(PartialView(model));
        }
Beispiel #2
0
        private void InitMenu(object sender, EventArgs e)
        {
            ContentItem branchRoot = Find.AncestorAtLevel(StartLevel, Find.EnumerateParents(CurrentPage, StartPage), CurrentPage);

            if (branchRoot != null && branchRoot.GetChildren(new NavigationFilter()).Count > 0)
            {
                hsm.Text = N2.Web.Link.To(branchRoot).ToString();
            }
            else
            {
                this.Visible = false;
            }
        }
        public PartialViewResult TopMenu()
        {
            // Top menu for the current language starts at the nearest language root
            ContentItem branchRoot = Find.ClosestLanguageRoot;
            var         selected   = Find.AncestorAtLevel(2, Find.EnumerateParents(CurrentPage, branchRoot, true), CurrentPage);
            var         pages      = branchRoot.Children.WhereNavigatable();

            pages.Insert(0, branchRoot);
            var topLevelPages = pages.TryAppendCreatorNode(Engine, branchRoot);
            var model         = new TopMenuModel(GetTranslations(), selected ?? branchRoot, topLevelPages);

            return(PartialView(model));
        }
Beispiel #4
0
        public PartialViewResult SubMenu()
        {
            ContentItem startPage  = Find.ClosestLanguageRoot;
            var         ancestors  = Find.EnumerateParents(N2.Find.CurrentPage, Find.ClosestLanguageRoot, true).ToList();
            ContentItem branchRoot = Find.AncestorAtLevel(2, ancestors, N2.Find.CurrentPage);
            var         model      = new SubMenuModel();

            if (branchRoot != null && !startPage.Equals(CurrentPage) && branchRoot.GetChildren(new NavigationFilter()).Count > 0)
            {
                model.CurrentItem = Find.AncestorAtLevel(3, ancestors, CurrentPage) ?? CurrentPage;
                model.BranchRoot  = branchRoot;
                model.Items       = branchRoot.GetChildren(new NavigationFilter());
            }
            else
            {
                model.Visible = false;
            }

            return(PartialView(model));
        }
        public PartialViewResult SubMenu()
        {
            ContentItem startPage  = Find.ClosestLanguageRoot;
            var         ancestors  = Find.EnumerateParents(N2.Find.CurrentPage, Find.ClosestLanguageRoot, true).ToList();
            ContentItem branchRoot = Find.AncestorAtLevel(2, ancestors, N2.Find.CurrentPage);
            var         model      = new SubMenuModel();

            if (branchRoot != null && !startPage.Equals(CurrentPage))
            {
                var children = branchRoot.Children.WhereNavigatable().TryAppendCreatorNode(Engine, branchRoot).ToList();
                if (children.Count > 0)
                {
                    model.CurrentItem = Find.AncestorAtLevel(3, ancestors, CurrentPage) ?? CurrentPage;
                    model.BranchRoot  = branchRoot;
                    model.Items       = children;
                    return(PartialView(model));
                }
            }

            model.Visible = false;
            return(PartialView(model));
        }
Beispiel #6
0
 private ContentItem GetStartingPoint()
 {
     return(Find.AncestorAtLevel(StartLevel, Find.EnumerateParents(CurrentPage, StartPage, true), CurrentPage));
 }