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