Fixes: U4-7021 "Actions" dropdown not available to children in listview nodes

This commit is contained in:
Shannon
2015-10-27 18:13:18 +01:00
parent badd9ae289
commit f0b68ac31e
2 changed files with 7 additions and 10 deletions

View File

@@ -51,11 +51,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(
dto => dto.IsContainer,
expression => expression.MapFrom(content => content.ContentType.IsContainer))
.ForMember(
dto => dto.IsChildOfListView,
//TODO: Fix this shorthand .Parent() lookup, at least have an overload to use the current
// application context so it's testable!
expression => expression.MapFrom(content => content.Parent().ContentType.IsContainer))
.ForMember(display => display.IsChildOfListView, expression => expression.Ignore())
.ForMember(
dto => dto.Trashed,
expression => expression.MapFrom(content => content.Trashed))
@@ -121,6 +117,11 @@ namespace Umbraco.Web.Models.Mapping
/// <param name="localizedText"></param>
private static void AfterMap(IContent content, ContentItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText)
{
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
//TODO: Fix this shorthand .Ancestors() lookup, at least have an overload to use the current
var ancesctorListView = content.Ancestors().FirstOrDefault(x => x.ContentType.IsContainer);
display.IsChildOfListView = ancesctorListView != null;
//map the tree node url
if (HttpContext.Current != null)
{

View File

@@ -35,11 +35,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(
dto => dto.ContentTypeAlias,
expression => expression.MapFrom(content => content.ContentType.Alias))
.ForMember(
dto => dto.IsChildOfListView,
//TODO: Fix this shorthand .Parent() lookup, at least have an overload to use the current
// application context so it's testable!
expression => expression.MapFrom(content => content.Parent().ContentType.IsContainer))
.ForMember(display => display.IsChildOfListView, expression => expression.Ignore())
.ForMember(
dto => dto.Trashed,
expression => expression.MapFrom(content => content.Trashed))