U4-7414 Deleted tab's properties should become generic properties

This commit is contained in:
Stephan
2015-11-17 16:29:57 +01:00
parent 2b369a57d8
commit 8d00d931b0
2 changed files with 14 additions and 1 deletions

View File

@@ -533,6 +533,18 @@ namespace Umbraco.Core.Models
/// <param name="propertyGroupName">Name of the <see cref="PropertyGroup"/> to remove</param>
public void RemovePropertyGroup(string propertyGroupName)
{
// if no group exists with that name, do nothing
var group = PropertyGroups[propertyGroupName];
if (group == null) return;
// re-assign the group's properties to no group
foreach (var property in group.PropertyTypes)
{
property.PropertyGroupId = new Lazy<int>(() => 0);
_propertyTypes.Add(property);
}
// actually remove the group
PropertyGroups.RemoveItem(propertyGroupName);
OnPropertyChanged(PropertyGroupCollectionSelector);
}

View File

@@ -1475,7 +1475,8 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
var propertyGroup = _contentType.ContentTypeItem.PropertyGroups.FirstOrDefault(x => x.Id == propertyGroupId);
if (propertyGroup != null && string.IsNullOrEmpty(propertyGroup.Name) == false)
{
_contentType.ContentTypeItem.PropertyGroups.Remove(propertyGroup.Name);
// use RemovePropertyGroup so properties become generic
_contentType.ContentTypeItem.RemovePropertyGroup(propertyGroup.Name);
_contentType.Save();
}
//}