| @@ -4,10 +4,15 @@ class app.views.DocList extends app.View · 3 unmodified lines |
| 4 | @events: | 4 | @events: |
| 5 | open: 'onOpen' | 5 | open: 'onOpen' |
| 6 | close: 'onClose' | 6 | close: 'onClose' |
| | 7 | click: 'onClick' |
| 7 | | 8 | |
| 8 | @routes: | 9 | @routes: |
| 9 | after: 'afterRoute' | 10 | after: 'afterRoute' |
| 10 | | 11 | |
| | 12 | @elements: |
| | 13 | disabledTitle: '._list-title' |
| | 14 | disabledList: '._disabled-list' |
| | 15 | |
| 11 | init: -> | 16 | init: -> |
| 12 | @lists = {} | 17 | @lists = {} |
| 13 | | 18 | |
| @@ -32,11 +37,23 @@ class app.views.DocList extends app.View · 18 unmodified lines |
| 32 | render: => | 37 | render: => |
| 33 | @html @tmpl('sidebarDoc', app.docs.all()) | 38 | @html @tmpl('sidebarDoc', app.docs.all()) |
| 34 | @renderDisabled() unless app.isSingleDoc() or app.settings.hasDocs() | 39 | @renderDisabled() unless app.isSingleDoc() or app.settings.hasDocs() |
| | 40 | @refreshElements() |
| 35 | return | 41 | return |
| 36 | | 42 | |
| 37 | renderDisabled: -> | 43 | renderDisabled: -> |
| 38 | @append @tmpl('sidebarDisabled') + | 44 | @append @tmpl('sidebarDisabled') |
| 39 | @tmpl('sidebarDoc', app.disabledDocs.all(), disabled: true) | 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 | return | 57 | return |
| 41 | | 58 | |
| 42 | reset: -> | 59 | reset: -> |
| @@ -97,6 +114,15 @@ class app.views.DocList extends app.View · 54 unmodified lines |
| 97 | $.scrollTo @find("a[href='#{model.fullPath()}']"), null, 'top', margin: 0 | 114 | $.scrollTo @find("a[href='#{model.fullPath()}']"), null, 'top', margin: 0 |
| 98 | return | 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 | afterRoute: (route, context) => | 126 | afterRoute: (route, context) => |
| 101 | if context.init | 127 | if context.init |
| 102 | @reset() | 128 | @reset() |