Copied to clipboard

Flag this post as spam?

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


  • K.Garrein 164 posts 629 karma points
    Oct 07, 2015 @ 06:54
    K.Garrein
    0

    edit page for custom section menu item

    How do you define which Angularjs page to use as the edit page for a menu item on a custom tree in the backoffice? It seems Umbraco always expects edit.html?

    protected override MenuItemCollection GetMenuForNode( string id, FormDataCollection queryStrings )
    {
        var menu = new MenuItemCollection();
    
        string lang = Security.CurrentUser.Language;
    
        if( id == Constants.System.Root.ToInvariantString() )
        {
            menu.Items.Add<CreateChildEntity, ActionNull>( "" );
        }
        else if( id == "productcategories" )
        {
            menu.Items.Add<CreateChildEntity, ActionNew>( ui.Text( "actions", ActionNew.Instance.Alias ) );
        }
    
        menu.Items.Add<RefreshNode, ActionRefresh>( ui.Text( "actions", ActionRefresh.Instance.Alias ), true );
    
        return menu;
    }
    

    If you click "new" on the productcategories menu node, I would like to use "productcategories-edit.html" as the edit page. Is that possible?

    K.

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Oct 07, 2015 @ 07:20
    Robert Foster
    100

    There's conventions around what to call the edit pages etc. with the back office - dashboards, edit pages, etc. are all expected to be in a particular location and have a particular name, I'm not sure whether the documentation on it all though is very clear or even updated at the moment.

    For tree edit dialogs - if I have a tree controller defined like so:

    [Tree("products", "productCategories", "Product Categories")]
    [PluginController("Products")]
    public class ProductCategoryTreeController : TreeController {
    
    }
    

    Then I need to create my edit form angular view here:

    ~/App_Plugins/Products/productCategories/edit.html
    

    So the location is as follows:

    ~/App_Plugins/<AppAlias>/<TreeAlias>/edit.html
    

    Tip: you could also find out where to place one of these forms for convention-based file locations/names by inspecting the network calls and looking for the 404 results when you try to create a new node etc.

  • K.Garrein 164 posts 629 karma points
    Oct 07, 2015 @ 07:26
    K.Garrein
    0

    Thank you.

    Meanwhile, I also found that the following does what I need:

    MenuItem mi = new MenuItem( "productcategories-edit", "New product category" );
     mi.Icon = "icon icon-add";
     menu.Items.Add( mi );
    

    So problem solved.

    And yes, I really have the impression that the documentation is currently lacking a lot of needed information...

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Oct 07, 2015 @ 07:28
    Robert Foster
    0

    Great - glad you worked it out :)

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Oct 07, 2015 @ 13:29
    David Brendel
    0

    Keep up n Kind that you can also override the name if the view that is called. So if you have more then one Bode type you mostly need an editNodeA and editNodeB.

    Have a look at the parameters of the createtreenode method in your tree.

    Currently in mobile so can't copy example that i have.

Please Sign in or register to post replies

Write your reply to:

Draft