public override void RegisterMenu(IMenuContributor menus) { menus.Menu(MenuNameDefaults.MainNavbar, menu => { }); menus.Menu(MenuNameDefaults.DashboardNavbar, admin => { }); menus.Menu(MenuNameDefaults.DashboardContent, menu => { menu.HasSubmenu(MenuNameDefaults.DashboardConfigurations, 0, conf => { conf.HasTitle(string.Empty, "Infrastructure") .HasLink("javascript:;"); }); menu.HasSubmenu(MenuNameDefaults.DashboardUsers, 100, user => { user.HasTitle(string.Empty, "Users") .HasLink("javascript:;"); }); menu.HasSubmenu(MenuNameDefaults.DashboardDocuments, 200, docs => { docs.HasTitle(string.Empty, "Documentation") .HasLink("javascript:;"); docs.HasEntry(100) .HasTitle(string.Empty, "Sitemaps") .HasLink("Dashboard", "Root", "Endpoints"); docs.HasEntry(101) .HasTitle(string.Empty, "Component Versions") .HasLink("Dashboard", "Root", "Versions"); }); }); // If someone reads this code then he'll know how to customize it. menus.Submenu(MenuNameDefaults.UserDropdown, menu => { menu.HasEntry(0) .HasTitle("fas fa-address-card", "Profile") .HasLink((u, c) => u.Action("Show", "Profile", new { area = "Account", username = c.HttpContext.User.GetUserName() })); menu.HasEntry(100) .HasTitle("fas fa-compass", "Dashboard") .HasLink("Dashboard", "Root", "Index") .WithMetadata("ExcludeMenuNameAt", MenuNameDefaults.DashboardNavbar) .WithMetadata("RequiredPolicy", "HasDashboard"); menu.HasEntry(200) .HasTitle("fas fa-home", "Back to main site") .HasLink("/") .WithMetadata("ExcludeMenuNameAt", MenuNameDefaults.MainNavbar); }); }
public override void RegisterMenu(IMenuContributor menus) { menus.Menu(MenuNameDefaults.DashboardNavbar, menu => { menu.HasEntry(0) .HasTitle("fas fa-server", "Sample") .HasLink("Dashboard", "Weather", "Change") .ActiveWhenController("Weather") .HasIdentifier("menu_weather"); }); menus.Submenu(MenuNameDefaults.DashboardConfigurations, menu => { menu.HasEntry(0) .HasTitle("fas fa-server", "Sample") .HasLink("Dashboard", "Weather", "Change") .ActiveWhenController("Weather") .HasIdentifier("menu_weather"); }); menus.Component("Component_UserDetail") .HasComponent <WeatherViewComponent>(10); menus.Component("Component_DashboardUserDetail") .HasComponent <WeatherViewComponent>(10); }
public override void RegisterMenu(IMenuContributor menus) { menus.Menu(MenuNameDefaults.DashboardNavbar, menu => { menu.HasEntry(500) .HasLink("Dashboard", "Users", "List") .HasTitle("fas fa-address-card", "Users") .ActiveWhenController("Users") .RequireRoles("Administrator"); }); menus.Submenu(MenuNameDefaults.DashboardUsers, menu => { menu.HasEntry(0) .HasLink("Dashboard", "Users", "List") .HasTitle(string.Empty, "Users") .RequireRoles("Administrator"); }); menus.Menu(ExtensionPointDefaults.UserDetailMenu, menu => { menu.HasEntry(0) .HasLink("Account", "Profile", "Edit") .HasTitle("primary", "Edit profile") .RequireThat(c => c.HttpContext.User.GetUserName() == ((IUser)c.ViewData["User"]).UserName); menu.HasEntry(10) .HasLink("Account", "Profile", "ChangePassword") .HasTitle("secondary", "Change password") .RequireThat(c => c.HttpContext.User.GetUserName() == ((IUser)c.ViewData["User"]).UserName); menu.HasEntry(0) .HasLink((urlHelper, context) => urlHelper.Action("Detail", "Users", new { area = "Dashboard", uid = ((IUser)context.ViewData["User"]).Id })) .HasTitle("danger", "Dashboard") .RequireThat(c => c.HttpContext.User.GetUserName() != ((IUser)c.ViewData["User"]).UserName) .RequireRoles("Administrator"); }); menus.Component(ExtensionPointDefaults.UserDetail); menus.Component(ExtensionPointDefaults.DashboardUserDetail); }