Merge pull request #2944 from umbraco/temp8-18-ListViewVariants
List View - Updates Node Name based on selected Variant
This commit is contained in:
@@ -456,7 +456,8 @@ namespace Umbraco.Web.Editors
|
||||
string orderBy = "SortOrder",
|
||||
Direction orderDirection = Direction.Ascending,
|
||||
bool orderBySystemField = true,
|
||||
string filter = "")
|
||||
string filter = "",
|
||||
string cultureName = "")
|
||||
{
|
||||
long totalChildren;
|
||||
IContent[] children;
|
||||
@@ -493,13 +494,16 @@ namespace Umbraco.Web.Editors
|
||||
Mapper.Map<IContent, ContentItemBasic<ContentPropertyBasic>>(content,
|
||||
opts =>
|
||||
{
|
||||
opts.Items[ResolutionContextExtensions.CultureKey] = cultureName;
|
||||
|
||||
// if there's a list of property aliases to map - we will make sure to store this in the mapping context.
|
||||
if (String.IsNullOrWhiteSpace(includeProperties) == false)
|
||||
if (string.IsNullOrWhiteSpace(includeProperties) == false)
|
||||
{
|
||||
opts.Items["IncludeProperties"] = includeProperties.Split(new[] { ", ", "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
return pagedResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,11 +79,20 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(dest => dest.Trashed, opt => opt.MapFrom(src => src.Trashed))
|
||||
.ForMember(dest => dest.ContentTypeAlias, opt => opt.MapFrom(src => src.ContentType.Alias))
|
||||
.ForMember(dest => dest.Alias, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.AdditionalData, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.AdditionalData, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Name, opt => opt.ResolveUsing<CultureNameResolver>());
|
||||
|
||||
//FROM IContent TO ContentPropertyCollectionDto
|
||||
//NOTE: the property mapping for cultures relies on a culture being set in the mapping context
|
||||
CreateMap<IContent, ContentPropertyCollectionDto>();
|
||||
}
|
||||
}
|
||||
|
||||
internal class CultureNameResolver : IValueResolver<IContent, ContentItemBasic<ContentPropertyBasic>, string>
|
||||
{
|
||||
public string Resolve(IContent source, ContentItemBasic<ContentPropertyBasic> destination, string destMember, ResolutionContext context)
|
||||
{
|
||||
return source.GetCultureName(context.GetCulture());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user