Adding items to Admin menu for theme

Topics: Writing themes
Jun 29, 2013 at 6:58 PM
Edited Jun 29, 2013 at 7:00 PM
Hey guys,

Ran into a strange issue with 1.x and thought I would post here before opening an issue in case I'm doing something wrong. For the theme I'm working on, I'm allowing the user to choose a color scheme. To do that, I've added a link underneath Themes in the Admin menu when my theme is selected.

The issue is that I have to create the link twice in order for one of them to show up...almost like it ignores the first one. Here's the relevant AdminMenu.cs code:
        public void GetNavigation(NavigationBuilder builder) {
            var themeName = _siteThemeService.GetSiteTheme();
            if (themeName.Name == Constants.THEME_NAME) {
                builder.Add(T("Themes"), "10", BuildMenu);
            }
        }

        private void BuildMenu(NavigationItemBuilder menu) {
            menu.Add(T("foo"), "10.1",
                item => item
                    .Action("Index", "Admin", new { area = Constants.ROUTES_AREA_NAME })
                    .Permission(Raptor.Ericka.Permissions.ManageThemeSettings)
            );
            menu.Add(T("Accent Color"), "10.2",
                item => item
                    .Action("Index", "Admin", new { area = Constants.ROUTES_AREA_NAME })
                    .Permission(Raptor.Ericka.Permissions.ManageThemeSettings)
            );
        }
It will ignore the one named "foo" and display the second one.

I also tried using the 1.x syntax for GetNavigation:
        public void GetNavigation(NavigationBuilder builder) {
            var themeName = _siteThemeService.GetSiteTheme();
            if (themeName.Name == Constants.THEME_NAME) {
                builder.AddImageSet("themes")
                    .Add(T("Themes"), "10", BuildMenu);
            }
        }
but that didn't work either.

Am I doing this properly, or is this an issue that I should open a bug for? Thanks =)
Coordinator
Jul 1, 2013 at 1:19 AM
I don't think anything changed with these APIs. Please file a bug if you have a clear repro.