List view editor: adds delete confirmation

This commit is contained in:
Tim Geyssens
2013-09-19 16:22:37 +02:00
parent 42e3a3cf2b
commit 9c19f161dc

View File

@@ -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 () {