From 9c19f161dcc2a4d3303285d60918b7f8f9a0a0c2 Mon Sep 17 00:00:00 2001 From: Tim Geyssens Date: Thu, 19 Sep 2013 16:22:37 +0200 Subject: [PATCH] List view editor: adds delete confirmation --- .../listview/listview.controller.js | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 5b461a1c1b..f4e0e1b986 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -113,24 +113,27 @@ angular.module("umbraco") }; $scope.delete = function () { - $scope.actionInProgress = true; - $scope.bulkStatus = "Starting with delete"; - var current = 1; - var total = $scope.selected.length; - for (var i = 0; i < $scope.selected.length; i++) { - $scope.bulkStatus = "Deleted doc " + current + " out of " + total + " documents"; - contentResource.deleteById($scope.selected[i]).then(function (data) { - if (current == total) { - notificationsService.success("Bulk action", "Deleted " + total + "documents"); - $scope.bulkStatus = ""; - $scope.selected = []; - $scope.reloadView($scope.content.id); - $scope.actionInProgress = false; - } - current++; - }); + + if (confirm("Sure you want to delete?") == true) { + $scope.actionInProgress = true; + $scope.bulkStatus = "Starting with delete"; + var current = 1; + var total = $scope.selected.length; + for (var i = 0; i < $scope.selected.length; i++) { + $scope.bulkStatus = "Deleted doc " + current + " out of " + total + " documents"; + contentResource.deleteById($scope.selected[i]).then(function(data) { + if (current == total) { + notificationsService.success("Bulk action", "Deleted " + total + "documents"); + $scope.bulkStatus = ""; + $scope.selected = []; + $scope.reloadView($scope.content.id); + $scope.actionInProgress = false; + } + current++; + }); + } } - + }; $scope.publish = function () {