From 4dd663d6651cef04560dbd3df1bb2604af269b6d Mon Sep 17 00:00:00 2001 From: BatJan <1932158+BatJan@users.noreply.github.com> Date: Wed, 20 Oct 2021 16:25:12 +0200 Subject: [PATCH] Add remove warning --- .../components/umbchildselector.directive.js | 30 +++++++++++++++---- .../overlays/umb-template-remove-confirm.html | 15 ++++++++++ .../views/components/umb-child-selector.html | 2 +- .../grid/grid.prevalues.controller.js | 1 - src/Umbraco.Web.UI/Umbraco/config/lang/da.xml | 2 ++ src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 2 ++ .../Umbraco/config/lang/en_us.xml | 2 ++ 7 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-template-remove-confirm.html diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbchildselector.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbchildselector.directive.js index 47441326d7..7870267995 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbchildselector.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbchildselector.directive.js @@ -118,7 +118,7 @@ Use this directive to render a ui component for selecting child items to a paren (function() { 'use strict'; - function ChildSelectorDirective() { + function ChildSelectorDirective(overlayService, localizationService) { function link(scope, el, attr, ctrl) { @@ -126,10 +126,30 @@ Use this directive to render a ui component for selecting child items to a paren scope.dialogModel = {}; scope.showDialog = false; - scope.removeChild = (selectedChild, $index) => { - if (scope.onRemove) { - scope.onRemove(selectedChild, $index); - } + scope.removeChild = (selectedChild, $index, event) => { + const dialog = { + view: "views/components/overlays/umb-template-remove-confirm.html", + layout: selectedChild, + submitButtonLabelKey: "defaultdialogs_yesRemove", + submitButtonStyle: "danger", + submit: function () { + if(scope.onRemove) { + scope.onRemove(selectedChild, $index); + overlayService.close(); + } + }, + close: function () { + overlayService.close(); + } + }; + + localizationService.localize("general_delete").then(value => { + dialog.title = value; + overlayService.open(dialog); + }); + + event.preventDefault(); + event.stopPropagation(); }; scope.addChild = $event => { diff --git a/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-template-remove-confirm.html b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-template-remove-confirm.html new file mode 100644 index 0000000000..17b853fcbc --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-template-remove-confirm.html @@ -0,0 +1,15 @@ +
+ +
+ You are removing the child node {{model.layout.name}}. +
+ +

+ + Removing a child node will limit the editors options to create different content types beneath a node. + +

+ + Are you sure you want to remove? + +
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-child-selector.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-child-selector.html index a458c0de27..c7c8db041b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-child-selector.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-child-selector.html @@ -24,7 +24,7 @@ {{selectedChild.name}}
-
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.controller.js index e84e66c227..881b4e4783 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.controller.js @@ -188,7 +188,6 @@ angular.module("umbraco") } function deleteLayout(layout, index, event) { - const dialog = { view: "views/propertyEditors/grid/overlays/rowdeleteconfirm.html", layout: layout, diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index f29a027faa..2dfec4523c 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1531,6 +1531,8 @@ Mange hilsner fra Umbraco robotten Du har lavet ændringer til denne egenskab. Er du sikker på at du vil kassere dem? Visning Label hen over (fuld bredde) + Du fjerner noden + Fjernelse af noden, begrænser redaktørens muligheder for at oprette forskellige typer af underindhold. 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 fc89b1e7bd..35e55f0c80 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -1717,6 +1717,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont You have made changes to this property. Are you sure you want to discard them? Appearance Label above (full-width) + You are removing the child node + Removing a child node will limit the editors options to create different content types beneath a node. 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 75119ae842..fa8cfad670 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1748,6 +1748,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Add tab Convert to tab Drag properties here to place directly on the tab + You are removing the child node + Removing a child node will limit the editors options to create different content types beneath a node. Add language