keep_anchor_on_signin.diff

Jens Krämer, 2015-10-30 06:21

Download (1.06 KB)

View differences:

app/views/account/login.html.erb
1 1
<%= call_hook :view_account_login_top %>
2 2
<div id="login-form">
3
<%= form_tag(signin_path) do %>
3
<%= form_tag(signin_path, onsubmit: 'return keepAnchorOnSignIn(this);') do %>
4 4
<%= back_url_hidden_field_tag %>
5 5
<table>
6 6
<tr>
public/javascripts/application.js
651 651
  toggleDisabledInit();
652 652
});
653 653

  
654
function keepAnchorOnSignIn(form){
655
  var hash = decodeURIComponent(self.document.location.hash);
656
  if (hash) {
657
    if (hash.indexOf("#") === -1) {
658
      hash = "#" + hash;
659
    }
660
    form.action = form.action + hash;
661
  }
662
  return true;
663
}
664

  
654 665
$(document).ready(setupAjaxIndicator);
655 666
$(document).ready(hideOnLoad);
656 667
$(document).ready(addFormObserversForDoubleSubmit);