Changeset - 7135fd2db7c9
[Not reviewed]
stable
0 1 0
Mads Kiilerich - 7 years ago 2019-04-30 19:03:02
mads@kiilerich.com
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.
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/files/files.html
Show inline comments
 
@@ -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,
0 comments (0 inline, 0 general)