# HG changeset patch # User Mads Kiilerich # Date 2019-04-30 19:03:02 # Node ID 7135fd2db7c92713896f05e4e58ce0e96c7d3486 # Parent b1e2ae0dd6e1c284d31dec1a568051f586b2b7a8 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. diff --git a/kallithea/templates/files/files.html b/kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html +++ b/kallithea/templates/files/files.html @@ -215,6 +215,8 @@ $(document).ready(function(){ 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 @@ $(document).ready(function(){ 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,