Merge pull request #3488 from umbraco/temp8-258-empty-trees-arrow

Adding a check to verify if there are any children which will resolve…
This commit is contained in:
Robert
2018-11-05 12:47:19 +01:00
committed by GitHub
4 changed files with 27 additions and 1 deletions

View File

@@ -33,6 +33,9 @@ namespace Umbraco.Web.Trees
//this will load in a custom UI instead of the dashboard for the root node
root.RoutePath = $"{Constants.Applications.Settings}/{Constants.Trees.ContentBlueprints}/intro";
//check if there are any content blueprints
root.HasChildren = Services.ContentService.GetBlueprintsForContentTypes().Any();
return root;
}
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)

View File

@@ -75,6 +75,14 @@ namespace Umbraco.Web.Trees
return nodes;
}
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
//check if there are any children
root.HasChildren = GetTreeNodes(Constants.System.Root.ToInvariantString(), queryStrings).Any();
return root;
}
protected virtual MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();

View File

@@ -7,11 +7,18 @@ using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Trees
{
[CoreTree(TreeGroup =Constants.Trees.Groups.Settings)]
[CoreTree(TreeGroup = Constants.Trees.Groups.Settings)]
[UmbracoTreeAuthorize(Constants.Trees.MemberTypes)]
[Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, null, sortOrder: 2)]
public class MemberTypeTreeController : MemberTypeAndGroupTreeControllerBase
{
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
//check if there are any member types
root.HasChildren = Services.MemberTypeService.GetAll().Any();
return root;
}
protected override IEnumerable<TreeNode> GetTreeNodesFromService(string id, FormDataCollection queryStrings)
{
return Services.MemberTypeService.GetAll()

View File

@@ -25,6 +25,14 @@ namespace Umbraco.Web.Trees
[CoreTree(TreeGroup = Constants.Trees.Groups.Templating)]
public class TemplatesTreeController : TreeController, ISearchableTree
{
protected override TreeNode CreateRootNode(FormDataCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
//check if there are any templates
root.HasChildren = Services.FileService.GetTemplates(-1).Any();
return root;
}
/// <summary>
/// The method called to render the contents of the tree structure
/// </summary>