From 3922abc31ef8898e955b34ec5ba548f4c72e6b8b Mon Sep 17 00:00:00 2001 From: loudej Date: Fri, 22 Jan 2010 10:25:50 +0000 Subject: [PATCH] When top level menu is empty due to security constraints, and it's not itself a link, it is not displayed --HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045838 --- src/Orchard/UI/Navigation/NavigationManager.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Orchard/UI/Navigation/NavigationManager.cs b/src/Orchard/UI/Navigation/NavigationManager.cs index b50f25e95..3573c90cc 100644 --- a/src/Orchard/UI/Navigation/NavigationManager.cs +++ b/src/Orchard/UI/Navigation/NavigationManager.cs @@ -23,7 +23,14 @@ namespace Orchard.UI.Navigation { protected virtual IUser CurrentUser { get; [UsedImplicitly] private set; } public IEnumerable BuildMenu(string menuName) { - return Reduce(Merge(AllSources(menuName))).ToArray(); + return Crop(Reduce(Merge(AllSources(menuName)))).ToArray(); + } + + private IEnumerable Crop(IEnumerable items) { + foreach(var item in items) { + if (item.Items.Any() || item.RouteValues != null) + yield return item; + } } private IEnumerable Reduce(IEnumerable items) {