Updates UI and mapping to update a property type to allow being culture variant
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,131 +1,137 @@
|
||||
<div class="content-type-editor-dialog edit-property-settings" ng-controller="Umbraco.Overlay.PropertySettingsOverlay as vm">
|
||||
|
||||
<div class="umb-control-group" ng-if="!model.property.locked">
|
||||
<div class="control-group">
|
||||
<textarea class="editor-label"
|
||||
data-element="property-name"
|
||||
name="propertyLabel"
|
||||
ng-model="model.property.label"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_entername"
|
||||
umb-auto-focus
|
||||
focus-on-filled="true"
|
||||
umb-auto-resize
|
||||
required
|
||||
overlay-submit-on-enter>
|
||||
<div class="umb-control-group" ng-if="!model.property.locked">
|
||||
<div class="control-group">
|
||||
<textarea class="editor-label"
|
||||
data-element="property-name"
|
||||
name="propertyLabel"
|
||||
ng-model="model.property.label"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_entername"
|
||||
umb-auto-focus
|
||||
focus-on-filled="true"
|
||||
umb-auto-resize
|
||||
required
|
||||
overlay-submit-on-enter>
|
||||
</textarea>
|
||||
<div class="umb-validation-label" val-msg-for="propertyLabel" val-toggle-msg="required">Required label</div>
|
||||
</div>
|
||||
<div class="control-group -no-margin">
|
||||
<umb-generate-alias enable-lock="true" alias-from="model.property.label" alias="model.property.alias"></umb-generate-alias>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group -no-margin">
|
||||
<umb-generate-alias enable-lock="true" alias-from="model.property.label" alias="model.property.alias"></umb-generate-alias>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-control-group control-group">
|
||||
<textarea
|
||||
data-element="property-description"
|
||||
class="editor-description"
|
||||
ng-model="model.property.description"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_enterDescription"
|
||||
overlay-submit-on-enter
|
||||
umb-auto-resize>
|
||||
<div class="umb-control-group control-group">
|
||||
<textarea data-element="property-description"
|
||||
class="editor-description"
|
||||
ng-model="model.property.description"
|
||||
localize="placeholder"
|
||||
placeholder="@placeholders_enterDescription"
|
||||
overlay-submit-on-enter
|
||||
umb-auto-resize>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-wrapper umb-control-group control-group" ng-model="model.property.editor" val-require-component ng-if="!model.property.locked">
|
||||
<div class="editor-wrapper umb-control-group control-group" ng-model="model.property.editor" val-require-component ng-if="!model.property.locked">
|
||||
|
||||
<a data-element="editor-add" href="" ng-if="!model.property.editor" class="editor-placeholder" hotkey="alt+shift+e" ng-click="vm.openEditorPickerOverlay(model.property)">
|
||||
<localize key="shortcuts_addEditor"></localize>
|
||||
</a>
|
||||
<a data-element="editor-add" href="" ng-if="!model.property.editor" class="editor-placeholder" hotkey="alt+shift+e" ng-click="vm.openEditorPickerOverlay(model.property)">
|
||||
<localize key="shortcuts_addEditor"></localize>
|
||||
</a>
|
||||
|
||||
<div class="editor clearfix" ng-if="model.property.editor">
|
||||
<div class="editor clearfix" ng-if="model.property.editor">
|
||||
|
||||
<a href="" class="editor-icon-wrapper" ng-click="vm.openEditorPickerOverlay(model.property)">
|
||||
<i class="icon {{ model.property.dataTypeIcon }}" ng-class="{'icon-autofill': model.property.dataTypeIcon == null}"></i>
|
||||
</a>
|
||||
<a href="" class="editor-icon-wrapper" ng-click="vm.openEditorPickerOverlay(model.property)">
|
||||
<i class="icon {{ model.property.dataTypeIcon }}" ng-class="{'icon-autofill': model.property.dataTypeIcon == null}"></i>
|
||||
</a>
|
||||
|
||||
<div class="editor-details">
|
||||
<a href="" class="editor-name" ng-click="vm.openEditorPickerOverlay(model.property)">{{ model.property.dataTypeName }}</a>
|
||||
<a href="" class="editor-editor" ng-click="vm.openEditorPickerOverlay(model.property)">{{ model.property.editor }}</a>
|
||||
</div>
|
||||
<div class="editor-details">
|
||||
<a href="" class="editor-name" ng-click="vm.openEditorPickerOverlay(model.property)">{{ model.property.dataTypeName }}</a>
|
||||
<a href="" class="editor-editor" ng-click="vm.openEditorPickerOverlay(model.property)">{{ model.property.editor }}</a>
|
||||
</div>
|
||||
|
||||
<a href class="editor-settings-icon pull-right"
|
||||
ng-click="vm.openEditorSettingsOverlay(model.property)"
|
||||
hotkey="alt+shift+d"
|
||||
ng-if="model.property.editor">
|
||||
<i class="icon icon-settings"></i>
|
||||
</a>
|
||||
<a href class="editor-settings-icon pull-right"
|
||||
ng-click="vm.openEditorSettingsOverlay(model.property)"
|
||||
hotkey="alt+shift+d"
|
||||
ng-if="model.property.editor">
|
||||
<i class="icon icon-settings"></i>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-control-group clearfix" ng-if="!model.property.locked">
|
||||
<div class="umb-control-group clearfix" ng-if="!model.property.locked">
|
||||
|
||||
<h5><localize key="validation_validation"></localize></h5>
|
||||
<h5><localize key="validation_validation"></localize></h5>
|
||||
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.validation.mandatory" focus-when="{{vm.focusOnMandatoryField}}">
|
||||
<localize key="validation_fieldIsMandatory"></localize>
|
||||
</label>
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.validation.mandatory" focus-when="{{vm.focusOnMandatoryField}}" />
|
||||
<localize key="validation_fieldIsMandatory"></localize>
|
||||
</label>
|
||||
|
||||
<select class="umb-dropdown" ng-options="validationType.name for validationType in vm.validationTypes" ng-model="vm.selectedValidationType" ng-change="vm.changeValidationType(vm.selectedValidationType)">
|
||||
<option value=""><localize key="validation_validation">Validation</localize></option>
|
||||
</select>
|
||||
<select class="umb-dropdown" ng-options="validationType.name for validationType in vm.validationTypes" ng-model="vm.selectedValidationType" ng-change="vm.changeValidationType(vm.selectedValidationType)">
|
||||
<option value=""><localize key="validation_validation">Validation</localize></option>
|
||||
</select>
|
||||
|
||||
<textarea
|
||||
class="editor-validation-pattern"
|
||||
localize="placeholder"
|
||||
placeholder="@validation_validationRegExp"
|
||||
ng-model="model.property.validation.pattern"
|
||||
ng-change="vm.changeValidationPattern()"
|
||||
ng-if="vm.showValidationPattern"
|
||||
umb-auto-resize
|
||||
focus-when="{{vm.focusOnPatternField}}"
|
||||
overlay-submit-on-enter>
|
||||
<textarea class="editor-validation-pattern"
|
||||
localize="placeholder"
|
||||
placeholder="@validation_validationRegExp"
|
||||
ng-model="model.property.validation.pattern"
|
||||
ng-change="vm.changeValidationPattern()"
|
||||
ng-if="vm.showValidationPattern"
|
||||
umb-auto-resize
|
||||
focus-when="{{vm.focusOnPatternField}}"
|
||||
overlay-submit-on-enter>
|
||||
</textarea>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="umb-control-group clearfix" ng-if="model.contentType === 'documentType'">
|
||||
|
||||
<div class="umb-control-group clearfix" ng-if="model.contentType === 'memberType'">
|
||||
<h5>Property Type Variation</h5>
|
||||
|
||||
<h5><localize key="general_options"></localize></h5>
|
||||
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.showOnMemberProfile">
|
||||
<localize key="contentTypeEditor_showOnMemberProfile"></localize>
|
||||
<small><localize key="contentTypeEditor_showOnMemberProfileDescription"></localize></small>
|
||||
</label>
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.allowCultureVariant" />
|
||||
Allow varying by Culture
|
||||
</label>
|
||||
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.memberCanEdit">
|
||||
<localize key="contentTypeEditor_memberCanEdit"></localize>
|
||||
<small><localize key="contentTypeEditor_memberCanEditDescription"></localize></small>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label ng-if="vm.showSensitiveData" class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.isSensitiveData">
|
||||
<localize key="contentTypeEditor_isSensitiveData"></localize>
|
||||
<small><localize key="contentTypeEditor_isSensitiveDataDescription"></localize></small>
|
||||
</label>
|
||||
<div class="umb-control-group clearfix" ng-if="model.contentType === 'memberType'">
|
||||
|
||||
</div>
|
||||
<h5><localize key="general_options"></localize></h5>
|
||||
|
||||
<umb-overlay
|
||||
data-element="overlay-editor-picker"
|
||||
ng-if="vm.editorPickerOverlay.show"
|
||||
model="vm.editorPickerOverlay"
|
||||
position="right"
|
||||
view="vm.editorPickerOverlay.view">
|
||||
</umb-overlay>
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.showOnMemberProfile">
|
||||
<localize key="contentTypeEditor_showOnMemberProfile"></localize>
|
||||
<small><localize key="contentTypeEditor_showOnMemberProfileDescription"></localize></small>
|
||||
</label>
|
||||
|
||||
<umb-overlay
|
||||
data-element="overlay-editor-settings"
|
||||
ng-if="vm.editorSettingsOverlay.show"
|
||||
model="vm.editorSettingsOverlay"
|
||||
position="right"
|
||||
view="vm.editorSettingsOverlay.view">
|
||||
</umb-overlay>
|
||||
<label class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.memberCanEdit">
|
||||
<localize key="contentTypeEditor_memberCanEdit"></localize>
|
||||
<small><localize key="contentTypeEditor_memberCanEditDescription"></localize></small>
|
||||
</label>
|
||||
|
||||
<label ng-if="vm.showSensitiveData" class="checkbox no-indent">
|
||||
<input type="checkbox" ng-model="model.property.isSensitiveData">
|
||||
<localize key="contentTypeEditor_isSensitiveData"></localize>
|
||||
<small><localize key="contentTypeEditor_isSensitiveDataDescription"></localize></small>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<umb-overlay data-element="overlay-editor-picker"
|
||||
ng-if="vm.editorPickerOverlay.show"
|
||||
model="vm.editorPickerOverlay"
|
||||
position="right"
|
||||
view="vm.editorPickerOverlay.view">
|
||||
</umb-overlay>
|
||||
|
||||
<umb-overlay data-element="overlay-editor-settings"
|
||||
ng-if="vm.editorSettingsOverlay.show"
|
||||
model="vm.editorSettingsOverlay"
|
||||
position="right"
|
||||
view="vm.editorSettingsOverlay.view">
|
||||
</umb-overlay>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -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<DocumentTypeDisplay, DocumentTypeSave, PropertyTypeBasic>(
|
||||
contentTypeSave: contentTypeSave,
|
||||
getContentType: i => Services.ContentTypeService.Get(i),
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PropertyTypeVariationsResolver>())
|
||||
|
||||
//only map if it is actually set
|
||||
.ForMember(dest => dest.Id, opt => opt.Condition(source => source.Id > 0))
|
||||
|
||||
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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<PropertyTypeBasic, PropertyType, ContentVariation>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -262,6 +262,7 @@
|
||||
<Compile Include="Models\Mapping\MembershipUserTypeConverter.cs" />
|
||||
<Compile Include="Models\Mapping\MemberTabsAndPropertiesResolver.cs" />
|
||||
<Compile Include="Models\Mapping\MemberTreeNodeUrlResolver.cs" />
|
||||
<Compile Include="Models\Mapping\PropertyTypeVariationsResolver.cs" />
|
||||
<Compile Include="Models\Mapping\RedirectUrlMapperProfile.cs" />
|
||||
<Compile Include="Models\Mapping\TemplateMapperProfile.cs" />
|
||||
<Compile Include="Models\Mapping\UserGroupDefaultPermissionsResolver.cs" />
|
||||
|
||||
Reference in New Issue
Block a user