Fixes: U4-2905 Refresh node at tree root (i.e. content/media) doesn't work

This commit is contained in:
Shannon
2013-09-26 14:28:18 +10:00
parent ac755d7a22
commit c9fd168cbd
4 changed files with 42 additions and 26 deletions

View File

@@ -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. * When changing sections we don't want all of the tree-ndoes to do their 'leave' animations.
*/ */
scope.animation = function () { scope.animation = function () {
if (enableDeleteAnimations) { if (enableDeleteAnimations && scope.tree.root.expanded) {
return { leave: 'tree-node-delete-leave' }; return { leave: 'tree-node-delete-leave' };
} }
else { else {

View File

@@ -61,11 +61,7 @@ namespace Umbraco.Web.Trees
collection.Add(rootNode); collection.Add(rootNode);
} }
return new SectionRootNode(rootId, "") return SectionRootNode.CreateMultiTreeSectionRoot(rootId, collection);
{
Children = collection,
IsContainer = true
};
} }
/// <summary> /// <summary>
@@ -113,13 +109,13 @@ namespace Umbraco.Web.Trees
throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias); throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias);
} }
var sectionRoot = new SectionRootNode( var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
rootId, rootId,
rootNode.Result.MenuUrl) rootNode.Result.ChildNodesUrl,
{ rootNode.Result.MenuUrl,
Title = rootNode.Result.Title, rootNode.Result.Title,
Children = byControllerAttempt.Result byControllerAttempt.Result);
};
foreach (var d in rootNode.Result.AdditionalData) foreach (var d in rootNode.Result.AdditionalData)
{ {
sectionRoot.AdditionalData[d.Key] = d.Value; sectionRoot.AdditionalData[d.Key] = d.Value;
@@ -130,15 +126,17 @@ namespace Umbraco.Web.Trees
var legacyAttempt = configTree.TryLoadFromLegacyTree(id, queryStrings, Url, configTree.ApplicationAlias); var legacyAttempt = configTree.TryLoadFromLegacyTree(id, queryStrings, Url, configTree.ApplicationAlias);
if (legacyAttempt.Success) if (legacyAttempt.Success)
{ {
var sectionRoot = new SectionRootNode( var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
rootId, rootId,
"", //TODO: I think we'll need this in this situation!
Url.GetUmbracoApiService<LegacyTreeController>("GetMenu", rootId) Url.GetUmbracoApiService<LegacyTreeController>("GetMenu", rootId)
+ "&parentId=" + rootId + "&parentId=" + rootId
+ "&treeType=" + application + "&treeType=" + application
+ "&section=" + application) + "&section=" + application,
{ "", //TODO: I think we'll need this in this situation!
Children = legacyAttempt.Result legacyAttempt.Result);
};
sectionRoot.AdditionalData.Add("treeAlias", configTree.Alias); sectionRoot.AdditionalData.Add("treeAlias", configTree.Alias);
return sectionRoot; return sectionRoot;
} }

View File

@@ -29,10 +29,10 @@ namespace Umbraco.Web.Trees
TreeNode node; TreeNode node;
//if the user's start node is not default, then return their start node as the root 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<string>(TreeQueryStringParameters.Application); var currApp = queryStrings.GetValue<string>(TreeQueryStringParameters.Application);
var userRoot = Services.EntityService.Get(UmbracoUser.StartNodeId, UmbracoObjectTypes.Document); var userRoot = Services.EntityService.Get(Security.CurrentUser.StartContentId, UmbracoObjectTypes.Document);
if (userRoot == null) if (userRoot == null)
{ {
throw new HttpResponseException(HttpStatusCode.NotFound); throw new HttpResponseException(HttpStatusCode.NotFound);

View File

@@ -14,17 +14,35 @@ namespace Umbraco.Web.Trees
[DataContract(Name = "node", Namespace = "")] [DataContract(Name = "node", Namespace = "")]
public sealed class SectionRootNode : TreeNode public sealed class SectionRootNode : TreeNode
{ {
public SectionRootNode(string nodeId, string menuUrl) public static SectionRootNode CreateMultiTreeSectionRoot(string nodeId, TreeNodeCollection children)
: base(nodeId, string.Empty, menuUrl) {
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 //default to false
IsContainer = false; IsContainer = false;
} }
[DataMember(Name = "isContainer")] [DataMember(Name = "isContainer")]
public bool IsContainer { get; set; } public bool IsContainer { get; private set; }
[DataMember(Name = "children")] [DataMember(Name = "children")]
public TreeNodeCollection Children { get; set; } public TreeNodeCollection Children { get; private set; }
} }
} }