|
|
@ -1,5 +1,5 @@
|
|
|
|
class app.views.DocPicker extends app.View
|
|
|
|
class app.views.DocPicker extends app.View
|
|
|
|
@className: '_list'
|
|
|
|
@className: '_list _list-picker'
|
|
|
|
|
|
|
|
|
|
|
|
@elements:
|
|
|
|
@elements:
|
|
|
|
saveLink: '._sidebar-footer-save'
|
|
|
|
saveLink: '._sidebar-footer-save'
|
|
|
@ -10,6 +10,10 @@ class app.views.DocPicker extends app.View
|
|
|
|
@shortcuts:
|
|
|
|
@shortcuts:
|
|
|
|
enter: 'onEnter'
|
|
|
|
enter: 'onEnter'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init: ->
|
|
|
|
|
|
|
|
@addSubview @listFold = new app.views.ListFold(@el, toggleOnclick: true)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
activate: ->
|
|
|
|
activate: ->
|
|
|
|
if super
|
|
|
|
if super
|
|
|
|
@render()
|
|
|
|
@render()
|
|
|
@ -26,11 +30,17 @@ class app.views.DocPicker extends app.View
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
render: ->
|
|
|
|
render: ->
|
|
|
|
@html @tmpl('sidebarLabel', app.docs.all(), checked: true) +
|
|
|
|
html = ''
|
|
|
|
@tmpl('sidebarLabel', app.disabledDocs.all()) +
|
|
|
|
docs = app.docs.all().concat(app.disabledDocs.all()...)
|
|
|
|
@tmpl('sidebarPickerNote') +
|
|
|
|
|
|
|
|
@tmpl('sidebarSave')
|
|
|
|
while doc = docs.shift()
|
|
|
|
|
|
|
|
if doc.version
|
|
|
|
|
|
|
|
[docs, versions] = @extractVersions(docs, doc)
|
|
|
|
|
|
|
|
html += @tmpl('sidebarVersionedDoc', doc, @renderVersions(versions), open: app.docs.contains(doc))
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
html += @tmpl('sidebarLabel', doc, checked: app.docs.contains(doc))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@html html + @tmpl('sidebarPickerNote') + @tmpl('sidebarSave')
|
|
|
|
@refreshElements()
|
|
|
|
@refreshElements()
|
|
|
|
|
|
|
|
|
|
|
|
@delay -> # trigger animation
|
|
|
|
@delay -> # trigger animation
|
|
|
@ -38,6 +48,18 @@ class app.views.DocPicker extends app.View
|
|
|
|
@addClass '_in'
|
|
|
|
@addClass '_in'
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderVersions: (docs) ->
|
|
|
|
|
|
|
|
html = ''
|
|
|
|
|
|
|
|
html += @tmpl('sidebarLabel', doc, checked: app.docs.contains(doc)) for doc in docs
|
|
|
|
|
|
|
|
html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extractVersions: (originalDocs, version) ->
|
|
|
|
|
|
|
|
docs = []
|
|
|
|
|
|
|
|
versions = [version]
|
|
|
|
|
|
|
|
for doc in originalDocs
|
|
|
|
|
|
|
|
(if doc.name is version.name then versions else docs).push(doc)
|
|
|
|
|
|
|
|
[docs, versions]
|
|
|
|
|
|
|
|
|
|
|
|
empty: ->
|
|
|
|
empty: ->
|
|
|
|
@resetClass()
|
|
|
|
@resetClass()
|
|
|
|
super
|
|
|
|
super
|
|
|
|