List view editor: disable bulk actions if action is in progress

This commit is contained in:
Tim Geyssens
2013-09-19 16:10:31 +02:00
parent da0c98e158
commit 42e3a3cf2b
2 changed files with 8 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ angular.module("umbraco")
function ($rootScope, $scope, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService) {
$scope.selected = [];
$scope.actionInProgress = false;
$scope.options = {
pageSize: 10,
@@ -112,6 +113,7 @@ angular.module("umbraco")
};
$scope.delete = function () {
$scope.actionInProgress = true;
$scope.bulkStatus = "Starting with delete";
var current = 1;
var total = $scope.selected.length;
@@ -123,6 +125,7 @@ angular.module("umbraco")
$scope.bulkStatus = "";
$scope.selected = [];
$scope.reloadView($scope.content.id);
$scope.actionInProgress = false;
}
current++;
});
@@ -131,6 +134,7 @@ angular.module("umbraco")
};
$scope.publish = function () {
$scope.actionInProgress = true;
$scope.bulkStatus = "Starting with publish";
var current = 1;
var total = $scope.selected.length;
@@ -144,6 +148,7 @@ angular.module("umbraco")
notificationsService.success("Bulk action", "Published " + total + "documents");
$scope.bulkStatus = "";
$scope.reloadView($scope.content.id);
$scope.actionInProgress = false;
}
current++;
});

View File

@@ -17,13 +17,13 @@
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-success" ng-click="publish()" prevent-default>Publish</a>
<a class="btn btn-success" ng-disabled="actionInProgress" ng-click="publish()" prevent-default>Publish</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-warning" ng-click="unpublish()" prevent-default>Unpublish</a>
<a class="btn btn-warning" ng-disabled="actionInProgress" ng-click="unpublish()" prevent-default>Unpublish</a>
</div>
<div class="btn-group" ng-show="isAnythingSelected()">
<a class="btn btn-danger" ng-click="delete()" prevent-default>Delete</a>
<a class="btn btn-danger" ng-disabled="actionInProgress" ng-click="delete()" prevent-default>Delete</a>
</div>
<span ng-bind="bulkStatus" ng-show="isAnythingSelected()"></span>
</div>