discard changes dialog

This commit is contained in:
Niels Lyngsø
2020-07-31 14:05:07 +02:00
parent d5c0e79c40
commit 47203f7111
4 changed files with 30 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
angular.module("umbraco")
.controller("Umbraco.Editors.BlockEditorController",
function ($scope, localizationService, formHelper) {
function ($scope, localizationService, formHelper, overlayService) {
var vm = this;
vm.model = $scope.model;
@@ -67,6 +67,29 @@ angular.module("umbraco")
// * It would have a 'commit' method to commit the removed errors - which we would call in the formHelper.submitForm when it's successful
// * It would have a 'rollback' method to reset the removed errors - which we would call here
if (vm.blockForm.$dirty === true) {
localizationService.localizeMany(["prompt_discardChanges", "blockEditor_blockHasChanges"]).then(function (localizations) {
const confirm = {
title: localizations[0],
view: "default",
content: localizations[1],
submitButtonLabelKey: "general_discard",
submitButtonStyle: "danger",
closeButtonLabelKey: "general_cancel",
submit: function () {
overlayService.close();
vm.model.close(vm.model);
},
close: function () {
overlayService.close();
}
};
overlayService.open(confirm);
});
return;
}
// TODO: check if content/settings has changed and ask user if they are sure.
vm.model.close(vm.model);
}

View File

@@ -647,6 +647,7 @@
<key alias="design">Design</key>
<key alias="dictionary">Ordbog</key>
<key alias="dimensions">Dimensioner</key>
<key alias="discard">Discard</key>
<key alias="down">Ned</key>
<key alias="download">Hent</key>
<key alias="edit">Rediger</key>
@@ -1851,6 +1852,7 @@ Mange hilsner fra Umbraco robotten
<key alias="tabBlockSettings">Indstillinger</key>
<key alias="headlineAdvanced">Avanceret</key>
<key alias="forceHideContentEditor">Skjuld indholds editoren</key>
<key alias="blockHasChanges">Du har lavet ændringer til dette indhold. Er du sikker på at du vil kassere dem?</key>
</area>
</language>

View File

@@ -675,6 +675,7 @@
<key alias="design">Design</key>
<key alias="dictionary">Dictionary</key>
<key alias="dimensions">Dimensions</key>
<key alias="discard">Discard</key>
<key alias="down">Down</key>
<key alias="download">Download</key>
<key alias="edit">Edit</key>
@@ -2467,6 +2468,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="tabBlockSettings">Settings</key>
<key alias="headlineAdvanced">Advanced</key>
<key alias="forceHideContentEditor">Force hide content editor</key>
<key alias="blockHasChanges">You have made changes to this content. Are you sure you want to discard them?</key>
</area>
<area alias="contentTemplatesDashboard">
<key alias="whatHeadline">What are Content Templates?</key>

View File

@@ -682,6 +682,7 @@
<key alias="design">Design</key>
<key alias="dictionary">Dictionary</key>
<key alias="dimensions">Dimensions</key>
<key alias="discard">Discard</key>
<key alias="down">Down</key>
<key alias="download">Download</key>
<key alias="edit">Edit</key>
@@ -2487,6 +2488,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="tabBlockSettings">Settings</key>
<key alias="headlineAdvanced">Advanced</key>
<key alias="forceHideContentEditor">Force hide content editor</key>
<key alias="blockHasChanges">You have made changes to this content. Are you sure you want to discard them?</key>
</area>
<area alias="contentTemplatesDashboard">
<key alias="whatHeadline">What are Content Templates?</key>