public void GetNavigation(NavigationBuilder builder) { builder.AddImageSet("users") .Add(T("Users"), "11", menu => menu.Action("Index", "Admin", new { area = "Coevery.Users" }).Permission(StandardPermissions.SiteOwner) .Add(T("Users"), "1.0", item => item.Action("Index", "Admin", new { area = "Coevery.Users" }) .LocalNav().Permission(StandardPermissions.SiteOwner))); }
private IEnumerable<IEnumerable<MenuItem>> GetSources(IContent menu) { foreach (var provider in _menuProviders) { var builder = new NavigationBuilder(); IEnumerable<MenuItem> items = null; try { provider.GetMenu(menu, builder); items = builder.Build(); } catch (Exception ex) { Logger.Error(ex, "Unexpected error while querying a menu provider. It was ignored. The menu provided by the provider may not be complete."); } if (items != null) { yield return items; } } }
private IEnumerable<IEnumerable<string>> GetImageSets(string menuName) { foreach (var provider in _navigationProviders) { if (provider.MenuName == menuName) { var builder = new NavigationBuilder(); IEnumerable<string> imageSets = null; try { provider.GetNavigation(builder); imageSets = builder.BuildImageSets(); } catch (Exception ex) { Logger.Error(ex, "Unexpected error while querying a navigation provider. It was ignored. The menu provided by the provider may not be complete."); } if (imageSets != null) { yield return imageSets; } } } }
private static NavigationBuilder BuildMenuScenario1() { NavigationBuilder navigationBuilder = new NavigationBuilder(); navigationBuilder.Add(new LocalizedString("X"), "0", menu => menu .Add(new LocalizedString("A"), "0", subMenu => subMenu.Action("Index", "Admin", new { area = "Area" }) .Add(new LocalizedString("B"), "0", item => item.Action("Index", "Admin", new { area = "Area" })) .Add(new LocalizedString("C"), "1", item => item.Action("Index", "Admin", new { area = "Area" }).LocalNav()))) .Add(new LocalizedString("D"), "1", subMenu => subMenu.Action("Index", "Admin", new { area = "Area" }).LocalNav() .Add(new LocalizedString("E"), "0", item => item.Action("Index", "Admin", new { area = "Area" })) .Add(new LocalizedString("F"), "1", item => item.Action("Index", "Admin", new { area = "Area" }).LocalNav())); return navigationBuilder; }
private static NavigationBuilder BuildMenuScenario2() { NavigationBuilder navigationBuilder = new NavigationBuilder(); navigationBuilder.Add(new LocalizedString("X"), "0", menu => menu .Add(new LocalizedString("A"), "0", item => item.Action(SecondLevel1Action, "Admin", new { area = "Area" })) .Add(new LocalizedString("B"), "1", subMenu => subMenu .Add(new LocalizedString("C"), "0", item => item.Action(ThirdLevel1Action, "Admin", new { area = "Area" }).LocalNav()) .Add(new LocalizedString("D"), "1", subSubMenu => subSubMenu.LocalNav() .Add(new LocalizedString("E"), "0", item => item.Action(FourthLevel1Action, "Admin", new { area = "Area" }).LocalNav()) .Add(new LocalizedString("F"), "1", item => item.Action(FourthLevel2Action, "Admin", new { area = "Area" }).LocalNav()) .Add(new LocalizedString("G"), "2", item => item.Action(FourthLevel3Action, "Admin", new { area = "Area" })) .Add(new LocalizedString("W"), "3", item => item.Action(FourthLevel4Action, "Admin", new { area = "Area" }))))); return navigationBuilder; }
public void GetNavigation(NavigationBuilder builder) { var T = NullLocalizer.Instance; builder .Add(new LocalizedString("Foo", "", "Foo", null), "1.0", x => x.Action("foo")) .Add(new LocalizedString("Bar", "", "Bar", null), "2.0", x => x.Add(new LocalizedString("Frap", "", "Frap", null), "1.b")); }
public void GetNavigation(NavigationBuilder builder) { throw new NullReferenceException(); }