Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adriano Fabri 469 posts 1633 karma points
    Apr 20, 2016 @ 15:02
    Adriano Fabri
    0

    How can I link my custom section tree item to my custom ng view?

    Hi to all, I'm creating a back-end package with a custom sections.

    Normally, when I create the tree (with an element named "test"), Umbraco by default link it to edit.html file in

    App_Plugin
        |=>ADRIANO
            |=>backoffice
                |=>test
                    |=>edit.html
    

    Now I created a new view folder inside test, that contain my custom ng-view "test.html"

    How can I change the treeController to link my tree item to my test.html file? There is another way to do this?

    TreeController.cs

    protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
            {
                var tree = new TreeNodeCollection();
    
                // check if we're rendering the root node's children
                if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString())
                {
                    tree = new TreeNodeCollection
                {
                    CreateTreeNode("Node1", "-1", queryStrings, "Node1 Manager", "icon-list", true),
                    CreateTreeNode("Node2", "-1", queryStrings, "Node3 Manager", "icon-users", true)
                };
    
                    return tree;
                }
                else
                {
                    switch (id)
                    {
                        case "Node1": 
                            tree = new TreeNodeCollection {
                            CreateTreeNode("Node1-show", id, queryStrings, "Show", "icon-binoculars color-green", false),
                            CreateTreeNode("Node1-cleanup", id, queryStrings, "Cleanup", "icon-delete color-red", false)
                        };
                            break;
    
                        case "Node2": 
                            tree = new TreeNodeCollection {
                            CreateTreeNode("test", id, queryStrings, "test", "icon-delete color-red", false)
                        };
                            break;
                    }
    
                    return tree;
                }
    
                //this tree doesn't suport rendering more than 1 level
                throw new NotSupportedException();
            }
    

    Adriano

Please Sign in or register to post replies

Write your reply to:

Draft