private void BuildMenu(NavigationItemBuilder menu) => menu
        // This means that the top-level menu item also will point to the action where it's first child item points.
        .LinkToFirstChild(true)

        // This means that the first child menu item will point to our Person List dashboard and be shown only to
        // users having the AccessPersonListDashboard permission.
        // Warning: this doesn't mean others won't be able to access it directly: we have to check in the
        // controller too!
        .Add(subitem => subitem
             .Caption(T("Create"))
             .Action($"{nameof(ContentsAdminController.PersonListDashboard)}", "ContentsAdmin", new { area = $"{nameof(OrchardHUN)}.{nameof(TrainingDemo)}" })
             .Permission(Permissions.AccessPersonListDashboard)
             )
        .Add(subitem => subitem
             .Caption(T("View"))
             .LinkToFirstChild(true)

             .Add(subsubitem => subsubitem
                  .Caption(T("Most recent one"))
                  .Action($"{nameof(ContentsAdminController.LatestPersonList)}", "ContentsAdmin", new { area = $"{nameof(OrchardHUN)}.{nameof(TrainingDemo)}" })
                  // This will make the item not appear as a child item in left-side menu, but as a tab on the top.
                  .LocalNav(true)
                  .Permission(Permissions.AccessPersonListDashboard)
                  )

             .Add(subsubitem => subsubitem
                  .Caption(T("Latest lists"))
                  .Action($"{nameof(ContentsAdminController.LatestPersonLists)}", "ContentsAdmin", new { area = $"{nameof(OrchardHUN)}.{nameof(TrainingDemo)}" })
                  .LocalNav(true)
                  .Permission(Permissions.AccessPersonListDashboard)
                  )
             );
Exemple #2
0
        private void BuildMenu(NavigationItemBuilder menu)
        {
            menu.LinkToFirstChild(false); // See: http://orchard.codeplex.com/workitem/18807
            menu.Action("GlobalSettings", "Admin", new { area = "Onestop.Seo" }).Permission(Permissions.ManageSeo);


            var seoContentTypes = _seoService.ListSeoContentTypes();


            RunThroughRewriters(menu, (rewriter, builder) => {
                int l = 1;
                if (seoContentTypes.Any())
                {
                    foreach (var contentType in seoContentTypes)
                    {
                        if (l == 1)
                        {
                            builder.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name });
                        }

                        builder
                        .Add(T(contentType.DisplayName), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name })
                             .LocalNav()
                             .Permission(Permissions.ManageSeo));

                        l++;
                    }
                }

                builder
                .Add(T("Dynamic pages"), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = "Dynamic" })
                     .LocalNav()
                     .Permission(Permissions.ManageSeo));
            });
        }
        private void BuildMenu(NavigationItemBuilder menu)
        {
            menu.LinkToFirstChild(false); // See: http://orchard.codeplex.com/workitem/18807
            menu.Action("GlobalSettings", "Admin", new { area = "Onestop.Seo" }).Permission(Permissions.ManageSeo);


            var seoContentTypes = _seoService.ListSeoContentTypes();

            if (seoContentTypes.Count() != 0)
            {
                var rewriters = new List <Rewriter> {
                    new Rewriter {
                        DisplayName = T("Title Tag Rewriter"), Type = "TitleRewriter"
                    },
                    new Rewriter {
                        DisplayName = T("Description Tag Rewriter"), Type = "DescriptionRewriter"
                    },
                    new Rewriter {
                        DisplayName = T("Keywords Tag Rewriter"), Type = "KeywordsRewriter"
                    }
                };

                int i = 1;
                foreach (var rewriter in rewriters)
                {
                    menu.Add(rewriter.DisplayName, i.ToString(),
                             item => {
                        int l = 1;
                        foreach (var contentType in seoContentTypes)
                        {
                            if (l == 1)
                            {
                                item.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name });
                            }

                            item
                            .Add(T(contentType.DisplayName), l.ToString(), tab => tab.Action("Rewriter", "Admin", new { area = "Onestop.Seo", rewriterType = rewriter.Type, Id = contentType.Name })
                                 .LocalNav()
                                 .Permission(Permissions.ManageSeo));

                            l++;
                        }
                    });

                    i++;
                }
            }
        }