Reload the List View after a copy, if to the same parent (#15312)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user