From 3ddc59a25348bdc9f54fd3075474ee248fdfc569 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 20 Jun 2012 18:04:20 -0700 Subject: [PATCH] Fixing navigation rendering --HG-- branch : 1.x --- .../Drivers/MenuWidgetPartDriver.cs | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/Orchard.Web/Core/Navigation/Drivers/MenuWidgetPartDriver.cs b/src/Orchard.Web/Core/Navigation/Drivers/MenuWidgetPartDriver.cs index a845e9728..e9ac30a54 100644 --- a/src/Orchard.Web/Core/Navigation/Drivers/MenuWidgetPartDriver.cs +++ b/src/Orchard.Web/Core/Navigation/Drivers/MenuWidgetPartDriver.cs @@ -87,6 +87,28 @@ namespace Orchard.Core.Navigation.Drivers { menuItems = menuItems.Take(part.Levels); } + var result = new List(menuItems); + + // inject the home page + if (part.AddHomePage) { + result.Insert(0, new MenuItem { + Href = _navigationManager.GetUrl("~/", null), + Text = T("Home") + }); + } + + // inject the current page + if (!part.AddCurrentPage) { + result.RemoveAt(result.Count - 1); + } + + // prevent the home page to be added as the home page and the current page + if (result.Count == 2 && String.Equals(result[0].Href, result[1].Href, StringComparison.OrdinalIgnoreCase)) { + result.RemoveAt(1); + } + + menuItems = result; + menuShape = shapeHelper.Breadcrumb(); } else { @@ -126,27 +148,7 @@ namespace Orchard.Core.Navigation.Drivers { } } - var result = new List(menuItems); - - // inject the home page - if(part.AddHomePage) { - result.Insert(0, new MenuItem { - Href = _navigationManager.GetUrl("~/", null), - Text = T("Home") - }); - } - - // inject the current page - if (!part.AddCurrentPage) { - result.RemoveAt(result.Count - 1); - } - - // prevent the home page to be added as the home page and the current page - if(result.Count == 2 && String.Equals(result[0].Href, result[1].Href, StringComparison.OrdinalIgnoreCase)) { - result.RemoveAt(1); - } - - menuItems = result; + menuShape.MenuName(menuName); NavigationHelper.PopulateMenu(shapeHelper, menuShape, menuShape, menuItems);