Refactoring TreeNode to inherit from EntityBasic = makes much more sense and makes our models more consistent.

This commit is contained in:
Shannon
2013-11-12 12:30:10 +11:00
parent 635ccc444d
commit acd52d42f4
7 changed files with 17 additions and 38 deletions

View File

@@ -2,6 +2,7 @@
using Umbraco.Core.IO;
using System.Collections.Generic;
using Umbraco.Core;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Trees
{
@@ -12,7 +13,7 @@ namespace Umbraco.Web.Models.Trees
/// TreeNode is sealed to prevent developers from adding additional json data to the response
/// </remarks>
[DataContract(Name = "node", Namespace = "")]
public class TreeNode
public class TreeNode : EntityBasic
{
/// <summary>
/// Internal constructor, to create a tree node use the CreateTreeNode methods of the TreeApiController.
@@ -22,35 +23,20 @@ namespace Umbraco.Web.Models.Trees
/// <param name="menuUrl"></param>
internal TreeNode(string nodeId, string getChildNodesUrl, string menuUrl)
{
//_menuItems = menuItems;
//Style = new NodeStyle();
NodeId = nodeId;
AdditionalData = new Dictionary<string, object>();
Id = nodeId;
ChildNodesUrl = getChildNodesUrl;
MenuUrl = menuUrl;
CssClasses = new List<string>();
//default
Icon = "icon-folder-close";
}
/// <summary>
/// The unique identifier for the node
/// </summary>
[DataMember(Name = "id")]
public string NodeId { get; private set; }
/// <summary>
/// A flag to set whether or not this node has children
/// </summary>
[DataMember(Name = "hasChildren")]
public bool HasChildren { get; set; }
/// <summary>
/// The text title of the node that is displayed in the tree
/// </summary>
[DataMember(Name = "name")]
public string Title { get; set; }
/// <summary>
/// The tree nodetype which refers to the type of node rendered in the tree
/// </summary>
@@ -77,14 +63,7 @@ namespace Umbraco.Web.Models.Trees
/// </summary>
[DataMember(Name = "menuUrl")]
public string MenuUrl { get; set; }
/// <summary>
/// A dictionary to support any additional meta data that should be rendered for the node which is
/// useful for custom action commands such as 'create', 'copy', etc...
/// </summary>
[DataMember(Name = "metaData")]
public Dictionary<string, object> AdditionalData { get; private set; }
/// <summary>
/// The icon to use for the node, this can be either a path to an image or a Css class.
/// If a '/' is found in the string then it will be considered a path to an image.