From fc1e4f959ecc6214b59e4e809512712fa18a9393 Mon Sep 17 00:00:00 2001 From: perploug Date: Tue, 1 Oct 2013 00:54:46 +0200 Subject: [PATCH] adds container doctype lookup TODO: find a better/faster way to do this --- src/Umbraco.Web/Trees/ContentTreeController.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index 039c781163..0136510628 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -81,12 +81,9 @@ namespace Umbraco.Web.Trees var allowedUserOptions = GetAllowedUserMenuItemsForNode(e); if (CanUserAccessNode(e, allowedUserOptions)) { - //TODO: if the node is of a specific type, don't list its children - //this is to enable the list view on the editor - - //for WIP I'm just checking against a hardcoded value + //TODO: Here I look up a contenttype for every node, must make a faster call for this var hasChildren = e.HasChildren; - if (e.ContentTypeAlias == "umbNewsArea") + if (isContainer(e.ContentTypeAlias)) hasChildren = false; var node = CreateTreeNode( @@ -102,6 +99,12 @@ namespace Umbraco.Web.Trees return nodes; } + //TODO: find a faster way to do this + private bool isContainer(string alias) + { + return Services.ContentTypeService.GetContentType(alias).IsContainer; + } + protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings) { if (id == Constants.System.Root.ToInvariantString()) @@ -175,10 +178,10 @@ namespace Umbraco.Web.Trees menu.AddMenuItem(true); //need to ensure some of these are converted to the legacy system - until we upgrade them all to be angularized. - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); + menu.AddMenuItem(true); menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true); + menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content");