Skip to content

Commit

Permalink
Add warning overlay when deleting grid layout
Browse files Browse the repository at this point in the history
  • Loading branch information
BatJan authored and nul800sebastiaan committed Oct 20, 2021
1 parent fef162b commit 9a16907
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,29 @@ angular.module("umbraco")
editorService.open(layoutConfigOverlay);
}

function deleteTemplate(index) {
$scope.model.value.templates.splice(index, 1);
function deleteTemplate(template, index, event) {

const dialog = {
view: "views/propertyEditors/grid/overlays/layoutdeleteconfirm.html",
layout: template,
submitButtonLabelKey: "contentTypeEditor_yesDelete",
submitButtonStyle: "danger",
submit: function (model) {
$scope.model.value.templates.splice(index, 1);
overlayService.close();
},
close: function () {
overlayService.close();
}
};

localizationService.localize("general_delete").then(value => {
dialog.title = value;
overlayService.open(dialog);
});

event.preventDefault();
event.stopPropagation();
}

/****************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h4>

<div>
<p>{{template.name}}</p>
<button type="button" class="btn btn-small btn-link" ng-click="vm.deleteTemplate($index)">
<button type="button" class="btn btn-small btn-link" ng-click="vm.deleteTemplate(template, $index, $event)">
<umb-icon icon="icon-delete" class="red"></umb-icon>
<localize key="general_delete">Delete</localize>
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div>
<div ng-if="model.layout" class="umb-alert umb-alert--warning mb2">
<localize key="grid_deleteLayout">You are deleting the layout</localize> <strong>{{model.layout.name}}</strong>.
</div>

<p>
<localize key="grid_deletingALayout">
Modifying layout will result in loss of data for any existing content that is based on this configuration.
</localize>
</p>

<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize>?

</div>
2 changes: 2 additions & 0 deletions src/Umbraco.Web.UI/Umbraco/config/lang/da.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,8 @@ Mange hilsner fra Umbraco robotten
<key alias="warning">Advarsel</key>
<key alias="youAreDeleting">Du sletter en rækkekonfiguration</key>
<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>
<key alias="deleteLayout">Du sletter et layoutet</key>
<key alias="deletingALayout">Når du redigerer et layout vil data gå tabt de steder, hvor denne konfiguration bruges.</key>
<key alias="maxItems">Maksimalt emner</key>
<key alias="maxItemsDescription">Efterlad blank eller sæt til 0 for ubegrænset</key>
</area>
Expand Down
10 changes: 5 additions & 5 deletions src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1642,11 +1642,11 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="chooseExtra">Choose extra</key>
<key alias="chooseDefault">Choose default</key>
<key alias="areAdded">are added</key>
<key alias="warning">Warning</key>
<key alias="youAreDeleting">You are deleting the row configuration</key>
<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>
<key alias="warning">Warning</key>
<key alias="youAreDeleting">You are deleting the row configuration</key>
<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>
<key alias="deleteLayout">You are deleting the layout</key>
<key alias="deletingALayout">Modifying a layout will result in loss of data for any existing content that is based on this configuration.</key>
</area>
<area alias="contentTypeEditor">
<key alias="compositions">Compositions</key>
Expand Down
12 changes: 6 additions & 6 deletions src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1661,12 +1661,12 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="setAsDefault">Set as default</key>
<key alias="chooseExtra">Choose extra</key>
<key alias="chooseDefault">Choose default</key>
<key alias="areAdded">are added</key>
<key alias="warning">Warning</key>
<key alias="youAreDeleting">You are deleting the row configuration</key>
<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>
<key alias="areAdded">are added</key>
<key alias="warning">Warning</key>
<key alias="youAreDeleting">You are deleting the row configuration</key>
<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>
<key alias="deleteLayout">You are deleting the layout</key>
<key alias="deletingALayout">Modifying a layout will result in loss of data for any existing content that is based on this configuration.</key>
</area>
<area alias="contentTypeEditor">
<key alias="compositions">Compositions</key>
Expand Down

0 comments on commit 9a16907

Please sign in to comment.