namespace Umbraco.Web.Models.Trees { public static class TreeNodeExtensions { internal const string LegacyJsCallbackKey = "jsClickCallback"; /// /// Legacy tree node's assign a JS method callback for when an item is clicked, this method facilitates that. /// /// /// internal static void AssignLegacyJsCallback(this TreeNode treeNode, string jsCallback) { treeNode.AdditionalData[LegacyJsCallbackKey] = jsCallback; } /// /// Sets the node style to show that it is currently protected publicly /// /// public static void SetProtectedStyle(this TreeNode treeNode) { if (treeNode.CssClasses.Contains("protected") == false) { treeNode.CssClasses.Add("protected"); } } /// /// Sets the node style to show that it is has unpublished versions (but is currently published) /// /// public static void SetHasUnpublishedVersionStyle(this TreeNode treeNode) { if (treeNode.CssClasses.Contains("has-unpublished-version") == false) { treeNode.CssClasses.Add("has-unpublished-version"); } } /// /// Sets the node style to show that it is is not published /// /// public static void SetNotPublishedStyle(this TreeNode treeNode) { if (treeNode.CssClasses.Contains("not-published") == false) { treeNode.CssClasses.Add("not-published"); } } } }