Created
December 7, 2013 19:44
-
-
Save warrenbuckley/7847581 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Net.Http.Formatting; | |
| using Umbraco.Core; | |
| using Umbraco.Web.Models.Trees; | |
| using Umbraco.Web.Mvc; | |
| using Umbraco.Web.Trees; | |
| namespace UmbracoDiagnostics | |
| { | |
| [Tree("developer", "diagnosticsTree", "Diagnostics")] | |
| [PluginController("Diagnostics")] | |
| public class DiagnosticsTreeController : TreeController | |
| { | |
| protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) | |
| { | |
| //check if we're rendering the root node's children | |
| if (id == Constants.System.Root.ToInvariantString()) | |
| { | |
| //Nodes that we will return | |
| var nodes = new TreeNodeCollection(); | |
| //Temp items for testing | |
| var items = new[] { "General", "Packages", "Users" , "Domains", "Assemblies", "Permissions", "Events", "MVC Routes", "Trees" }; | |
| foreach (var item in items) | |
| { | |
| //When clicked - /App_Plugins/Diagnostics/backoffice/diagnosticsTree/edit.html | |
| //URL in address bar - /developer/diagnosticsTree/edit/General | |
| var route = string.Format("developer/diagnosticsTree/{0}", item); | |
| var nodeToAdd = CreateTreeNode(item, null, queryStrings, item, "icon-server", false, route); | |
| //Add it to the collection | |
| nodes.Add(nodeToAdd); | |
| } | |
| //Return the nodes | |
| return nodes; | |
| } | |
| //this tree doesn't suport rendering more than 1 level | |
| throw new NotSupportedException(); | |
| } | |
| protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) | |
| { | |
| throw new System.NotImplementedException(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var nodeToAdd = CreateTreeNode(item, null, queryStrings, item, "icon-server", false);
nodeToAdd.RoutePath = "/developer/diagnosticsTree/general/" + item.Id;
Hope it helps it's required to pass a id to the routepath