Start updating the model/controller for editing variants in the back office and wiring up the angular side of things

This commit is contained in:
Shannon
2018-04-03 19:25:43 +10:00
parent 271a100759
commit e7bc4986a5
14 changed files with 151 additions and 88 deletions

View File

@@ -13,7 +13,7 @@ namespace Umbraco.Web.Models.Mapping
/// </summary>
internal class ContentMapperProfile : Profile
{
public ContentMapperProfile(IUserService userService, ILocalizedTextService textService, IContentService contentService, IContentTypeService contentTypeService, IDataTypeService dataTypeService)
public ContentMapperProfile(IUserService userService, ILocalizedTextService textService, IContentService contentService, IContentTypeService contentTypeService, IDataTypeService dataTypeService, ILocalizationService localizationService)
{
// create, capture, cache
var contentOwnerResolver = new OwnerResolver<IContent>(userService);
@@ -25,12 +25,14 @@ namespace Umbraco.Web.Models.Mapping
var contentTreeNodeUrlResolver = new ContentTreeNodeUrlResolver<IContent, ContentTreeController>();
var defaultTemplateResolver = new DefaultTemplateResolver();
var contentUrlResolver = new ContentUrlResolver();
var variantResolver = new VariationResolver(localizationService);
//FROM IContent TO ContentItemDisplay
CreateMap<IContent, ContentItemDisplay>()
.ForMember(dest => dest.Udi, opt => opt.MapFrom(src => Udi.Create(src.Blueprint ? Constants.UdiEntityType.DocumentBlueprint : Constants.UdiEntityType.Document, src.Key)))
.ForMember(dest => dest.Owner, opt => opt.ResolveUsing(src => contentOwnerResolver.Resolve(src)))
.ForMember(dest => dest.Updater, opt => opt.ResolveUsing(src => creatorResolver.Resolve(src)))
.ForMember(dest => dest.Variants, opt => opt.ResolveUsing(variantResolver))
.ForMember(dest => dest.Icon, opt => opt.MapFrom(src => src.ContentType.Icon))
.ForMember(dest => dest.ContentTypeAlias, opt => opt.MapFrom(src => src.ContentType.Alias))
.ForMember(dest => dest.ContentTypeName, opt => opt.MapFrom(src => src.ContentType.Name))