Finalizes the implementation of getting the menu items rendering for child of listview items for both content and media.

This commit is contained in:
Shannon
2013-12-12 14:10:03 +11:00
parent 74a691ac3a
commit 8785239964
11 changed files with 166 additions and 109 deletions

View File

@@ -91,31 +91,22 @@ namespace Umbraco.Web.Models.Mapping
}
private static void AfterMap(IContent content, ContentItemDisplay display)
{
MapGenericCustomProperties(content, display);
MapTreeNodeUrl(content, display);
}
private static void MapTreeNodeUrl(IContent content, ContentItemDisplay display)
{
if (HttpContext.Current == null)
{
return;
}
var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()));
var url = urlHelper.GetUmbracoApiService<ContentTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null));
display.TreeNodeUrl = url;
}
/// <summary>
/// Maps the generic tab with custom properties for content
/// </summary>
/// <param name="content"></param>
/// <param name="display"></param>
private static void MapGenericCustomProperties(IContent content, ContentItemDisplay display)
private static void AfterMap(IContent content, ContentItemDisplay display)
{
//map the tree node url
if (HttpContext.Current != null)
{
var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()));
var url = urlHelper.GetUmbracoApiService<ContentTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null));
display.TreeNodeUrl = url;
}
//fill in the template config to be passed to the template drop down.
var templateItemConfig = new Dictionary<string, string> { { "", "Choose..." } };
foreach (var t in content.ContentType.AllowedTemplates)