Merge pull request #5522 from kjac/v8-feature-content-type-editor-without-live-editing
V8: Don't apply changes instantly when editing content type properties
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
function GroupsBuilderDirective(contentTypeHelper, contentTypeResource, mediaTypeResource,
|
||||
dataTypeHelper, dataTypeResource, $filter, iconHelper, $q, $timeout, notificationsService,
|
||||
localizationService, editorService, eventsService) {
|
||||
localizationService, editorService, eventsService, overlayService) {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
@@ -474,10 +474,11 @@
|
||||
if (!property.inherited) {
|
||||
|
||||
var oldPropertyModel = angular.copy(property);
|
||||
var propertyModel = angular.copy(property);
|
||||
|
||||
var propertySettings = {
|
||||
title: "Property settings",
|
||||
property: property,
|
||||
property: propertyModel,
|
||||
contentType: scope.contentType,
|
||||
contentTypeName: scope.model.name,
|
||||
contentTypeAllowCultureVariant: scope.model.allowCultureVariant,
|
||||
@@ -487,7 +488,24 @@
|
||||
|
||||
property.inherited = false;
|
||||
property.dialogIsOpen = false;
|
||||
|
||||
property.propertyState = "active";
|
||||
|
||||
// apply all property changes
|
||||
property.label = propertyModel.label;
|
||||
property.alias = propertyModel.alias;
|
||||
property.description = propertyModel.description;
|
||||
property.config = propertyModel.config;
|
||||
property.editor = propertyModel.editor;
|
||||
property.view = propertyModel.view;
|
||||
property.dataTypeId = propertyModel.dataTypeId;
|
||||
property.dataTypeIcon = propertyModel.dataTypeIcon;
|
||||
property.dataTypeName = propertyModel.dataTypeName;
|
||||
property.validation.mandatory = propertyModel.validation.mandatory;
|
||||
property.validation.pattern = propertyModel.validation.pattern;
|
||||
property.showOnMemberProfile = propertyModel.showOnMemberProfile;
|
||||
property.memberCanEdit = propertyModel.memberCanEdit;
|
||||
property.isSensitiveValue = propertyModel.isSensitiveValue;
|
||||
|
||||
// update existing data types
|
||||
if(model.updateSameDataTypes) {
|
||||
updateSameDataTypes(property);
|
||||
@@ -508,43 +526,38 @@
|
||||
|
||||
},
|
||||
close: function() {
|
||||
if(_.isEqual(oldPropertyModel, propertyModel) === false) {
|
||||
localizationService.localizeMany(["general_confirm", "contentTypeEditor_propertyHasChanges", "general_cancel", "general_ok"]).then(function (data) {
|
||||
const overlay = {
|
||||
title: data[0],
|
||||
content: data[1],
|
||||
closeButtonLabel: data[2],
|
||||
submitButtonLabel: data[3],
|
||||
submitButtonStyle: "danger",
|
||||
close: function () {
|
||||
overlayService.close();
|
||||
},
|
||||
submit: function () {
|
||||
// close the confirmation
|
||||
overlayService.close();
|
||||
// close the editor
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
|
||||
// reset all property changes
|
||||
property.label = oldPropertyModel.label;
|
||||
property.alias = oldPropertyModel.alias;
|
||||
property.description = oldPropertyModel.description;
|
||||
property.config = oldPropertyModel.config;
|
||||
property.editor = oldPropertyModel.editor;
|
||||
property.view = oldPropertyModel.view;
|
||||
property.dataTypeId = oldPropertyModel.dataTypeId;
|
||||
property.dataTypeIcon = oldPropertyModel.dataTypeIcon;
|
||||
property.dataTypeName = oldPropertyModel.dataTypeName;
|
||||
property.validation.mandatory = oldPropertyModel.validation.mandatory;
|
||||
property.validation.pattern = oldPropertyModel.validation.pattern;
|
||||
property.showOnMemberProfile = oldPropertyModel.showOnMemberProfile;
|
||||
property.memberCanEdit = oldPropertyModel.memberCanEdit;
|
||||
property.isSensitiveValue = oldPropertyModel.isSensitiveValue;
|
||||
|
||||
// because we set state to active, to show a preview, we have to check if has been filled out
|
||||
// label is required so if it is not filled we know it is a placeholder
|
||||
if(oldPropertyModel.editor === undefined || oldPropertyModel.editor === null || oldPropertyModel.editor === "") {
|
||||
property.propertyState = "init";
|
||||
} else {
|
||||
property.propertyState = oldPropertyModel.propertyState;
|
||||
overlayService.open(overlay);
|
||||
});
|
||||
}
|
||||
else {
|
||||
// remove the editor
|
||||
editorService.close();
|
||||
}
|
||||
|
||||
// remove the editor
|
||||
editorService.close();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// open property settings editor
|
||||
editorService.open(propertySettings);
|
||||
|
||||
// set state to active to access the preview
|
||||
property.propertyState = "active";
|
||||
|
||||
// set property states
|
||||
property.dialogIsOpen = true;
|
||||
|
||||
|
||||
@@ -1319,6 +1319,7 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="elementHeading">Er en Element-type</key>
|
||||
<key alias="elementDescription">En Element-type er tiltænkt brug i f.eks. Nested Content, ikke i indholdstræet</key>
|
||||
<key alias="elementDoesNotSupport">Dette benyttes ikke for en Element-type</key>
|
||||
<key alias="propertyHasChanges">Du har lavet ændringer til denne egenskab. Er du sikker på at du vil kassere dem?</key>
|
||||
</area>
|
||||
<area alias="languages">
|
||||
<key alias="addLanguage">Tilføj sprog</key>
|
||||
|
||||
@@ -1594,7 +1594,8 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="elementType">Element type</key>
|
||||
<key alias="elementHeading">Is an Element type</key>
|
||||
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
|
||||
<key alias="elementDoesNotSupport">This is not applicable for an Element type</key>
|
||||
<key alias="elementDoesNotSupport">This is not applicable for an Element type</key>
|
||||
<key alias="propertyHasChanges">You have made changes to this property. Are you sure you want to discard them?</key>
|
||||
</area>
|
||||
<area alias="languages">
|
||||
<key alias="addLanguage">Add language</key>
|
||||
|
||||
@@ -1608,6 +1608,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="elementHeading">Is an Element type</key>
|
||||
<key alias="elementDescription">An Element type is meant to be used for instance in Nested Content, and not in the tree</key>
|
||||
<key alias="elementDoesNotSupport">This is not applicable for an Element type</key>
|
||||
<key alias="propertyHasChanges">You have made changes to this property. Are you sure you want to discard them?</key>
|
||||
</area>
|
||||
<area alias="languages">
|
||||
<key alias="addLanguage">Add language</key>
|
||||
|
||||
Reference in New Issue
Block a user