Showing the changes to assets/javascripts (2 of 2 files). Show all
Unified · Split
| @@ -65,14 +65,11 @@ class app.views.DocList extends app.View · 64 unmodified lines | |||
| 65 | @refreshElements() | 65 | @refreshElements() |
| 66 | return | 66 | return |
| 67 | 67 | ||
| 68 | reset: -> | 68 | reset: (options = {}) -> |
| 69 | @listSelect.deselect() | 69 | @listSelect.deselect() |
| 70 | @listFocus?.blur() | 70 | @listFocus?.blur() |
| 71 | @listFold.reset() | 71 | @listFold.reset() |
| 72 | 72 | @revealCurrent() if options.revealCurrent | |
| 73 | if model = app.router.context.type or app.router.context.entry | ||
| 74 | @reveal model | ||
| 75 | @select model | ||
| 76 | return | 73 | return |
| 77 | 74 | ||
| 78 | onOpen: (event) => | 75 | onOpen: (event) => |
| @@ -107,6 +104,12 @@ class app.views.DocList extends app.View · 28 unmodified lines | |||
| 107 | @scrollTo model | 104 | @scrollTo model |
| 108 | return | 105 | return |
| 109 | 106 | ||
| 107 | revealCurrent: -> | ||
| 108 | if model = app.router.context.type or app.router.context.entry | ||
| 109 | @reveal model | ||
| 110 | @select model | ||
| 111 | return | ||
| 112 | |||
| 110 | openDoc: (doc) -> | 113 | openDoc: (doc) -> |
| 111 | @listFold.open @find("[data-slug='#{doc.slug}']") | 114 | @listFold.open @find("[data-slug='#{doc.slug}']") |
| 112 | return | 115 | return |
| @@ -139,12 +142,17 @@ class app.views.DocList extends app.View · 26 unmodified lines | |||
| 139 | else if slug = event.target.getAttribute('data-enable') | 142 | else if slug = event.target.getAttribute('data-enable') |
| 140 | $.stopEvent(event) | 143 | $.stopEvent(event) |
| 141 | doc = app.disabledDocs.findBy('slug', slug) | 144 | doc = app.disabledDocs.findBy('slug', slug) |
| 142 | app.enableDoc(doc, @render, @render) | 145 | app.enableDoc(doc, @onEnable, @onEnable) |
| 146 | return | ||
| 147 | |||
| 148 | onEnable: => | ||
| 149 | @reset() | ||
| 150 | @render() | ||
| 143 | return | 151 | return |
| 144 | 152 | ||
| 145 | afterRoute: (route, context) => | 153 | afterRoute: (route, context) => |
| 146 | if context.init | 154 | if context.init |
| 147 | @reset() | 155 | @reset revealCurrent: true |
| 148 | else | 156 | else |
| 149 | @select context.type or context.entry | 157 | @select context.type or context.entry |
| 150 | return | 158 | return |
| @@ -39,7 +39,7 @@ class app.views.Sidebar extends app.View · 38 unmodified lines | |||
| 39 | showDocList: (reset) => | 39 | showDocList: (reset) => |
| 40 | @show @docList | 40 | @show @docList |
| 41 | if reset is true | 41 | if reset is true |
| 42 | @docList.reset() | 42 | @docList.reset(revealCurrent: true) |
| 43 | @search.reset() | 43 | @search.reset() |
| 44 | return | 44 | return |
| 45 | 45 | ||