From 25a90ffbf5bf0fb064459c941ae136c2c74ba041 Mon Sep 17 00:00:00 2001 From: Dave Woestenborghs Date: Thu, 25 Oct 2018 08:54:17 +0200 Subject: [PATCH] #3419 added extra parameter to createSingleRoot node method so it will always show a single tree. If a single tree doesn't have children it does not show --- src/Umbraco.Web/Models/Trees/SectionRootNode.cs | 9 ++++++--- src/Umbraco.Web/Trees/ApplicationTreeController.cs | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Models/Trees/SectionRootNode.cs b/src/Umbraco.Web/Models/Trees/SectionRootNode.cs index cd4fc3e483..229c363fd2 100644 --- a/src/Umbraco.Web/Models/Trees/SectionRootNode.cs +++ b/src/Umbraco.Web/Models/Trees/SectionRootNode.cs @@ -28,6 +28,7 @@ namespace Umbraco.Web.Models.Trees { private static readonly string RootId = Core.Constants.System.Root.ToString(CultureInfo.InvariantCulture); private bool _isGroup; + private bool _alwaysShow; /// /// Creates a group node for grouped multiple trees @@ -87,13 +88,15 @@ namespace Umbraco.Web.Models.Trees /// /// /// + /// /// - public static TreeRootNode CreateSingleTreeRoot(string nodeId, string getChildNodesUrl, string menuUrl, string title, TreeNodeCollection children) + public static TreeRootNode CreateSingleTreeRoot(string nodeId, string getChildNodesUrl, string menuUrl, string title, TreeNodeCollection children, bool alwaysShowRootNode = false) { return new TreeRootNode(nodeId, getChildNodesUrl, menuUrl) { Children = children, - Name = title + Name = title, + _alwaysShow = alwaysShowRootNode }; } @@ -150,6 +153,6 @@ namespace Umbraco.Web.Models.Trees /// This is used in the UI to configure a full screen section/app /// [DataMember(Name = "containsTrees")] - public bool ContainsTrees => Children.Count > 0; + public bool ContainsTrees => Children.Count > 0 || _alwaysShow; } } diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 273a7afb37..98db16f0e9 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -171,12 +171,17 @@ namespace Umbraco.Web.Trees throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias); } + var treeAttribute = configTree.GetTreeAttribute(); + var sectionRoot = TreeRootNode.CreateSingleTreeRoot( rootId, rootNode.Result.ChildNodesUrl, rootNode.Result.MenuUrl, rootNode.Result.Name, - byControllerAttempt.Result); + byControllerAttempt.Result, + treeAttribute.AlwaysShowRootItem); + + //assign the route path based on the root node, this means it will route there when the section is navigated to //and no dashboards will be available for this section