Reverts the 'special property' for list views as that is no longer required.
This commit is contained in:
@@ -11,11 +11,6 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public static class Conventions
|
||||
{
|
||||
public static class PropertyTypes
|
||||
{
|
||||
public const string ListViewPropertyAlias = Constants.PropertyEditors.InternalGenericPropertiesPrefix + "containerView";
|
||||
}
|
||||
|
||||
public static class PropertyGroups
|
||||
{
|
||||
public const string ListViewGroupName = "umbContainerView";
|
||||
|
||||
@@ -141,9 +141,6 @@ AND umbracoNode.nodeObjectType = @objectType",
|
||||
|
||||
var propertyFactory = new PropertyGroupFactory(nodeDto.NodeId);
|
||||
|
||||
//If the entity is a container, ensure that the container property and group are there
|
||||
EnsureListViewProperty(entity);
|
||||
|
||||
//Insert Tabs
|
||||
foreach (var propertyGroup in entity.PropertyGroups)
|
||||
{
|
||||
@@ -275,8 +272,6 @@ AND umbracoNode.id <> @id",
|
||||
});
|
||||
}
|
||||
|
||||
//If the entity is a container, ensure that the container property and group are there
|
||||
EnsureListViewProperty(entity);
|
||||
|
||||
if (((ICanBeDirty) entity).IsPropertyDirty("PropertyTypes") || entity.PropertyTypes.Any(x => x.IsDirty()))
|
||||
{
|
||||
@@ -479,54 +474,6 @@ AND umbracoNode.id <> @id",
|
||||
});
|
||||
}
|
||||
|
||||
private void EnsureListViewProperty(IContentTypeComposition entity)
|
||||
{
|
||||
//If the entity is a container, ensure that the container property and group are there, otherwise if it is not a container,
|
||||
// ensure to remove the built in props/tab
|
||||
|
||||
if (entity.IsContainer == false)
|
||||
{
|
||||
if (entity.PropertyTypeExists(Constants.PropertyEditors.ListViewAlias))
|
||||
{
|
||||
entity.RemovePropertyType(Constants.PropertyEditors.ListViewAlias);
|
||||
}
|
||||
if (entity.PropertyGroups.Contains(Constants.Conventions.PropertyGroups.ListViewGroupName))
|
||||
{
|
||||
entity.RemovePropertyGroup(Constants.Conventions.PropertyGroups.ListViewGroupName);
|
||||
}
|
||||
}
|
||||
else if (entity.PropertyTypeExists(Constants.PropertyEditors.ListViewAlias) == false)
|
||||
{
|
||||
PropertyGroup group;
|
||||
if (entity.PropertyGroups.Contains(Constants.Conventions.PropertyGroups.ListViewGroupName))
|
||||
{
|
||||
group = entity.PropertyGroups[Constants.Conventions.PropertyGroups.ListViewGroupName];
|
||||
}
|
||||
else
|
||||
{
|
||||
group = new PropertyGroup
|
||||
{
|
||||
Name = Constants.Conventions.PropertyGroups.ListViewGroupName,
|
||||
SortOrder = entity.PropertyGroups.Any() ? entity.PropertyGroups.Max(x => x.SortOrder) + 1 : 1
|
||||
};
|
||||
}
|
||||
|
||||
group.PropertyTypes = new PropertyTypeCollection(new[]
|
||||
{
|
||||
new PropertyType(Constants.PropertyEditors.ListViewAlias, DataTypeDatabaseType.Nvarchar)
|
||||
{
|
||||
Alias = Constants.Conventions.PropertyTypes.ListViewPropertyAlias,
|
||||
Name = Constants.Conventions.PropertyTypes.ListViewPropertyAlias,
|
||||
DataTypeDefinitionId = 1037
|
||||
}
|
||||
});
|
||||
|
||||
entity.PropertyGroups.Add(group);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to set the data type id based on its ControlId
|
||||
/// </summary>
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Umbraco.Web.Editors
|
||||
var mapped = Mapper.Map<IContent, ContentItemDisplay>(emptyContent);
|
||||
|
||||
//remove this tab if it exists: umbContainerView
|
||||
var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == "umbContainerView");
|
||||
var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName);
|
||||
mapped.Tabs = mapped.Tabs.Except(new[] {containerTab});
|
||||
return mapped;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Umbraco.Web.Editors
|
||||
var mapped = Mapper.Map<IMedia, MediaItemDisplay>(emptyContent);
|
||||
|
||||
//remove this tab if it exists: umbContainerView
|
||||
var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == "umbContainerView");
|
||||
var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName);
|
||||
mapped.Tabs = mapped.Tabs.Except(new[] { containerTab });
|
||||
return mapped;
|
||||
}
|
||||
|
||||
@@ -121,30 +121,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
|
||||
var listViewProp = display.Properties.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyTypes.ListViewPropertyAlias);
|
||||
|
||||
//check if the list view property is already there (it should be with 7.2+)
|
||||
if (listViewProp != null)
|
||||
{
|
||||
//ensure label is hidden
|
||||
listViewProp.HideLabel = true;
|
||||
listViewProp.Value = null;
|
||||
listViewProp.Label = "";
|
||||
|
||||
var defaultViewTab = display.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName);
|
||||
if (defaultViewTab != null)
|
||||
{
|
||||
//it's the default one, so localize the name
|
||||
defaultViewTab.Label = ui.Text("content", "childItems");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//something is a bit strange with the data, there should def be a list view property but seeing as there is not, we'll put a warning
|
||||
// in the log and create one dynamically like we did pre 7.2
|
||||
|
||||
LogHelper.Warn<TabsAndPropertiesResolver>("No list view property type was found on the content item, a dynamic one will be created. Since 7.2.0 there should be a real list view property type on a list view content type");
|
||||
|
||||
var listViewTab = new Tab<ContentPropertyDisplay>();
|
||||
listViewTab.Alias = Constants.Conventions.PropertyGroups.ListViewGroupName;
|
||||
listViewTab.Label = ui.Text("content", "childItems");
|
||||
@@ -154,7 +130,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
var listViewProperties = new List<ContentPropertyDisplay>();
|
||||
listViewProperties.Add(new ContentPropertyDisplay
|
||||
{
|
||||
Alias = Constants.Conventions.PropertyTypes.ListViewPropertyAlias,
|
||||
Alias = string.Format("{0}containerView", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
|
||||
Label = "",
|
||||
Value = null,
|
||||
View = "listview",
|
||||
@@ -171,7 +147,6 @@ namespace Umbraco.Web.Models.Mapping
|
||||
tabs.Add(listViewTab);
|
||||
tabs.AddRange(display.Tabs);
|
||||
display.Tabs = tabs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -867,17 +867,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
|
||||
{
|
||||
filteredDefinitions = allDtds;
|
||||
|
||||
//special case if this is a list view, if so, filter the dtd's to only include other list view types,
|
||||
// don't allow editing of anything except for the tab and data type
|
||||
if (pt.Alias == Constants.Conventions.PropertyTypes.ListViewPropertyAlias)
|
||||
{
|
||||
//filter the dtds to only list view
|
||||
filteredDefinitions = allDtds.Where(x => x.PropertyEditorAlias == Constants.PropertyEditors.ListViewAlias).ToArray();
|
||||
|
||||
var gpw = new GenericPropertyWrapper(false, true, false, true, false, false, false);
|
||||
return gpw;
|
||||
}
|
||||
|
||||
//not editable if any of the built in member types
|
||||
if (_contentType.ContentTypeItem is IMemberType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user