Merge pull request #1650 from Bitmapped/U4-9298

Fix U4-9298
This commit is contained in:
hartvig
2017-01-03 12:56:46 +01:00
committed by GitHub
2 changed files with 8 additions and 6 deletions

View File

@@ -404,8 +404,7 @@ namespace Umbraco.Core.Models
return content.Properties
.Where(property => propertyGroup.PropertyTypes
.Select(propertyType => propertyType.Id)
.Contains(property.PropertyTypeId))
.OrderBy(x => x.PropertyType.SortOrder);
.Contains(property.PropertyTypeId));
}
/// <summary>

View File

@@ -229,7 +229,7 @@ namespace Umbraco.Web.Models.Mapping
var groupsGroupsByName = content.PropertyGroups.OrderBy(x => x.SortOrder).GroupBy(x => x.Name);
foreach (var groupsByName in groupsGroupsByName)
{
var properties = new List<ContentPropertyDisplay>();
var properties = new List<Property>();
// merge properties for groups with the same name
foreach (var group in groupsByName)
@@ -237,13 +237,16 @@ namespace Umbraco.Web.Models.Mapping
var groupProperties = content.GetPropertiesForGroup(group)
.Where(x => IgnoreProperties.Contains(x.Alias) == false); // skip ignored
properties.AddRange(Mapper.Map<IEnumerable<Property>, IEnumerable<ContentPropertyDisplay>>(groupProperties));
properties.AddRange(groupProperties);
}
if (properties.Count == 0)
continue;
TranslateProperties(properties);
// Sort properties so items from different compositions appear in correct order (see U4-9298). Map sorted properties.
var mappedProperties = Mapper.Map<IEnumerable<Property>, IEnumerable<ContentPropertyDisplay>>(properties.OrderBy(prop => prop.PropertyType.SortOrder));
TranslateProperties(mappedProperties);
// add the tab
// we need to pick an identifier... there is no "right" way...
@@ -256,7 +259,7 @@ namespace Umbraco.Web.Models.Mapping
Id = groupId,
Alias = groupName,
Label = _localizedTextService.UmbracoDictionaryTranslate(groupName),
Properties = properties,
Properties = mappedProperties,
IsActive = false
});
}