From 76d9efb39861f64c0c987bd4c1f56a5c87bf8dd7 Mon Sep 17 00:00:00 2001 From: Per Ploug Krogslund Date: Tue, 7 Jul 2015 11:29:11 +0200 Subject: [PATCH] Default listview and custom listview lookup --- .../Models/Mapping/ContentTypeModelMapper.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs index cd5dd0bec3..5c616d3e3a 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeModelMapper.cs @@ -135,10 +135,15 @@ namespace Umbraco.Web.Models.Mapping expression => expression.ResolveUsing(new PropertyTypeGroupResolver(applicationContext, _propertyEditorResolver))) .AfterMap(((type, display) => { - //TODO : How do we avoid hardcoding content here? - display.ListViewEditorName = Constants.Conventions.DataTypes.ListViewPrefix + type.Alias; - if (string.IsNullOrEmpty(type.Alias)) - display.ListViewEditorName += "Content"; + //default + display.ListViewEditorName = Constants.Conventions.DataTypes.ListViewPrefix + "Content"; + if (string.IsNullOrEmpty(type.Name) == false) + { + var name = Constants.Conventions.DataTypes.ListViewPrefix + type.Name; + if(applicationContext.Services.DataTypeService.GetDataTypeDefinitionByName(name) != null) + display.ListViewEditorName = name; + } + })); config.CreateMap()