Skip to content

Commit 9a16907

Browse files
BatJannul800sebastiaan
authored andcommitted
Add warning overlay when deleting grid layout
1 parent fef162b commit 9a16907

File tree

6 files changed

+51
-14
lines changed

6 files changed

+51
-14
lines changed

src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.controller.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,29 @@ angular.module("umbraco")
125125
editorService.open(layoutConfigOverlay);
126126
}
127127

128-
function deleteTemplate(index) {
129-
$scope.model.value.templates.splice(index, 1);
128+
function deleteTemplate(template, index, event) {
129+
130+
const dialog = {
131+
view: "views/propertyEditors/grid/overlays/layoutdeleteconfirm.html",
132+
layout: template,
133+
submitButtonLabelKey: "contentTypeEditor_yesDelete",
134+
submitButtonStyle: "danger",
135+
submit: function (model) {
136+
$scope.model.value.templates.splice(index, 1);
137+
overlayService.close();
138+
},
139+
close: function () {
140+
overlayService.close();
141+
}
142+
};
143+
144+
localizationService.localize("general_delete").then(value => {
145+
dialog.title = value;
146+
overlayService.open(dialog);
147+
});
148+
149+
event.preventDefault();
150+
event.stopPropagation();
130151
}
131152

132153
/****************

src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.prevalues.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h4>
3131

3232
<div>
3333
<p>{{template.name}}</p>
34-
<button type="button" class="btn btn-small btn-link" ng-click="vm.deleteTemplate($index)">
34+
<button type="button" class="btn btn-small btn-link" ng-click="vm.deleteTemplate(template, $index, $event)">
3535
<umb-icon icon="icon-delete" class="red"></umb-icon>
3636
<localize key="general_delete">Delete</localize>
3737
</button>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div>
2+
<div ng-if="model.layout" class="umb-alert umb-alert--warning mb2">
3+
<localize key="grid_deleteLayout">You are deleting the layout</localize> <strong>{{model.layout.name}}</strong>.
4+
</div>
5+
6+
<p>
7+
<localize key="grid_deletingALayout">
8+
Modifying layout will result in loss of data for any existing content that is based on this configuration.
9+
</localize>
10+
</p>
11+
12+
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize>?
13+
14+
</div>

src/Umbraco.Web.UI/Umbraco/config/lang/da.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,8 @@ Mange hilsner fra Umbraco robotten
14551455
<key alias="warning">Advarsel</key>
14561456
<key alias="youAreDeleting">Du sletter en rækkekonfiguration</key>
14571457
<key alias="deletingARow">Sletning af et rækkekonfigurations navn vil resultere i et tab af data for alle eksiterende indhold som bruger dens konfiguration.</key>
1458+
<key alias="deleteLayout">Du sletter et layoutet</key>
1459+
<key alias="deletingALayout">Når du redigerer et layout vil data gå tabt de steder, hvor denne konfiguration bruges.</key>
14581460
<key alias="maxItems">Maksimalt emner</key>
14591461
<key alias="maxItemsDescription">Efterlad blank eller sæt til 0 for ubegrænset</key>
14601462
</area>

src/Umbraco.Web.UI/Umbraco/config/lang/en.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,11 +1642,11 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
16421642
<key alias="chooseExtra">Choose extra</key>
16431643
<key alias="chooseDefault">Choose default</key>
16441644
<key alias="areAdded">are added</key>
1645-
<key alias="warning">Warning</key>
1646-
<key alias="youAreDeleting">You are deleting the row configuration</key>
1647-
<key alias="deletingARow">
1648-
Deleting a row configuration name will result in loss of data for any existing content that is based on this configuration.
1649-
</key>
1645+
<key alias="warning">Warning</key>
1646+
<key alias="youAreDeleting">You are deleting the row configuration</key>
1647+
<key alias="deletingARow">Deleting a row configuration name will result in loss of data for any existing content that is based on this configuration.</key>
1648+
<key alias="deleteLayout">You are deleting the layout</key>
1649+
<key alias="deletingALayout">Modifying a layout will result in loss of data for any existing content that is based on this configuration.</key>
16501650
</area>
16511651
<area alias="contentTypeEditor">
16521652
<key alias="compositions">Compositions</key>

src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,12 +1661,12 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
16611661
<key alias="setAsDefault">Set as default</key>
16621662
<key alias="chooseExtra">Choose extra</key>
16631663
<key alias="chooseDefault">Choose default</key>
1664-
<key alias="areAdded">are added</key>
1665-
<key alias="warning">Warning</key>
1666-
<key alias="youAreDeleting">You are deleting the row configuration</key>
1667-
<key alias="deletingARow">
1668-
Deleting a row configuration name will result in loss of data for any existing content that is based on this configuration.
1669-
</key>
1664+
<key alias="areAdded">are added</key>
1665+
<key alias="warning">Warning</key>
1666+
<key alias="youAreDeleting">You are deleting the row configuration</key>
1667+
<key alias="deletingARow">Deleting a row configuration name will result in loss of data for any existing content that is based on this configuration.</key>
1668+
<key alias="deleteLayout">You are deleting the layout</key>
1669+
<key alias="deletingALayout">Modifying a layout will result in loss of data for any existing content that is based on this configuration.</key>
16701670
</area>
16711671
<area alias="contentTypeEditor">
16721672
<key alias="compositions">Compositions</key>

0 commit comments

Comments
 (0)