Use camel case for alias and fix infinite loop in IndexOfKey
This commit is contained in:
@@ -223,14 +223,14 @@ namespace Umbraco.Core.Migrations.Install
|
||||
|
||||
private void CreatePropertyTypeGroupData()
|
||||
{
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 3, UniqueId = new Guid(Constants.PropertyTypeGroups.Image), ContentTypeNodeId = 1032, Text = "Image", Alias = "Image", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 4, UniqueId = new Guid(Constants.PropertyTypeGroups.File), ContentTypeNodeId = 1033, Text = "File", Alias = "File", SortOrder = 1, });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 52, UniqueId = new Guid(Constants.PropertyTypeGroups.Video), ContentTypeNodeId = 1034, Text = "Video", Alias = "Video", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 53, UniqueId = new Guid(Constants.PropertyTypeGroups.Audio), ContentTypeNodeId = 1035, Text = "Audio", Alias = "Audio", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 54, UniqueId = new Guid(Constants.PropertyTypeGroups.Article), ContentTypeNodeId = 1036, Text = "Article", Alias = "Article", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 55, UniqueId = new Guid(Constants.PropertyTypeGroups.VectorGraphics), ContentTypeNodeId = 1037, Text = "Vector Graphics", Alias = "VectorGraphics", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 3, UniqueId = new Guid(Constants.PropertyTypeGroups.Image), ContentTypeNodeId = 1032, Text = "Image", Alias = "image", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 4, UniqueId = new Guid(Constants.PropertyTypeGroups.File), ContentTypeNodeId = 1033, Text = "File", Alias = "file", SortOrder = 1, });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 52, UniqueId = new Guid(Constants.PropertyTypeGroups.Video), ContentTypeNodeId = 1034, Text = "Video", Alias = "video", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 53, UniqueId = new Guid(Constants.PropertyTypeGroups.Audio), ContentTypeNodeId = 1035, Text = "Audio", Alias = "audio", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 54, UniqueId = new Guid(Constants.PropertyTypeGroups.Article), ContentTypeNodeId = 1036, Text = "Article", Alias = "article", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 55, UniqueId = new Guid(Constants.PropertyTypeGroups.VectorGraphics), ContentTypeNodeId = 1037, Text = "Vector Graphics", Alias = "vectorGraphics", SortOrder = 1 });
|
||||
//membership property group
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership), ContentTypeNodeId = 1044, Text = "Membership", Alias = "Membership", SortOrder = 1 });
|
||||
_database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership), ContentTypeNodeId = 1044, Text = "Membership", Alias = "membership", SortOrder = 1 });
|
||||
}
|
||||
|
||||
private void CreatePropertyTypeData()
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_16_0
|
||||
foreach (var dto in dtos)
|
||||
{
|
||||
// Generate alias from current name
|
||||
dto.Alias = dto.Text.ToSafeAlias();
|
||||
dto.Alias = dto.Text.ToSafeAlias(true);
|
||||
|
||||
Database.Update(dto, x => new { x.Alias });
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Umbraco.Core.Models
|
||||
/// <inheritdoc />
|
||||
public override bool AddPropertyGroup(string groupName)
|
||||
{
|
||||
return AddAndReturnPropertyGroup(groupName, groupName.ToSafeAlias()) != null;
|
||||
return AddAndReturnPropertyGroup(groupName, groupName.ToSafeAlias(true)) != null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -267,8 +267,8 @@ namespace Umbraco.Core.Models
|
||||
|
||||
// get and ensure a group local to this content type
|
||||
var group = PropertyGroups.FirstOrDefault(x => x.Alias == propertyGroupName)
|
||||
?? PropertyGroups.FirstOrDefault(x => x.Alias == propertyGroupName.ToSafeAlias()) // TODO Remove in v9 (only needed for backwards compatibility with names)
|
||||
?? AddAndReturnPropertyGroup(propertyGroupName, propertyGroupName.ToSafeAlias()); // TODO Do we need both name and alias for this to work?
|
||||
?? PropertyGroups.FirstOrDefault(x => x.Alias == propertyGroupName.ToSafeAlias(true)) // TODO Remove in v9 (only needed for backwards compatibility with names)
|
||||
?? AddAndReturnPropertyGroup(propertyGroupName, propertyGroupName.ToSafeAlias(true)); // TODO Do we need both name and alias for this to work?
|
||||
if (group == null)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Umbraco.Core.Models
|
||||
var item = base[key];
|
||||
if (item == null && !key.Contains('/'))
|
||||
{
|
||||
item = base[key.ToSafeAlias()];
|
||||
item = base[key.ToSafeAlias(true)];
|
||||
}
|
||||
|
||||
return item;
|
||||
@@ -114,7 +114,7 @@ namespace Umbraco.Core.Models
|
||||
// Ensure alias is set
|
||||
if (string.IsNullOrEmpty(item.Alias))
|
||||
{
|
||||
item.Alias = item.Name.ToSafeAlias();
|
||||
item.Alias = item.Name.ToSafeAlias(true);
|
||||
}
|
||||
|
||||
// Note this is done to ensure existing groups can be renamed
|
||||
@@ -172,7 +172,7 @@ namespace Umbraco.Core.Models
|
||||
public new bool Contains(string key)
|
||||
{
|
||||
// TODO Remove this method in v9 (only needed for backwards compatibility with names)
|
||||
return base.Contains(key) || (!key.Contains('/') && base.Contains(key.ToSafeAlias()));
|
||||
return base.Contains(key) || (!key.Contains('/') && base.Contains(key.ToSafeAlias(true)));
|
||||
}
|
||||
|
||||
public bool Contains(int id)
|
||||
@@ -195,7 +195,7 @@ namespace Umbraco.Core.Models
|
||||
if (index == -1 && !key.Contains('/'))
|
||||
{
|
||||
// TODO Clean up for v9 (only needed for backwards compatibility with names)
|
||||
index = this.IndexOfKey(key.ToSafeAlias());
|
||||
index = this.FindIndex(x => x.Alias == key.ToSafeAlias(true));
|
||||
}
|
||||
|
||||
return index;
|
||||
|
||||
@@ -747,7 +747,7 @@ namespace Umbraco.Core.Packaging
|
||||
var alias = propertyGroupElement.Element("Alias")?.Value;
|
||||
if (string.IsNullOrEmpty(alias))
|
||||
{
|
||||
alias = name.ToSafeAlias();
|
||||
alias = name.ToSafeAlias(true);
|
||||
}
|
||||
|
||||
contentType.AddPropertyGroup(name, alias);
|
||||
|
||||
@@ -140,14 +140,10 @@ namespace Umbraco.Web.Models.Mapping
|
||||
// if there are any generic properties, add the corresponding tab
|
||||
if (genericProperties.Any())
|
||||
{
|
||||
string name = "Generic properties",
|
||||
alias = name.ToSafeAlias();
|
||||
|
||||
var genericGroup = new PropertyGroupDisplay<TPropertyType>
|
||||
{
|
||||
Id = PropertyGroupBasic.GenericPropertiesGroupId,
|
||||
Name = name,
|
||||
Alias = alias,
|
||||
Name = "Generic properties",
|
||||
SortOrder = 999,
|
||||
ContentTypeId = source.Id,
|
||||
Properties = genericProperties
|
||||
|
||||
Reference in New Issue
Block a user