History

Sort docs by name in the sidebar

Thibaut committed 12 years ago

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

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
69 docs = @settings.getDocs()69 docs = @settings.getDocs()
70 for doc in @DOCS70 for doc in @DOCS
71 (if docs.indexOf(doc.slug) >= 0 then @docs else @disabledDocs).add(doc)71 (if docs.indexOf(doc.slug) >= 0 then @docs else @disabledDocs).add(doc)
72 @docs.sort()
73 @disabledDocs.sort()
72 @docs.load @start.bind(@), @onBootError.bind(@), readCache: true, writeCache: true74 @docs.load @start.bind(@), @onBootError.bind(@), readCache: true, writeCache: true
73 delete @DOCS75 delete @DOCS
74 return76 return
assets/javascripts/collections/docs.coffee+6−0
@@ -1,6 +1,12 @@
1class app.collections.Docs extends app.Collection1class app.collections.Docs extends app.Collection
2 @model: 'Doc'2 @model: 'Doc'
3 3
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
4 # Load models concurrently.10 # Load models concurrently.
5 # It's not pretty but I didn't want to import a promise library only for this.11 # It's not pretty but I didn't want to import a promise library only for this.
6 CONCURRENCY = 312 CONCURRENCY = 3