Umbraco 7 - 自定义菜单项和树,导航如何工作?

Umbraco 7 - Custom Menu Items & Trees, How does navigation work?

我有一个自定义部分,带有自定义树。

在以下情况下,我无法理解您如何设置正确的行为:

您单击树中的一个节点进行编辑。 您单击 "Create" 等节点上的菜单项 在我的解决方案中,我使用相同的视图来编辑和创建记录。

在我的树中,节点是这样生成的。

var routeToView = "rewards/rewardsTree/editcampaign/campaign-" + campaign.Id.ToString();

var campaignNode = CreateTreeNode("campaign-" + campaign.Id.ToString(), id.Split('-')[1], queryStrings, campaign.CampaignName, "icon-folder color-yellow", true, routeToView);

这正在生成我想要的路线:(我的 html 文件的名称是 editcampaign.html)并且它还传递 "campaign-6"

/umbraco#/rewards/rewardsTree/editcampaign/campaign-6

当用户单击节点上的创建 'menu Item' - 我想将它们发送到相同的 URL 但只是使用不同的 ID 例如:

umbraco#/rewards/rewardsTree/editcampaign/brand-1

而且我不希望它从侧面弹出

这是我目前尝试过的方法:

//This finds the view, but it comes up in a dialog also how do I pass the Id (brand-1)
     MenuItem mi = new MenuItem("editcampaign", "Create Campaign");
                    menuItemCollection.Items.Add(mi);

//Also Tried this finds puts a whole another umbraco UI inside a dialog

mi.LaunchDialogView("#rewards/rewardsTree/editcampaign/brand-1", "TITLE GOES HERE");

谁能给我指点关于菜单树和一般后台导航的最完整文档?

我相信 "Create" 菜单项上有一个设置视图路径的选项,它可以正常打开吗?另外,让你的路径像 /view/path/here/id 不是更有意义吗?然后,当您创建一个新项目时,只需发送 0 作为 id。 Github 上的 Umbrangular 是一个包含自定义部分和视图示例的项目。

编辑:这是一个例子

protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
    var menu = new MenuItemCollection();

    MenuItem createCategory = new MenuItem("createcategory", "Create Category");

    createCategory.AdditionalData.Add("ParentCategoryId", id);

    createCategory.NavigateToRoute("/path/to/view/category/0");

    createCategory.Icon = "add";

    menu.Items.Add(createCategory);

    return menu;
}