diff --git a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js
index dab6cb8eda..9608fe20fb 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js
@@ -56,7 +56,7 @@
});
var saveProperties = _.map(realProperties, function (p) {
- var saveProperty = _.pick(p, 'id', 'alias', 'description', 'validation', 'label', 'sortOrder', 'dataTypeId', 'groupId', 'memberCanEdit', 'showOnMemberProfile', 'isSensitiveData');
+ var saveProperty = _.pick(p, 'id', 'alias', 'description', 'validation', 'label', 'sortOrder', 'dataTypeId', 'groupId', 'memberCanEdit', 'showOnMemberProfile', 'isSensitiveData', 'allowCultureVariant');
return saveProperty;
});
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/propertysettings/propertysettings.html b/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/propertysettings/propertysettings.html
index 9df9c801b4..76be18a58f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/propertysettings/propertysettings.html
+++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/contenttypeeditor/propertysettings/propertysettings.html
@@ -1,131 +1,137 @@
diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs
index 0aa43c8cfb..5ffe68afaa 100644
--- a/src/Umbraco.Web/Editors/ContentTypeController.cs
+++ b/src/Umbraco.Web/Editors/ContentTypeController.cs
@@ -169,7 +169,18 @@ namespace Umbraco.Web.Editors
}
public DocumentTypeDisplay PostSave(DocumentTypeSave contentTypeSave)
- {
+ {
+ //Before we send this model into this saving/mapping pipeline, we need to do some cleanup on variations.
+ //If the doc type does not allow content variations, we need to update all of it's property types to not allow this either
+ //else we may end up with ysods. I'm unsure if the service level handles this but we'll make sure it is updated here
+ if (!contentTypeSave.AllowCultureVariant)
+ {
+ foreach(var prop in contentTypeSave.Groups.SelectMany(x => x.Properties))
+ {
+ prop.AllowCultureVariant = false;
+ }
+ }
+
var savedCt = PerformPostSave(
contentTypeSave: contentTypeSave,
getContentType: i => Services.ContentTypeService.Get(i),
diff --git a/src/Umbraco.Web/Models/ContentEditing/PropertyTypeBasic.cs b/src/Umbraco.Web/Models/ContentEditing/PropertyTypeBasic.cs
index b6f678068e..cde9d0dabc 100644
--- a/src/Umbraco.Web/Models/ContentEditing/PropertyTypeBasic.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/PropertyTypeBasic.cs
@@ -46,5 +46,8 @@ namespace Umbraco.Web.Models.ContentEditing
//SD: Is this really needed ?
[DataMember(Name = "groupId")]
public int GroupId { get; set; }
+
+ [DataMember(Name = "allowCultureVariant")]
+ public bool AllowCultureVariant { get; set; }
}
}
diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs
index bba27ce3f1..2ee9e38ff5 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentTypeMapperProfile.cs
@@ -163,7 +163,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(dest => dest.PropertyEditorAlias, opt => opt.Ignore())
.ForMember(dest => dest.DeleteDate, opt => opt.Ignore())
- .ForMember(dto => dto.Variations, opt => opt.Ignore()) // fixme - change when UI supports it!
+ .ForMember(dto => dto.Variations, opt => opt.ResolveUsing())
//only map if it is actually set
.ForMember(dest => dest.Id, opt => opt.Condition(source => source.Id > 0))
diff --git a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupResolver.cs b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupResolver.cs
index 9a1aeda845..b9aa482b6a 100644
--- a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupResolver.cs
+++ b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupResolver.cs
@@ -220,7 +220,8 @@ namespace Umbraco.Web.Models.Mapping
DataTypeId = p.DataTypeId,
SortOrder = p.SortOrder,
ContentTypeId = contentType.Id,
- ContentTypeName = contentType.Name
+ ContentTypeName = contentType.Name,
+ AllowCultureVariant = p.Variations.HasFlag(Core.Models.ContentVariation.CultureNeutral)
});
}
diff --git a/src/Umbraco.Web/Models/Mapping/PropertyTypeVariationsResolver.cs b/src/Umbraco.Web/Models/Mapping/PropertyTypeVariationsResolver.cs
new file mode 100644
index 0000000000..772caed964
--- /dev/null
+++ b/src/Umbraco.Web/Models/Mapping/PropertyTypeVariationsResolver.cs
@@ -0,0 +1,23 @@
+using AutoMapper;
+using Umbraco.Core.Models;
+using Umbraco.Web.Models.ContentEditing;
+using ContentVariation = Umbraco.Core.Models.ContentVariation;
+
+namespace Umbraco.Web.Models.Mapping
+{
+ internal class PropertyTypeVariationsResolver: IValueResolver
+ {
+ public ContentVariation Resolve(PropertyTypeBasic source, PropertyType destination, ContentVariation destMember, ResolutionContext context)
+ {
+ //this will always be the case, a content type will always be allowed to be invariant
+ var result = ContentVariation.InvariantNeutral;
+
+ if (source.AllowCultureVariant)
+ {
+ result |= ContentVariation.CultureNeutral;
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs
index 29b252cd92..7329033405 100644
--- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs
+++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.cs
@@ -147,7 +147,6 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
for (var i = 0; i < pcount; i++)
{
// read lang id
- // fixme: This will need to change to string when stephane is done his culture work
var key = PrimitiveSerializer.String.ReadFrom(stream);
var val = new CultureVariation();
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 67ce954045..65ca4c44b4 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -262,6 +262,7 @@
+