V10/bugfix/variant permissions segments (#12890)
* Remove null check from MapperContext.SetCulture and .SetSegment We need to be able to set these to null, since null = invariant / default segment * show segment label on property * Add ContentVariation to ContentPropertyDisplay * Add ContentVariation to DocumentTypeDisplay * Change variations to be on ContentTypeBasic.cs * don't cache value * show correct label and unlock text for culture and segment variations * make lock overlay take up less space Co-authored-by: nikolajlauridsen <nikolajlauridsen@protonmail.ch> Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
committed by
Bjarke Berg
parent
128dd42b47
commit
bfbc2abca8
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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: "@",
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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">
|
||||
|
||||
<umb-property-editor
|
||||
@@ -43,11 +43,13 @@
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in group.properties track by property.alias"
|
||||
property="property"
|
||||
show-inherit="contentNodeModel.variants.length > 1 && !property.culture"
|
||||
node="contentNodeModel"
|
||||
show-inherit="contentNodeModel.variants.length > 1 && property.variation !== 'CultureAndSegment'"
|
||||
inherits-from="defaultVariant.displayName">
|
||||
|
||||
<umb-property-editor
|
||||
model="property"
|
||||
node="contentNodeModel"
|
||||
preview="(propertyEditorDisabled(property) && allowUpdate) || (!allowUpdate && !property.supportsReadOnly)"
|
||||
allow-unlock="allowUpdate && allowEditInvariantFromNonDefault"
|
||||
on-unlock="unlockInvariantValue(property)"
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<div class="umb-property-editor db">
|
||||
|
||||
|
||||
<div ng-if="preview && allowUnlock" class="umb-property-editor__lock-overlay-container">
|
||||
<div class="umb-property-editor__lock-overlay">
|
||||
<span ng-bind-html="labels.invariantPropertyUnlockHelp"></span>
|
||||
|
||||
<span ng-if="model.variations === 'Nothing' && node.documentType.variations === 'Culture'" ng-bind-html="labels.invariantCulturePropertyUnlockHelp"></span>
|
||||
<span ng-if="model.variations === 'Nothing' && node.documentType.variations === 'Segment'" ng-bind-html="labels.invariantSegmentPropertyUnlockHelp"></span>
|
||||
<span ng-if="model.variations === 'Nothing' && node.documentType.variations === 'CultureAndSegment'" ng-bind-html="labels.invariantPropertyUnlockHelp"></span>
|
||||
|
||||
<span ng-if="model.variations === 'Culture' && node.documentType.variations === 'CultureAndSegment'" ng-bind-html="labels.invariantSegmentPropertyUnlockHelp"></span>
|
||||
<span ng-if="model.variations === 'Segment' && node.documentType.variations === 'CultureAndSegment'" ng-bind-html="labels.invariantCulturePropertyUnlockHelp"></span>
|
||||
|
||||
<umb-button button-style="success" type="button" action="unlock()" label-key="general_edit" size="xxs"></umb-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,10 +28,31 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-if="vm.showInherit || vm.property.culture" class="umb-property-culture-label">
|
||||
<span ng-if="vm.showInherit"><localize key="general_shared"></localize></span>
|
||||
<span ng-if="!vm.showInherit">{{ vm.property.culture }}</span>
|
||||
<div class="umb-property-variant-label-container" ng-if="vm.showInherit && vm.property && vm.node">
|
||||
|
||||
<span ng-if="vm.property.variations === 'Nothing'" class="umb-property-variant-label">
|
||||
<localize key="general_shared"></localize>
|
||||
</span>
|
||||
|
||||
<span ng-if="vm.property.variations === 'Segment' && vm.node.documentType.variations === 'CultureAndSegment'" class="umb-property-variant-label">
|
||||
<localize key="languages_invariantLanguageProperty"></localize>
|
||||
</span>
|
||||
|
||||
<span ng-if="vm.property.variations === 'Culture' || vm.property.variations === 'CultureAndSegment'" class="umb-property-variant-label">
|
||||
{{ vm.property.culture }}
|
||||
</span>
|
||||
|
||||
<span ng-if="vm.property.variations === 'Culture' && vm.node.documentType.variations === 'CultureAndSegment'" class="umb-property-variant-label">
|
||||
<localize key="languages_invariantSegmentProperty"></localize>
|
||||
</span>
|
||||
|
||||
<span ng-if="vm.property.variations === 'Segment' || vm.property.variations === 'CultureAndSegment'" class="umb-property-variant-label">
|
||||
<span>{{ vm.property.segment }}</span>
|
||||
<span ng-if="!vm.property.segment">Default</span>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="controls" ng-transclude>
|
||||
|
||||
Reference in New Issue
Block a user