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
157 new app.views.Updates()157 new app.views.Updates()
158 @updateChecker = new app.UpdateChecker()158 @updateChecker = new app.UpdateChecker()
159 159
160 reboot: ->
161 if location.pathname isnt '/'
162 window.location = "/##{location.pathname}"
163 else
164 window.location = '/'
165 return
166
160 reload: ->167 reload: ->
161 @docs.clearCache()168 @docs.clearCache()
162 @disabledDocs.clearCache()169 @disabledDocs.clearCache()
163 if @appCache then @appCache.reload() else window.location = '/'170 if @appCache then @appCache.reload() else @reboot()
164 return171 return
165 172
166 reset: ->173 reset: ->
assets/javascripts/app/appcache.coffee+5−1
@@ -27,7 +27,11 @@ class app.AppCache · 26 unmodified lines
27 return27 return
28 28
29 reload: ->29 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 = '/'
31 @notifyUpdate = false35 @notifyUpdate = false
32 @notifyProgress = true36 @notifyProgress = true
33 try @cache.update() catch37 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
77 switch target.getAttribute('data-behavior')77 switch target.getAttribute('data-behavior')
78 when 'back' then history.back()78 when 'back' then history.back()
79 when 'reload' then window.location.reload()79 when 'reload' then window.location.reload()
80 when 'reboot' then window.location = '/'80 when 'reboot' then app.reboot()
81 when 'hard-reload' then app.reload()81 when 'hard-reload' then app.reload()
82 when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?')82 when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?')
83 return83 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