Skip to content

Commit

Permalink
Removing unnecessary delete confirmation (#6448)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarhusit authored and nul800sebastiaan committed Sep 26, 2019
1 parent 9c366fe commit 99dcbd3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.ContentDeleteController
* @name Umbraco.Editors.Content.DeleteController
* @function
*
* @description
* The controller for deleting content
*/
function ContentDeleteController($scope, $timeout, contentResource, treeService, navigationService, editorState, $location, overlayService) {
function ContentDeleteController($scope, $timeout, contentResource, treeService, navigationService, editorState, $location, overlayService, languageResource) {

/**
* Used to toggle UI elements during delete operations
Expand Down Expand Up @@ -80,6 +80,20 @@ function ContentDeleteController($scope, $timeout, contentResource, treeService,
$scope.close = function () {
navigationService.hideDialog();
};


languageResource.getAll().then(function (data) {

$scope.hasMoreThanOneLanguage = data.length > 1;
}, function (err) {
toggleDeleting(false);

//check if response is ysod
if (err.status && err.status >= 500) {
// TODO: All YSOD handling should be done with an interceptor
overlayService.ysod(err);
}
});
}

angular.module("umbraco").controller("Umbraco.Editors.Content.DeleteController", ContentDeleteController);
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI.Client/src/views/content/delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<localize key="defaultdialogs_confirmdelete">Are you sure you want to delete</localize> <strong>{{currentNode.name}}</strong>?
</p>

<div class="umb-alert umb-alert--warning">
<div class="umb-alert umb-alert--warning" ng-show="hasMoreThanOneLanguage">
<localize key="defaultdialogs_variantdeletewarning">This will delete the node and all its languages. If you only want to delete one language go and unpublish it instead.</localize>
</div>

Expand Down

0 comments on commit 99dcbd3

Please sign in to comment.