changeset 7643:7135fd2db7c9 stable

files: fix ignored navigation back to initial page The popstate event for going back to the pageload page has no state and was ignored. Instead, in that case, use a "fake" initial state based on template values.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 30 Apr 2019 19:03:02 +0200
parents b1e2ae0dd6e1
children f4b050aceb1e
files kallithea/templates/files/files.html
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/files/files.html	Tue Apr 30 19:04:38 2019 +0200
+++ b/kallithea/templates/files/files.html	Tue Apr 30 19:03:02 2019 +0200
@@ -215,6 +215,8 @@
     window.addEventListener('popstate', function(e){
         if (e.state)
             load_state(e.state);
+        else
+            load_state(initial_state);
     });
 
     // init the search filter
@@ -222,6 +224,9 @@
     var _url_base = url_base.replace('__REV__', ${h.js(c.changeset.raw_id)});
     fileBrowserListeners(_node_list_url, _url_base);
 
+    var initial_state = {url:window.location.href, title:document.title, url_base:_url_base,
+         node_list_url:_node_list_url, rev:${h.js(c.changeset.raw_id)}, f_path:${h.js(h.safe_unicode(c.file.path))}};
+
     // change branch filter
     $("#branch_selector").select2({
         dropdownAutoWidth: true,