Aggregate changes; make accept and reject work.

This commit is contained in:
Paulo Reis 2017-06-01 11:47:55 +01:00
parent 3cf8f26583
commit 11c0644490
2 changed files with 25 additions and 13 deletions

View file

@ -86,8 +86,8 @@
aggregate-change-entry(
entry="entry"
user="users[entry.metadata.user_id]"
on-reject="rejectChange(entry_id);"
on-accept="acceptChange(entry_id);"
on-reject="rejectAggChange(entry_id, entry.metadata.agg_op_id);"
on-accept="acceptAggChange(entry_id, entry.metadata.agg_op_id);"
on-indicator-click="toggleReviewPanel();"
on-body-click="gotoEntry(editor.open_doc_id, entry)"
permissions="permissions"
@ -264,13 +264,11 @@ script(type='text/ng-template', id='aggregateChangeEntryTemplate')
del.rp-content-highlight {{ entry.content }}
| for
ins.rp-content-highlight {{ entry.metadata.agg_op.content }}
//- span(ng-switch-when="insert") #{translate("tracked_change_added")} 
//- ins.rp-content-highlight {{ entry.content | limitTo:(isCollapsed ? contentLimit : entry.content.length) }}
//- a.rp-collapse-toggle(
//- href
//- ng-if="needsCollapsing"
//- ng-click="toggleCollapse();"
//- ) {{ isCollapsed ? '... (#{translate("show_all")})' : ' (#{translate("show_less")})' }}
a.rp-collapse-toggle(
href
ng-if="needsCollapsing"
ng-click="toggleCollapse();"
) {{ isCollapsed ? '... (#{translate("show_all")})' : ' (#{translate("show_less")})' }}
.rp-entry-metadata
| {{ entry.metadata.ts | date : 'MMM d, y h:mm a' }} • 
span.rp-entry-user(style="color: hsl({{ user.hue }}, 70%, 40%);") {{ user.name }}

View file

@ -256,6 +256,7 @@ define [
if aggregate_entry
new_entry.type = "agg-change"
new_entry.metadata.agg_op = entries[prev_insertion.id]
new_entry.metadata.agg_op_id = prev_insertion.id
delete entries[prev_insertion.id]
for key, value of new_entry
@ -356,10 +357,23 @@ 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.acceptAggChange = (entry_id1, entry_id2) ->
_doAcceptMultipleChanges [ entry_id1, entry_id2 ]
event_tracking.sendMB "rp-agg-change-accepted", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
$scope.rejectAggChange = (entry_id1, entry_id2) ->
_doRejectMultipleChanges [ entry_id1, entry_id2 ]
event_tracking.sendMB "rp-agg-change-rejected", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
_doAcceptMultipleChanges = (change_ids) ->
$http.post "/project/#{$scope.project_id}/doc/#{$scope.editor.open_doc_id}/changes/accept", { change_ids, _csrf: window.csrfToken}
$scope.$broadcast "change:bulk-accept", change_ids
_doRejectMultipleChanges = (change_ids) ->
$scope.$broadcast "change:bulk-reject", change_ids
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
_doAcceptMultipleChanges $scope.reviewPanel.selectedEntryIds.slice()
$scope.reviewPanel.selectedEntryIds = []
event_tracking.sendMB "rp-bulk-accept", {
view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini',
@ -367,7 +381,7 @@ define [
}
bulkReject = () ->
$scope.$broadcast "change:bulk-reject", $scope.reviewPanel.selectedEntryIds.slice()
_doRejectMultipleChanges $scope.reviewPanel.selectedEntryIds.slice()
$scope.reviewPanel.selectedEntryIds = []
event_tracking.sendMB "rp-bulk-reject", {
view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini',