Store selected entries; improve visibility logic.

This commit is contained in:
Paulo Reis 2017-05-03 16:35:58 +01:00
parent 0249a13012
commit bf7bf701ed
3 changed files with 12 additions and 13 deletions

View file

@ -8,20 +8,20 @@
) !{translate("track_changes_is_on")} ) !{translate("track_changes_is_on")}
a.rp-bulk-actions-btn( a.rp-bulk-actions-btn(
href href
ng-if="reviewPanel.nSelectedEntries > 0" ng-if="reviewPanel.selectedEntries.length > 0"
ng-click="bulkAccept();" ng-click="bulkAccept();"
) )
i.fa.fa-check i.fa.fa-check
|  #{translate("accept_all")} |  #{translate("accept_all")}
| ({{ reviewPanel.nSelectedEntries }}) | ({{ reviewPanel.selectedEntries.length }})
a.rp-bulk-actions-btn( a.rp-bulk-actions-btn(
href href
ng-if="reviewPanel.nSelectedEntries > 0" ng-if="reviewPanel.selectedEntries.length > 0"
ng-click="bulkReject();" ng-click="bulkReject();"
) )
i.fa.fa-times i.fa.fa-times
|  #{translate("reject_all")} |  #{translate("reject_all")}
| ({{ reviewPanel.nSelectedEntries }}) | ({{ reviewPanel.selectedEntries.length }})
a.rp-add-comment-btn( a.rp-add-comment-btn(
href href
ng-if="reviewPanel.entries[editor.open_doc_id]['add-comment'] != null" ng-if="reviewPanel.entries[editor.open_doc_id]['add-comment'] != null"
@ -103,7 +103,7 @@
bulk-actions-entry( bulk-actions-entry(
on-bulk-accept="bulkAccept();" on-bulk-accept="bulkAccept();"
on-bulk-reject="bulkReject();" on-bulk-reject="bulkReject();"
n-entries="reviewPanel.nSelectedEntries" n-entries="reviewPanel.selectedEntries.length"
) )
.rp-entry-list( .rp-entry-list(

View file

@ -26,7 +26,7 @@ define [
resolvedThreadIds: {} resolvedThreadIds: {}
rendererData: {} rendererData: {}
loadingThreads: false loadingThreads: false
nSelectedEntries: 0 selectedEntries: []
window.addEventListener "beforeunload", () -> window.addEventListener "beforeunload", () ->
collapsedStates = {} collapsedStates = {}
@ -284,7 +284,7 @@ define [
$scope.$on "editor:focus:changed", (e, selection_offset_start, selection_offset_end, selection) -> $scope.$on "editor:focus:changed", (e, selection_offset_start, selection_offset_end, selection) ->
doc_id = $scope.editor.open_doc_id doc_id = $scope.editor.open_doc_id
entries = getDocEntries(doc_id) entries = getDocEntries(doc_id)
$scope.reviewPanel.nSelectedEntries = 0 $scope.reviewPanel.selectedEntries = []
delete entries["add-comment"] delete entries["add-comment"]
delete entries["bulk-actions"] delete entries["bulk-actions"]
@ -307,11 +307,11 @@ define [
else if entry.type == "insert" else if entry.type == "insert"
isEntryWithinSelection = entry.offset >= selection_offset_start and entry.offset + entry.content.length <= selection_offset_end isEntryWithinSelection = entry.offset >= selection_offset_start and entry.offset + entry.content.length <= selection_offset_end
entry.focused = (entry.offset <= selection_offset_start <= entry.offset + entry.content.length) entry.focused = (entry.offset <= selection_offset_start <= entry.offset + entry.content.length)
$scope.reviewPanel.nSelectedEntries++ if isEntryWithinSelection $scope.reviewPanel.selectedEntries.push entry if isEntryWithinSelection
else if entry.type == "delete" else if entry.type == "delete"
isEntryWithinSelection = selection_offset_start <= entry.offset <= selection_offset_end isEntryWithinSelection = selection_offset_start <= entry.offset <= selection_offset_end
entry.focused = (entry.offset == selection_offset_start) entry.focused = (entry.offset == selection_offset_start)
$scope.reviewPanel.nSelectedEntries++ if isEntryWithinSelection $scope.reviewPanel.selectedEntries.push entry if isEntryWithinSelection
else if entry.type in [ "add-comment", "bulk-actions" ] and selection else if entry.type in [ "add-comment", "bulk-actions" ] and selection
entry.focused = true entry.focused = true

View file

@ -930,6 +930,9 @@
.rp-size-mini & { .rp-size-mini & {
right: @review-off-width; right: @review-off-width;
} }
.rp-size-expanded & {
display: none;
}
} }
.rp-track-changes-indicator { .rp-track-changes-indicator {
display: block; display: block;
@ -958,10 +961,6 @@
background-color: rgba(240, 240, 240, 1); background-color: rgba(240, 240, 240, 1);
color: @rp-type-blue; color: @rp-type-blue;
} }
.rp-size-expanded & {
display: none;
}
} }
// Helper class for elements which aren't treated as flex-items by IE10, e.g: // Helper class for elements which aren't treated as flex-items by IE10, e.g: