1

Resolved

Admin menu: LinkToFirstChild(true) ignored on second level menu items

description

If a menu is built with second-level menu items, where the second level menu item doesn't have an action, but has child LocalNav items, and has LinkToFirstChild set to true, the expected behaviour would be that the menu item would link to the first LocalNav tab (as it would if it were a first level menu item). Instead, it links to the root of the application.

This is because menu.cshtml in the Admin theme accounts for LinkToFirstChild for first level menu items but not second level menu items.

comments

DavidCornish wrote Sep 24, 2012 at 4:03 PM

Demo code to replicate this problem:
        builder
            .Add(menu => menu
                .Caption(T("Demo Menu Issue"))
                .Position("1")
                .LinkToFirstChild(false)
                .Add(submenu => submenu
                    .Caption(T("My Demo"))
                    .LinkToFirstChild(true)
                    .Add(tab => tab
                        .Caption(T("Tab One"))
                        .Action("Index", "TestAdmin", new { area = "Orchard.AdminMenuIssue" })
                        .LocalNav()
                    )
                    .Add(tab => tab
                        .Caption(T("Tab Two"))
                        .Action("", "TestAdmin", new { area = "Orchard.AdminMenuIssue" })
                        .LocalNav()
                    )
                )
            , new[] { "collapsed" });

sebastienros wrote Sep 29, 2012 at 1:04 AM

Fixed in changeset db57b007549d