History

Sort docs by name in the sidebar

Thibaut committed 12 years ago

Commit 8edeeff1 parent 115ffa82 files · +8 −0Browse files

Showing the changes to assets/javascripts (2 of 2 files). Show all

Unified · Split

2 files
  1. assets/javascripts/app/app.coffee +2 −0
  2. assets/javascripts/collections/docs.coffee +6 −0
assets/javascripts/app/app.coffee+2−0
@@ -69,6 +69,8 @@ · 68 unmodified lines
6969 docs = @settings.getDocs()
7070 for doc in @DOCS
7171 (if docs.indexOf(doc.slug) >= 0 then @docs else @disabledDocs).add(doc)
72+ @docs.sort()
73+ @disabledDocs.sort()
7274 @docs.load @start.bind(@), @onBootError.bind(@), readCache: true, writeCache: true
7375 delete @DOCS
7476 return
assets/javascripts/collections/docs.coffee+6−0
@@ -1,6 +1,12 @@
11 class app.collections.Docs extends app.Collection
22 @model: 'Doc'
33
4+ sort: ->
5+ @models.sort (a, b) ->
6+ a = a.name.toLowerCase()
7+ b = b.name.toLowerCase()
8+ if a < b then -1 else if a > b then 1 else 0
9+
410 # Load models concurrently.
511 # It's not pretty but I didn't want to import a promise library only for this.
612 CONCURRENCY = 3