History

Preserve path when reloading the app

Fixes #849.

Thibaut Courouble committed 8 years ago

Commit a8a97e01 parent f562c2f3 files · +14 −3Browse files

Unified · Split

3 files
  1. assets/javascripts/app/app.coffee +8 −1
  2. assets/javascripts/app/appcache.coffee +5 −1
  3. assets/javascripts/views/layout/document.coffee +1 −1
assets/javascripts/app/app.coffee+8−1
@@ -157,10 +157,17 @@ · 156 unmodified lines
157157 new app.views.Updates()
158158 @updateChecker = new app.UpdateChecker()
159159
160+ reboot: ->
161+ if location.pathname isnt '/'
162+ window.location = "/##{location.pathname}"
163+ else
164+ window.location = '/'
165+ return
166+
160167 reload: ->
161168 @docs.clearCache()
162169 @disabledDocs.clearCache()
163− if @appCache then @appCache.reload() else window.location = '/'
170+ if @appCache then @appCache.reload() else @reboot()
164171 return
165172
166173 reset: ->
assets/javascripts/app/appcache.coffee+5−1
@@ -27,7 +27,11 @@ class app.AppCache · 26 unmodified lines
2727 return
2828
2929 reload: ->
30− $.on @cache, 'updateready noupdate error', -> window.location = '/'
30+ $.on @cache, 'updateready noupdate error', ->
31+ if location.pathname isnt '/'
32+ window.location = "/##{location.pathname}"
33+ else
34+ window.location = '/'
3135 @notifyUpdate = false
3236 @notifyProgress = true
3337 try @cache.update() catch
assets/javascripts/views/layout/document.coffee+1−1
@@ -77,7 +77,7 @@ class app.views.Document extends app.View · 76 unmodified lines
7777 switch target.getAttribute('data-behavior')
7878 when 'back' then history.back()
7979 when 'reload' then window.location.reload()
80− when 'reboot' then window.location = '/'
80+ when 'reboot' then app.reboot()
8181 when 'hard-reload' then app.reload()
8282 when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?')
8383 return

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t