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

View file

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

View file

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