V8: Remove create option in listviews for deleted content (#7655)

This commit is contained in:
Kenn Jacobsen
2020-02-24 19:46:36 +01:00
committed by GitHub
parent 23f8c3e474
commit 69b3bc6fc7

View File

@@ -722,39 +722,6 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
return;
}
getContentTypesCallback(id).then(function (listViewAllowedTypes) {
$scope.listViewAllowedTypes = listViewAllowedTypes;
var blueprints = false;
_.each(listViewAllowedTypes, function (allowedType) {
if (_.isEmpty(allowedType.blueprints)) {
// this helps the view understand that there are no blueprints available
allowedType.blueprints = null;
}
else {
blueprints = true;
// turn the content type blueprints object into an array of sortable objects for the view
allowedType.blueprints = _.map(_.pairs(allowedType.blueprints || {}), function (pair) {
return {
id: pair[0],
name: pair[1]
};
});
}
});
if (listViewAllowedTypes.length === 1 && blueprints === false) {
$scope.createAllowedButtonSingle = true;
}
if (listViewAllowedTypes.length === 1 && blueprints === true) {
$scope.createAllowedButtonSingleWithBlueprints = true;
}
if (listViewAllowedTypes.length > 1) {
$scope.createAllowedButtonMultiWithBlueprints = true;
}
});
$scope.contentId = id;
$scope.isTrashed = editorState.current ? editorState.current.trashed : id === "-20" || id === "-21";
@@ -768,6 +735,40 @@ function listViewController($scope, $interpolate, $routeParams, $injector, $time
$scope.options.allowBulkMove ||
$scope.options.allowBulkDelete;
if ($scope.isTrashed === false) {
getContentTypesCallback(id).then(function (listViewAllowedTypes) {
$scope.listViewAllowedTypes = listViewAllowedTypes;
var blueprints = false;
_.each(listViewAllowedTypes, function (allowedType) {
if (_.isEmpty(allowedType.blueprints)) {
// this helps the view understand that there are no blueprints available
allowedType.blueprints = null;
}
else {
blueprints = true;
// turn the content type blueprints object into an array of sortable objects for the view
allowedType.blueprints = _.map(_.pairs(allowedType.blueprints || {}), function (pair) {
return {
id: pair[0],
name: pair[1]
};
});
}
});
if (listViewAllowedTypes.length === 1 && blueprints === false) {
$scope.createAllowedButtonSingle = true;
}
if (listViewAllowedTypes.length === 1 && blueprints === true) {
$scope.createAllowedButtonSingleWithBlueprints = true;
}
if (listViewAllowedTypes.length > 1) {
$scope.createAllowedButtonMultiWithBlueprints = true;
}
});
}
$scope.reloadView($scope.contentId);
}