Moves tree/menu models into the Models.Trees namespace
This commit is contained in:
48
src/Umbraco.Web/Models/Trees/SectionRootNode.cs
Normal file
48
src/Umbraco.Web/Models/Trees/SectionRootNode.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// A special tree node that represents the section root node for any section.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required to return the tree data for a given section. Some sections may only contain one tree which means it's section
|
||||
/// root should also display a menu, whereas other sections have multiple trees and the section root shouldn't display a menu.
|
||||
///
|
||||
/// The section root also contains an explicit collection of children.
|
||||
/// </remarks>
|
||||
[DataContract(Name = "node", Namespace = "")]
|
||||
public sealed class SectionRootNode : TreeNode
|
||||
{
|
||||
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; private set; }
|
||||
|
||||
[DataMember(Name = "children")]
|
||||
public TreeNodeCollection Children { get; private set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user