Display or otherwise the bulk action buttons (publish, unpublish and delete) according to the container config

This commit is contained in:
AndyButland
2014-07-27 20:52:06 +02:00
parent 4d19826d98
commit e1cf330638
2 changed files with 20 additions and 5 deletions

View File

@@ -29,13 +29,16 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
items: []
};
// Set default default options (i.e. those if no container configuration has been saved)
// Set "default default" options (i.e. those if no container configuration has been saved)
$scope.options = {
pageSize: 10,
pageNumber: 1,
filter: '',
orderBy: 'UpdateDate',
orderDirection: "desc"
orderDirection: "desc",
allowBulkPublish: true,
allowBulkUnpublish: true,
allowBulkDelete: true,
};
// Retrieve the container configuration for the content type and set options before presenting initial view
@@ -53,6 +56,18 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
$scope.options.orderDirection = config.orderDirection;
}
if (typeof (config.allowBulkPublish) !== 'undefined') {
$scope.options.allowBulkPublish = config.allowBulkPublish;
}
if (typeof (config.allowBulkUnpublish) !== 'undefined') {
$scope.options.allowBulkUnpublish = config.allowBulkUnpublish;
}
if (typeof (config.allowBulkDelete) !== 'undefined') {
$scope.options.allowBulkDelete = config.allowBulkDelete;
}
$scope.initView();
});

View File

@@ -23,17 +23,17 @@
</ul>
</div>
<div class="btn-group" ng-show="isAnythingSelected()" ng-if="entityType === 'content' && !isTrashed">
<div class="btn-group" ng-show="isAnythingSelected()" ng-if="entityType === 'content' && !isTrashed && options.allowBulkPublish">
<a class="btn btn-success" ng-disabled="actionInProgress" ng-click="publish()" prevent-default>
<localize key="actions_publish">Publish</localize>
</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()" ng-if="entityType === 'content' && !isTrashed">
<div class="btn-group" ng-show="isAnythingSelected()" ng-if="entityType === 'content' && !isTrashed && options.allowBulkUnpublish">
<a class="btn btn-warning" ng-disabled="actionInProgress" ng-click="unpublish()" prevent-default>
<localize key="actions_unpublish">Unpublish</localize>
</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<div class="btn-group" ng-show="isAnythingSelected()" ng-if="options.allowBulkDelete">
<a class="btn btn-danger" ng-disabled="actionInProgress" ng-click="delete()" prevent-default>
<localize key="actions_delete">Delete</localize>
</a>