From 85a54c64920c3335fc5b1382ffae797a4574be5f Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 25 May 2016 11:20:35 +0200 Subject: [PATCH] fixes the delete part of U4-8491 --- .../listview/listview.controller.js | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 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 3911ef7338..594475a7d2 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 @@ -366,11 +366,24 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie } $scope.delete = function () { - applySelected( - function (selected, index) { return deleteItemCallback(getIdCallback(selected[index])); }, - function (count, total) { return "Deleted " + count + " out of " + total + " item" + (total > 1 ? "s" : ""); }, - function (total) { return "Deleted " + total + " item" + (total > 1 ? "s" : ""); }, - "Sure you want to delete?"); + + var attempt = + applySelected( + function(selected, index) { return deleteItemCallback(getIdCallback(selected[index])); }, + function(count, total) { + return "Deleted " + count + " out of " + total + " item" + (total > 1 ? "s" : ""); + }, + function(total) { return "Deleted " + total + " item" + (total > 1 ? "s" : ""); }, + "Sure you want to delete?"); + if (attempt) { + attempt.then(function () { + //executes if all is successful, let's sync the tree + var activeNode = appState.getTreeState("selectedNode"); + if (activeNode) { + navigationService.reloadNode(activeNode); + } + }); + } }; $scope.publish = function () { @@ -412,6 +425,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie }; + function performMove(target) { //NOTE: With the way this applySelected/serial works, I'm not sure there's a better way currently to return @@ -425,9 +439,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie return path; }); }, - function(count, total) { - return "Moved " + count + " out of " + total + " item" + (total > 1 ? "s" : ""); - }, + function(count, total) {return "Moved " + count + " out of " + total + " item" + (total > 1 ? "s" : "");}, function(total) { return "Moved " + total + " item" + (total > 1 ? "s" : ""); }) .then(function() { //executes if all is successful, let's sync the tree