mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 05:52:57 +00:00
Keep files ordered in overview panel in the same was as the file tree
This commit is contained in:
parent
293ba1fc4c
commit
0a6a6c3c28
5 changed files with 22 additions and 13 deletions
|
@ -52,13 +52,15 @@
|
|||
.rp-overview-loading(ng-if="reviewPanel.overview.loading")
|
||||
i.fa.fa-spinner.fa-spin
|
||||
.rp-overview-file(
|
||||
ng-repeat="(doc_id, entries) in reviewPanel.entries"
|
||||
ng-repeat="doc in docs"
|
||||
ng-if="!reviewPanel.overview.loading"
|
||||
)
|
||||
.rp-overview-file-header
|
||||
| {{ getFileName(doc_id) }}
|
||||
.rp-overview-file-header(
|
||||
ng-if="reviewPanel.entries[doc.doc.id] | notEmpty"
|
||||
)
|
||||
| {{ doc.path }}
|
||||
.rp-entry-wrapper(
|
||||
ng-repeat="(entry_id, entry) in entries | orderOverviewEntries"
|
||||
ng-repeat="(entry_id, entry) in reviewPanel.entries[doc.doc.id] | orderOverviewEntries"
|
||||
)
|
||||
div(ng-if="entry.type === 'insert' || entry.type === 'delete'")
|
||||
change-entry(
|
||||
|
|
|
@ -275,6 +275,16 @@ define [
|
|||
doc: entity
|
||||
path: path
|
||||
}
|
||||
# Keep list ordered by folders, then name
|
||||
@$scope.docs.sort (a,b) ->
|
||||
aDepth = (a.path.match(/\//g) || []).length
|
||||
bDepth = (b.path.match(/\//g) || []).length
|
||||
if aDepth - bDepth != 0
|
||||
return -(aDepth - bDepth) # Deeper path == folder first
|
||||
else if a.path < b.path
|
||||
return -1
|
||||
else
|
||||
return 1
|
||||
|
||||
getEntityPath: (entity) ->
|
||||
@_getEntityPathInFolder @$scope.rootFolder, entity
|
||||
|
|
|
@ -5,5 +5,6 @@ define [
|
|||
"ide/review-panel/directives/changeEntry"
|
||||
"ide/review-panel/directives/commentEntry"
|
||||
"ide/review-panel/directives/addCommentEntry"
|
||||
"ide/review-panel/filters/notEmpty"
|
||||
"ide/review-panel/filters/orderOverviewEntries"
|
||||
], () ->
|
|
@ -354,15 +354,6 @@ define [
|
|||
$scope.gotoEntry = (doc_id, entry) ->
|
||||
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
|
||||
|
||||
DOC_ID_NAMES = {}
|
||||
$scope.getFileName = (doc_id) ->
|
||||
# This is called a lot and is relatively expensive, so cache the result
|
||||
if !DOC_ID_NAMES[doc_id]?
|
||||
entity = ide.fileTreeManager.findEntityById(doc_id)
|
||||
return if !entity?
|
||||
DOC_ID_NAMES[doc_id] = ide.fileTreeManager.getEntityPath(entity)
|
||||
return DOC_ID_NAMES[doc_id]
|
||||
|
||||
# TODO: Eventually we need to get this from the server, and update it
|
||||
# when we get an id we don't know. This'll do for client side testing
|
||||
refreshUsers = () ->
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
app.filter 'notEmpty', () ->
|
||||
(object) -> !angular.equals({}, object)
|
Loading…
Reference in a new issue