Integrate bulk actions dialog with controller actions.

This commit is contained in:
Paulo Reis 2017-05-09 16:06:34 +01:00
parent f3e020df7e
commit 8aee0edfe8
2 changed files with 23 additions and 2 deletions

View file

@ -1,6 +1,7 @@
define [
"ide/review-panel/controllers/ReviewPanelController"
"ide/review-panel/controllers/TrackChangesUpgradeModalController"
"ide/review-panel/controllers/BulkActionsModalController"
"ide/review-panel/directives/reviewPanelSorted"
"ide/review-panel/directives/reviewPanelToggle"
"ide/review-panel/directives/changeEntry"

View file

@ -335,7 +335,7 @@ define [
$scope.$broadcast "change:reject", entry_id
event_tracking.sendMB "rp-change-rejected", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
$scope.bulkAccept = () ->
bulkAccept = () ->
entry_ids = $scope.reviewPanel.selectedEntryIds.slice()
$http.post "/project/#{$scope.project_id}/doc/#{$scope.editor.open_doc_id}/changes/accept", { change_ids: entry_ids, _csrf: window.csrfToken}
$scope.$broadcast "change:bulk-accept", entry_ids
@ -345,7 +345,7 @@ define [
nEntries: $scope.reviewPanel.selectedEntryIds.length
}
$scope.bulkReject = () ->
bulkReject = () ->
$scope.$broadcast "change:bulk-reject", $scope.reviewPanel.selectedEntryIds.slice()
$scope.reviewPanel.selectedEntryIds = []
event_tracking.sendMB "rp-bulk-reject", {
@ -353,6 +353,26 @@ define [
nEntries: $scope.reviewPanel.selectedEntryIds.length
}
$scope.showBulkAcceptDialog = () ->
console.log "showBulkAcceptDialog"
showBulkActionsDialog true
$scope.showBulkRejectDialog = () -> showBulkActionsDialog false
showBulkActionsDialog = (isAccept) ->
$modal.open({
templateUrl: "bulkActionsModalTemplate"
controller: "BulkActionsModalController"
resolve:
isAccept: () -> isAccept
nChanges: () -> $scope.reviewPanel.selectedEntryIds.length
scope: $scope.$new()
}).result.then (isAccept) ->
if isAccept
bulkAccept()
else
bulkReject()
$scope.addNewComment = () ->
$scope.$broadcast "comment:start_adding"
$scope.toggleReviewPanel()