diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 41018c8..f1b96ba 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -1,6 +1,6 @@ <%= call_hook :view_account_login_top %>
-<%= form_tag(signin_path) do %> +<%= form_tag(signin_path, onsubmit: 'return keepAnchorOnSignIn(this);') do %> <%= back_url_hidden_field_tag %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 32261e0..610cb60 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -651,6 +651,17 @@ $(document).ready(function(){ toggleDisabledInit(); }); +function keepAnchorOnSignIn(form){ + var hash = decodeURIComponent(self.document.location.hash); + if (hash) { + if (hash.indexOf("#") === -1) { + hash = "#" + hash; + } + form.action = form.action + hash; + } + return true; +} + $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad); $(document).ready(addFormObserversForDoubleSubmit);