Showing the changes to assets/javascripts (2 of 3 files). Show all
Unified · Split
| @@ -27,7 +27,10 @@ templates.sidebarLabel = (doc, options = {}) -> · 26 unmodified lines | ||
| 27 | 27 | label += 'checked' if options.checked |
| 28 | 28 | label + ">#{doc.name}</label>" |
| 29 | 29 | |
| 30 | −templates.sidebarDisabled = '<h6 class="_list-title">Disabled</h6>' | |
| 30 | +templates.sidebarDisabledList = (options) -> | |
| 31 | + """<div class="_disabled-list">#{templates.render 'sidebarDoc', options.docs, disabled: true}</div>""" | |
| 32 | + | |
| 33 | +templates.sidebarDisabled = '<h6 class="_list-title"><span class="_list-arrow"></span>Disabled</h6>' | |
| 31 | 34 | |
| 32 | 35 | templates.sidebarVote = '<a href="https://trello.com/b/6BmTulfx/devdocs-documentation" class="_list-link" target="_blank">Vote for new documentation</a>' |
| 33 | 36 | |
| @@ -4,10 +4,15 @@ class app.views.DocList extends app.View · 3 unmodified lines | ||
| 4 | 4 | @events: |
| 5 | 5 | open: 'onOpen' |
| 6 | 6 | close: 'onClose' |
| 7 | + click: 'onClick' | |
| 7 | 8 | |
| 8 | 9 | @routes: |
| 9 | 10 | after: 'afterRoute' |
| 10 | 11 | |
| 12 | + @elements: | |
| 13 | + disabledTitle: '._list-title' | |
| 14 | + disabledList: '._disabled-list' | |
| 15 | + | |
| 11 | 16 | init: -> |
| 12 | 17 | @lists = {} |
| 13 | 18 | |
| @@ -32,11 +37,23 @@ class app.views.DocList extends app.View · 18 unmodified lines | ||
| 32 | 37 | render: => |
| 33 | 38 | @html @tmpl('sidebarDoc', app.docs.all()) |
| 34 | 39 | @renderDisabled() unless app.isSingleDoc() or app.settings.hasDocs() |
| 40 | + @refreshElements() | |
| 35 | 41 | return |
| 36 | 42 | |
| 37 | 43 | renderDisabled: -> |
| 38 | − @append @tmpl('sidebarDisabled') + | |
| 39 | − @tmpl('sidebarDoc', app.disabledDocs.all(), disabled: true) | |
| 44 | + @append @tmpl('sidebarDisabled') | |
| 45 | + @renderDisabledList() | |
| 46 | + return | |
| 47 | + | |
| 48 | + renderDisabledList: -> | |
| 49 | + @append @tmpl('sidebarDisabledList', docs: app.disabledDocs.all()) | |
| 50 | + @refreshElements() | |
| 51 | + @disabledTitle.classList.add('open-title') | |
| 52 | + return | |
| 53 | + | |
| 54 | + removeDisabledList: -> | |
| 55 | + @disabledList.remove() | |
| 56 | + @disabledTitle.classList.remove('open-title') | |
| 40 | 57 | return |
| 41 | 58 | |
| 42 | 59 | reset: -> |
| @@ -97,6 +114,15 @@ class app.views.DocList extends app.View · 54 unmodified lines | ||
| 97 | 114 | $.scrollTo @find("a[href='#{model.fullPath()}']"), null, 'top', margin: 0 |
| 98 | 115 | return |
| 99 | 116 | |
| 117 | + onClick: (event) => | |
| 118 | + return unless @disabledTitle and $.hasChild @disabledTitle, event.target | |
| 119 | + $.stopEvent(event) | |
| 120 | + if @disabledTitle.classList.contains('open-title') | |
| 121 | + @removeDisabledList() | |
| 122 | + else | |
| 123 | + @renderDisabledList() | |
| 124 | + | |
| 125 | + | |
| 100 | 126 | afterRoute: (route, context) => |
| 101 | 127 | if context.init |
| 102 | 128 | @reset() |