diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index 8879c12b3b..a69f13677a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -93,7 +93,7 @@ angular.module("umbraco.directives") * When changing sections we don't want all of the tree-ndoes to do their 'leave' animations. */ scope.animation = function () { - if (enableDeleteAnimations) { + if (enableDeleteAnimations && scope.tree.root.expanded) { return { leave: 'tree-node-delete-leave' }; } else { diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 321108742d..1cf8f22e1b 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -61,11 +61,7 @@ namespace Umbraco.Web.Trees collection.Add(rootNode); } - return new SectionRootNode(rootId, "") - { - Children = collection, - IsContainer = true - }; + return SectionRootNode.CreateMultiTreeSectionRoot(rootId, collection); } /// @@ -113,13 +109,13 @@ namespace Umbraco.Web.Trees throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias); } - var sectionRoot = new SectionRootNode( - rootId, - rootNode.Result.MenuUrl) - { - Title = rootNode.Result.Title, - Children = byControllerAttempt.Result - }; + var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot( + rootId, + rootNode.Result.ChildNodesUrl, + rootNode.Result.MenuUrl, + rootNode.Result.Title, + byControllerAttempt.Result); + foreach (var d in rootNode.Result.AdditionalData) { sectionRoot.AdditionalData[d.Key] = d.Value; @@ -130,15 +126,17 @@ namespace Umbraco.Web.Trees var legacyAttempt = configTree.TryLoadFromLegacyTree(id, queryStrings, Url, configTree.ApplicationAlias); if (legacyAttempt.Success) { - var sectionRoot = new SectionRootNode( - rootId, - Url.GetUmbracoApiService("GetMenu", rootId) + var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot( + rootId, + "", //TODO: I think we'll need this in this situation! + Url.GetUmbracoApiService("GetMenu", rootId) + "&parentId=" + rootId + "&treeType=" + application - + "§ion=" + application) - { - Children = legacyAttempt.Result - }; + + "§ion=" + application, + "", //TODO: I think we'll need this in this situation! + legacyAttempt.Result); + + sectionRoot.AdditionalData.Add("treeAlias", configTree.Alias); return sectionRoot; } diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index 1d91481c81..b330d41500 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -29,10 +29,10 @@ namespace Umbraco.Web.Trees TreeNode node; //if the user's start node is not default, then return their start node as the root node. - if (UmbracoUser.StartNodeId != Constants.System.Root) + if (Security.CurrentUser.StartContentId != Constants.System.Root) { var currApp = queryStrings.GetValue(TreeQueryStringParameters.Application); - var userRoot = Services.EntityService.Get(UmbracoUser.StartNodeId, UmbracoObjectTypes.Document); + var userRoot = Services.EntityService.Get(Security.CurrentUser.StartContentId, UmbracoObjectTypes.Document); if (userRoot == null) { throw new HttpResponseException(HttpStatusCode.NotFound); diff --git a/src/Umbraco.Web/Trees/SectionRootNode.cs b/src/Umbraco.Web/Trees/SectionRootNode.cs index 0f04205cf4..0e8037e0f3 100644 --- a/src/Umbraco.Web/Trees/SectionRootNode.cs +++ b/src/Umbraco.Web/Trees/SectionRootNode.cs @@ -14,17 +14,35 @@ namespace Umbraco.Web.Trees [DataContract(Name = "node", Namespace = "")] public sealed class SectionRootNode : TreeNode { - public SectionRootNode(string nodeId, string menuUrl) - : base(nodeId, string.Empty, menuUrl) + public static SectionRootNode CreateMultiTreeSectionRoot(string nodeId, TreeNodeCollection children) + { + return new SectionRootNode(nodeId, "", "") + { + IsContainer = true, + Children = children + }; + } + + public static SectionRootNode CreateSingleTreeSectionRoot(string nodeId, string getChildNodesUrl, string menuUrl, string title, TreeNodeCollection children) + { + return new SectionRootNode(nodeId, getChildNodesUrl, menuUrl) + { + Children = children, + Title = title + }; + } + + private SectionRootNode(string nodeId, string getChildNodesUrl, string menuUrl) + : base(nodeId, getChildNodesUrl, menuUrl) { //default to false IsContainer = false; } [DataMember(Name = "isContainer")] - public bool IsContainer { get; set; } + public bool IsContainer { get; private set; } [DataMember(Name = "children")] - public TreeNodeCollection Children { get; set; } + public TreeNodeCollection Children { get; private set; } } } \ No newline at end of file