This page is a placeholder for now; however, I intent to create a post that describes the use of my own version of the MvcContrib Menu Helper.
For now, you can see a working demo by using the demo link. Once I have the source code cleaned up a bit, I'll post the source code.
Below is a quick snippet of the code used to generate the main menu in the demo. Notice the fluent style and the use of Razor Templates. BTW, sorry for the poor color-code - Razor doesn't format well using SyntaxHighligher.
@Html.MvcContrib().Menu().Items(menu => {
menu.Action<HomeController>(c => c.Index(), "no text displayed", Url.Content("~/Content/ico/house.png"))
.ItemAttributes(@class => "solo").DisplayText(false);
menu.Link("About", null, Url.Content("~/Content/ico/application_side_boxes.png")).Items(sub => {
sub.Content(
@:@Html.Partial("_MvcContribLogo")
);
}).ListAttributes(style => "width: 450px;", @class => "sf-shadow-off");
menu.Link("Secure", null, Url.Content("~/Content/ico/lock_open.png")).Items(sub => {
sub.Secure<HomeController>(c => c.Index(), null, Url.Content("~/Content/ico/application_view_tile.png"));
sub.Secure<HomeController>(c => c.About(), null, Url.Content("~/Content/ico/info2.png"));
sub.Secure<HomeController>(c => c.SecurePageOne(), null, Url.Content("~/Content/ico/shield.png"));
sub.Secure<HomeController>(c => c.SecurePageTwo(), null, Url.Content("~/Content/ico/shield_go.png"));
});
menu.Link("Insecure", null, Url.Content("~/Content/ico/lock.png")).Items(sub => {
sub.Action<HomeController>(c => c.Index(), null, Url.Content("~/Content/ico/application_view_tile.png"));
sub.Action<HomeController>(c => c.About(), null, Url.Content("~/Content/ico/info2.png"));
sub.Action<HomeController>(c => c.SecurePageOne(), null, Url.Content("~/Content/ico/shield.png"));
sub.Action<HomeController>(c => c.SecurePageTwo(), null, Url.Content("~/Content/ico/shield_go.png"));
});
menu.Action<MenuController>(c => c.Index(), "Menu Examples", Url.Content("~/Content/ico/house_go.png"));
})
Demo | Source