Order entries in the overview panel based on their place in the document

This commit is contained in:
James Allen 2016-11-18 16:30:41 +00:00
parent 6ea61472ec
commit 5814d93f5e
3 changed files with 18 additions and 6 deletions

View file

@ -47,14 +47,14 @@
.rp-overview-file-header .rp-overview-file-header
| {{ getFileName(doc_id) }} | {{ getFileName(doc_id) }}
.rp-entry-wrapper( .rp-entry-wrapper(
ng-repeat="(entry_id, entry) in entries" ng-repeat="(entry_id, entry) in entries | orderOverviewEntries"
) )
div(ng-if="entry.type === 'insert' || entry.type === 'delete'") div(ng-if="entry.type === 'insert' || entry.type === 'delete'")
change-entry( change-entry(
entry="entry" entry="entry"
user="users[entry.metadata.user_id]" user="users[entry.metadata.user_id]"
on-reject="rejectChange(entry_id);" on-reject="rejectChange(entry.id);"
on-accept="acceptChange(entry_id);" on-accept="acceptChange(entry.id);"
on-indicator-click="toggleReviewPanel();" on-indicator-click="toggleReviewPanel();"
ng-click="gotoEntry(doc_id, entry)" ng-click="gotoEntry(doc_id, entry)"
) )
@ -63,9 +63,9 @@
comment-entry( comment-entry(
entry="entry" entry="entry"
users="users" users="users"
on-resolve="resolveComment(entry, entry_id)" on-resolve="resolveComment(entry, entry.id)"
on-unresolve="unresolveComment(entry_id)" on-unresolve="unresolveComment(entry.id)"
on-delete="deleteComment(entry_id)" on-delete="deleteComment(entry.id)"
on-reply="submitReply(entry, entry_id);" on-reply="submitReply(entry, entry_id);"
on-indicator-click="toggleReviewPanel();" on-indicator-click="toggleReviewPanel();"
ng-click="gotoEntry(doc_id, entry)" ng-click="gotoEntry(doc_id, entry)"

View file

@ -4,4 +4,5 @@ define [
"ide/review-panel/directives/changeEntry" "ide/review-panel/directives/changeEntry"
"ide/review-panel/directives/commentEntry" "ide/review-panel/directives/commentEntry"
"ide/review-panel/directives/addCommentEntry" "ide/review-panel/directives/addCommentEntry"
"ide/review-panel/filters/orderOverviewEntries"
], () -> ], () ->

View file

@ -0,0 +1,11 @@
define [
"base"
], (App) ->
App.filter "orderOverviewEntries", () ->
(items) ->
array = []
for key, value of items
value.entry_id = key
array.push value
array.sort (a, b) -> a.offset - b.offset
return array