Updates UI and mapping to update a property type to allow being culture variant
This commit is contained in:
@@ -46,5 +46,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
//SD: Is this really needed ?
|
||||
[DataMember(Name = "groupId")]
|
||||
public int GroupId { get; set; }
|
||||
|
||||
[DataMember(Name = "allowCultureVariant")]
|
||||
public bool AllowCultureVariant { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
.ForMember(dest => dest.PropertyEditorAlias, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.DeleteDate, opt => opt.Ignore())
|
||||
|
||||
.ForMember(dto => dto.Variations, opt => opt.Ignore()) // fixme - change when UI supports it!
|
||||
.ForMember(dto => dto.Variations, opt => opt.ResolveUsing<PropertyTypeVariationsResolver>())
|
||||
|
||||
//only map if it is actually set
|
||||
.ForMember(dest => dest.Id, opt => opt.Condition(source => source.Id > 0))
|
||||
|
||||
@@ -220,7 +220,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
DataTypeId = p.DataTypeId,
|
||||
SortOrder = p.SortOrder,
|
||||
ContentTypeId = contentType.Id,
|
||||
ContentTypeName = contentType.Name
|
||||
ContentTypeName = contentType.Name,
|
||||
AllowCultureVariant = p.Variations.HasFlag(Core.Models.ContentVariation.CultureNeutral)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using ContentVariation = Umbraco.Core.Models.ContentVariation;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
internal class PropertyTypeVariationsResolver: IValueResolver<PropertyTypeBasic, PropertyType, ContentVariation>
|
||||
{
|
||||
public ContentVariation Resolve(PropertyTypeBasic source, PropertyType destination, ContentVariation destMember, ResolutionContext context)
|
||||
{
|
||||
//this will always be the case, a content type will always be allowed to be invariant
|
||||
var result = ContentVariation.InvariantNeutral;
|
||||
|
||||
if (source.AllowCultureVariant)
|
||||
{
|
||||
result |= ContentVariation.CultureNeutral;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user