History

Improve doc list for versioned docs

Ref #25.

Thibaut Courouble committed 10 years ago

Commit 2ece8d11 parent 26858606 files · +37 −11Browse files

Showing the changes to assets/javascripts/views (4 of 6 files). Show all

Unified · Split

4 files
  1. assets/javascripts/views/list/list_focus.coffee +8 −2
  2. assets/javascripts/views/list/list_fold.coffee +2 −2
  3. assets/javascripts/views/sidebar/doc_list.coffee +15 −1
  4. assets/javascripts/views/sidebar/doc_picker.coffee +1 −1
assets/javascripts/views/list/list_focus.coffee+8−2
@@ -38,7 +38,10 @@ class app.views.ListFocus extends app.View · 37 unmodified lines
3838 $.click(next)
3939 @findNext cursor
4040 else if next.tagName is 'DIV' # sub-list
41− @findFirst(next) or @findNext(next)
41+ if cursor.className.indexOf('open') >= 0
42+ @findFirst(next) or @findNext(next)
43+ else
44+ @findNext(next)
4245 else if next.tagName is 'H6' # title
4346 @findNext(next)
4447 else if cursor.parentElement isnt @el
@@ -61,7 +64,10 @@ class app.views.ListFocus extends app.View · 16 unmodified lines
6164 $.click(prev)
6265 @findPrev cursor
6366 else if prev.tagName is 'DIV' # sub-list
64− @findLast(prev) or @findPrev(prev)
67+ if prev.previousSibling.className.indexOf('open') >= 0
68+ @findLast(prev) or @findPrev(prev)
69+ else
70+ @findPrev(prev)
6571 else if prev.tagName is 'H6' # title
6672 @findPrev(prev)
6773 else if cursor.parentElement isnt @el
assets/javascripts/views/list/list_fold.coffee+2−2
@@ -10,7 +10,7 @@ class app.views.ListFold extends app.View · 9 unmodified lines
1010 left: 'onLeft'
1111 right: 'onRight'
1212
13− constructor: (@el, @options = {}) -> super
13+ constructor: (@el) -> super
1414
1515 open: (el) ->
1616 if el and not el.classList.contains @constructor.activeClass
@@ -60,5 +60,5 @@ class app.views.ListFold extends app.View · 43 unmodified lines
6060 $.stopEvent(event)
6161 @toggle el.parentElement
6262 else if el.classList.contains @constructor.targetClass
63− if @options.toggleOnclick then @toggle(el) else @open(el)
63+ if el.hasAttribute('href') then @open(el) else @toggle(el)
6464 return
assets/javascripts/views/sidebar/doc_list.coffee+15−1
@@ -54,7 +54,21 @@ class app.views.DocList extends app.View · 53 unmodified lines
5454 return
5555
5656 appendDisabledList: ->
57− @append @tmpl('sidebarDisabledList', docs: app.disabledDocs.all())
57+ html = ''
58+ docs = [].concat(app.disabledDocs.all()...)
59+
60+ while doc = docs.shift()
61+ if doc.version
62+ versions = ''
63+ loop
64+ versions += @tmpl('sidebarDoc', doc, disabled: true)
65+ break if docs[0].name isnt doc.name
66+ doc = docs.shift()
67+ html += @tmpl('sidebarDisabledVersionedDoc', doc, versions)
68+ else
69+ html += @tmpl('sidebarDoc', doc, disabled: true)
70+
71+ @append @tmpl('sidebarDisabledList', html)
5872 @disabledTitle.classList.add('open-title')
5973 @refreshElements()
6074 return
assets/javascripts/views/sidebar/doc_picker.coffee+1−1
@@ -11,7 +11,7 @@ class app.views.DocPicker extends app.View · 10 unmodified lines
1111 enter: 'onEnter'
1212
1313 init: ->
14− @addSubview @listFold = new app.views.ListFold(@el, toggleOnclick: true)
14+ @addSubview @listFold = new app.views.ListFold(@el)
1515 return
1616
1717 activate: ->

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t