Reload the List View after a copy, if to the same parent (#15312)

This commit is contained in:
Terence Burridge
2024-02-07 17:07:46 +00:00
committed by GitHub
parent 839b2ff6a2
commit 318d994cf3

View File

@@ -650,8 +650,17 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
};
function performCopy(target, relateToOriginal, includeDescendants) {
var newPath = null;
var newTarget = null;
applySelected(
function (selected, index) { return contentResource.copy({ parentId: target.id, id: getIdCallback(selected[index]), relateToOriginal: relateToOriginal, recursive: includeDescendants }); },
function (selected, index) {
return contentResource.copy({ parentId: target.id, id: getIdCallback(selected[index]), relateToOriginal: relateToOriginal, recursive: includeDescendants })
.then(function (path) {
newPath = path;
newTarget = parseInt(target.id);
return path;
});
},
function (count, total) {
var key = (total === 1 ? "bulk_copiedItemOfItem" : "bulk_copiedItemOfItems");
return localizationService.localize(key, [count, total]);
@@ -659,6 +668,18 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
function (total) {
var key = (total === 1 ? "bulk_copiedItem" : "bulk_copiedItems");
return localizationService.localize(key, [total]);
})
.then(function () {
//executes if all is successful
if (newPath) {
if (newTarget === $scope.contentId) {
// if we copied this to the same parent, reload the current view completely
$scope.reloadView($scope.contentId);
} else {
// Otherwise just clear the current selection but don't reload
$scope.clearSelection();
}
}
});
}