[Rt-commit] rt branch, 4.0/preserve-anchor-across-login, created. rt-4.0.4-79-g9a57c79

Thomas Sibley trs at bestpractical.com
Tue Nov 29 15:11:39 EST 2011


The branch, 4.0/preserve-anchor-across-login has been created
        at  9a57c7900067930955d3731acabc982a45d355af (commit)

- Log -----------------------------------------------------------------
commit 9a57c7900067930955d3731acabc982a45d355af
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Nov 29 14:39:44 2011 -0500

    Preserve page anchors across login tangents
    
    Browsers carry over the anchor upon receiving a redirect response.  Take
    advantage of this by appending any anchor the login page has to the
    form's action.  When the login form is submitted successfully, a
    redirect is issued and the browser carries over the anchor as intended
    for the original page.
    
    Confusion might arise if the login page ever shares an anchor name with
    deeper pages.
    
    Unfortunately there's no way to get at the anchor from the server side
    at the time of tangent, otherwise we could simply stuff it into the
    NextPage entry and be done with it.

diff --git a/share/html/Elements/Login b/share/html/Elements/Login
index bc11bd4..9a4050a 100755
--- a/share/html/Elements/Login
+++ b/share/html/Elements/Login
@@ -76,6 +76,15 @@
 
 <input type="hidden" name="next" value="<% $next %>" />
 
+<script type="text/javascript">
+jQuery(function(){
+    if (window.location.hash) {
+        var form = jQuery("form[name=login]");
+        form.attr('action', form.attr('action') + '#' + window.location.hash.replace(/^#/, ''));
+    }
+});
+</script>
+
 <div class="button-row">
     <span class="input"><input type="submit" class="button" value="<&|/l&>Login</&>" /></span>
 </div>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list