Show doc version in sidebar when multiple versions of the same doc are enabled

pull/621/head
Thibaut Courouble 8 years ago
parent 2efce74521
commit 7961557468

@ -48,3 +48,8 @@ class app.Collection
findAllBy: (attr, value) ->
model for model in @models when model[attr] is value
countAllBy: (attr, value) ->
i = 0
i += 1 for model in @models when model[attr] is value
i

@ -10,7 +10,7 @@ templates.sidebarDoc = (doc, options = {}) ->
link += """<span class="_list-arrow"></span>"""
link += """<span class="_list-count">#{doc.release}</span>""" if doc.release
link += """<span class="_list-text">#{doc.name}"""
link += " #{doc.version}" if options.disabled and doc.version
link += " #{doc.version}" if options.fullName or options.disabled and doc.version
link + "</span></a>"
templates.sidebarType = (type) ->

@ -37,7 +37,10 @@ class app.views.DocList extends app.View
return
render: =>
@html @tmpl('sidebarDoc', app.docs.all())
html = ''
for doc in app.docs.all()
html += @tmpl('sidebarDoc', doc, fullName: app.docs.countAllBy('name', doc.name) > 1)
@html html
@renderDisabled() unless app.isSingleDoc() or app.disabledDocs.size() is 0
return

Loading…
Cancel
Save