diff --git a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml index 70aa1c2d5c..9a44528b53 100644 --- a/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml +++ b/src/Umbraco.Core/EmbeddedResources/Lang/en_us.xml @@ -1967,7 +1967,11 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Fall back language none - %0% is shared across all languages.]]> + %0% is shared across languages and segments.]]> + %0% is shared across all languages.]]> + %0% is shared across all segments.]]> + Shared: Languages + Shared: Segments Add parameter diff --git a/src/Umbraco.Core/Models/ContentEditing/ContentPropertyDisplay.cs b/src/Umbraco.Core/Models/ContentEditing/ContentPropertyDisplay.cs index d0f2b9aed6..9368de8ce1 100644 --- a/src/Umbraco.Core/Models/ContentEditing/ContentPropertyDisplay.cs +++ b/src/Umbraco.Core/Models/ContentEditing/ContentPropertyDisplay.cs @@ -15,6 +15,9 @@ public class ContentPropertyDisplay : ContentPropertyBasic Validation = new PropertyTypeValidation(); } + [DataMember(Name = "variations")] + public ContentVariation Variations { get; set; } + [DataMember(Name = "label", IsRequired = true)] [Required] public string? Label { get; set; } diff --git a/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs b/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs index 90dd6ce5c9..0ba344f7fc 100644 --- a/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs +++ b/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs @@ -42,6 +42,9 @@ public class ContentTypeBasic : EntityBasic [DataMember(Name = "thumbnail")] public string? Thumbnail { get; set; } + [DataMember(Name = "variations")] + public ContentVariation Variations { get; set; } + /// /// Returns true if the icon represents a CSS class instead of a file path /// diff --git a/src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs b/src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs index 3c292a7e6a..110ab98547 100644 --- a/src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs +++ b/src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs @@ -16,6 +16,9 @@ public class DocumentTypeDisplay : ContentTypeCompositionDisplay AllowedTemplates { get; set; } + [DataMember(Name = "variations")] + public ContentVariation Variations { get; set; } + [DataMember(Name = "defaultTemplate")] public EntityBasic? DefaultTemplate { get; set; } diff --git a/src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs index eb6c6d92e0..22407219eb 100644 --- a/src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs +++ b/src/Umbraco.Core/Models/Mapping/ContentPropertyDisplayMapper.cs @@ -56,6 +56,9 @@ internal class ContentPropertyDisplayMapper : ContentPropertyBasicMapper c.SortOrder).Select(x => x.Id.Value); target.CompositeContentTypes = source.ContentTypeComposition.Select(x => x.Alias); target.LockedCompositeContentTypes = MapLockedCompositions(source); + target.Variations = source.Variations; } // no MapAll - relies on the non-generic method @@ -794,6 +797,7 @@ public class ContentTypeMapDefinition : IMapDefinition : _hostingEnvironment.ToAbsolute("~/umbraco/images/thumbnails/" + source.Thumbnail); target.Trashed = source.Trashed; target.Udi = source.Udi; + target.Variations = source.Variations; } // no MapAll - relies on the non-generic method diff --git a/src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs b/src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs index 70d4826ab6..c8637c3042 100644 --- a/src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs +++ b/src/Umbraco.Core/Models/Mapping/MapperContextExtensions.cs @@ -26,24 +26,12 @@ public static class MapperContextExtensions /// /// Sets a context culture. /// - public static void SetCulture(this MapperContext context, string? culture) - { - if (culture is not null) - { - context.Items[CultureKey] = culture; - } - } + public static void SetCulture(this MapperContext context, string? culture) => context.Items[CultureKey] = culture; /// /// Sets a context segment. /// - public static void SetSegment(this MapperContext context, string? segment) - { - if (segment is not null) - { - context.Items[SegmentKey] = segment; - } - } + public static void SetSegment(this MapperContext context, string? segment) => context.Items[SegmentKey] = segment; /// /// Get included properties. diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js index b91baa16c0..4eefa5176d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js @@ -189,10 +189,6 @@ return false; } - if (property.$propertyEditorDisabledCache) { - return property.$propertyEditorDisabledCache; - } - var contentLanguage = $scope.content.language; var otherCreatedVariants = $scope.contentNodeModel.variants.filter(x => x.compositeId !== $scope.content.compositeId && (x.state !== "NotCreated" || x.name !== null)).length === 0; @@ -205,7 +201,7 @@ var canEditSegment = property.segment === $scope.content.segment; - return property.$propertyEditorDisabledCache = !canEditCulture || !canEditSegment; + return !canEditCulture || !canEditSegment; } } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js index 25e55455db..702cd5aeda 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js @@ -19,6 +19,7 @@ }, bindings: { property: "=", + node: "<", elementKey: "@", // optional, if set this will be used for the property alias validation path (hack required because NC changes the actual property.alias :/) propertyAlias: "@", diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbpropertyeditor.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbpropertyeditor.directive.js index cc9f36852a..2d1ff762d5 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbpropertyeditor.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbpropertyeditor.directive.js @@ -11,6 +11,7 @@ function umbPropEditor(umbPropEditorHelper, localizationService) { return { scope: { model: "=", + node: "<", isPreValue: "@", preview: "<", allowUnlock: "", @@ -43,6 +44,16 @@ function umbPropEditor(umbPropEditorHelper, localizationService) { scope.labels.invariantPropertyUnlockHelp = value; }); + localizationService.localize('languages_invariantCulturePropertyUnlockHelp', [scope.model.label]) + .then(function(value) { + scope.labels.invariantCulturePropertyUnlockHelp = value; + }); + + localizationService.localize('languages_invariantSegmentPropertyUnlockHelp', [scope.model.label]) + .then(function(value) { + scope.labels.invariantSegmentPropertyUnlockHelp = value; + }); + var unbindWatcher = scope.$watch("model.view", function() { scope.propertyEditorView = umbPropEditorHelper.getViewPath(scope.model.view, scope.isPreValue); diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-property-editor.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-property-editor.less index f35998bbf8..b2a5a055e1 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-property-editor.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-property-editor.less @@ -46,7 +46,7 @@ transform: translate(-50%, 0); max-width: 800px; min-width: 300px; - padding: 12px 20px; + padding: 9px 15px; background: rgba(242,246,255,.8); border: 1px solid @blueMid; color: @blueMid; diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-property.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-property.less index 0d2bd1118a..34d65f0c5d 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-property.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-property.less @@ -1,18 +1,26 @@ -.umb-property:focus-within .umb-property-culture-label, -.umb-property:hover .umb-property-culture-label { +.umb-property:focus-within .umb-property-variant-label-container, +.umb-property:hover .umb-property-variant-label-container { opacity: 1; } -.umb-property:hover .umb-property:not(:hover) .umb-property-culture-label { +.umb-property:hover .umb-property:not(:hover) .umb-property-variant-label-container { opacity: 0; } -.umb-property-culture-label { +.umb-property-variant-label-container { + float: left; + clear: both; + opacity: 0; +} + +.umb-property-variant-label { font-size: 11px; padding: 0 7px; background: @gray-10; border-radius: 3px; - float: left; - clear: both; - opacity: 0; + display: inline-block; +} + +.umb-property-variant-label + .umb-property-variant-label { + margin-right: 3px; } \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html index 23dc3d7dd5..f161c76ee0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html @@ -11,7 +11,7 @@ data-element="property-{{property.alias}}" ng-repeat="property in tab.properties track by property.alias" property="property" - show-inherit="contentNodeModel.variants.length > 1 && !property.culture" + show-inherit="contentNodeModel.variants.length > 1 && property.variation !== 'CultureAndSegment'" inherits-from="defaultVariant.displayName"> - + - + + + + + + + + diff --git a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html index 40666133b2..8d0087b395 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html @@ -28,10 +28,31 @@ - - - {{ vm.property.culture }} + + + + + + + + + + + + {{ vm.property.culture }} + + + + + + + + {{ vm.property.segment }} + Default + + +