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.
*/
scope.animation = function () {
if (enableDeleteAnimations) {
if (enableDeleteAnimations && scope.tree.root.expanded) {
return { leave: 'tree-node-delete-leave' };
}
else {

View File

@@ -61,11 +61,7 @@ namespace Umbraco.Web.Trees
collection.Add(rootNode);
}
return new SectionRootNode(rootId, "")
{
Children = collection,
IsContainer = true
};
return SectionRootNode.CreateMultiTreeSectionRoot(rootId, collection);
}
/// <summary>
@@ -113,13 +109,13 @@ namespace Umbraco.Web.Trees
throw new InvalidOperationException("Could not create root node for tree " + configTree.Alias);
}
var sectionRoot = new SectionRootNode(
var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
rootId,
rootNode.Result.MenuUrl)
{
Title = rootNode.Result.Title,
Children = byControllerAttempt.Result
};
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(
var sectionRoot = SectionRootNode.CreateSingleTreeSectionRoot(
rootId,
"", //TODO: I think we'll need this in this situation!
Url.GetUmbracoApiService<LegacyTreeController>("GetMenu", rootId)
+ "&parentId=" + rootId
+ "&treeType=" + application
+ "&section=" + application)
{
Children = legacyAttempt.Result
};
+ "&section=" + application,
"", //TODO: I think we'll need this in this situation!
legacyAttempt.Result);
sectionRoot.AdditionalData.Add("treeAlias", configTree.Alias);
return sectionRoot;
}

View File

@@ -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<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)
{
throw new HttpResponseException(HttpStatusCode.NotFound);

View File

@@ -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; }
}
}