diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js index da51528bd2..bbbdd392b2 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js @@ -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; diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index 79ac6bc641..9e6bdc5e57 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1319,6 +1319,7 @@ Mange hilsner fra Umbraco robotten Er en Element-type En Element-type er tiltænkt brug i f.eks. Nested Content, ikke i indholdstræet Dette benyttes ikke for en Element-type + Du har lavet ændringer til denne egenskab. Er du sikker på at du vil kassere dem? Tilføj sprog diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index cf733abbf2..189bd9f10b 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -1594,7 +1594,8 @@ To manage your website, simply open the Umbraco back office and start adding con Element type Is an Element type An Element type is meant to be used for instance in Nested Content, and not in the tree - This is not applicable for an Element type + This is not applicable for an Element type + You have made changes to this property. Are you sure you want to discard them? Add language diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 40699fa3ec..6ce6f82ccc 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1608,6 +1608,7 @@ To manage your website, simply open the Umbraco back office and start adding con Is an Element type An Element type is meant to be used for instance in Nested Content, and not in the tree This is not applicable for an Element type + You have made changes to this property. Are you sure you want to discard them? Add language