]> source.dussan.org Git - redmine.git/commitdiff
Keep anchor (i.e. to a specific issue note) throughout login (#21110).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 30 Oct 2015 11:00:32 +0000 (11:00 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 30 Oct 2015 11:00:32 +0000 (11:00 +0000)
Patch by Jens Krämer.

git-svn-id: http://svn.redmine.org/redmine/trunk@14767 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/account/login.html.erb
public/javascripts/application.js

index 41018c871dbc66e842820e015f82569dbd9871d4..f1b96bae3455c4cbb6d79d7f183ceda68ab457b4 100644 (file)
@@ -1,6 +1,6 @@
 <%= call_hook :view_account_login_top %>
 <div id="login-form">
-<%= form_tag(signin_path) do %>
+<%= form_tag(signin_path, onsubmit: 'return keepAnchorOnSignIn(this);') do %>
 <%= back_url_hidden_field_tag %>
 <table>
 <tr>
index 32261e07cdd151987699b9c1677df1b8c083fb99..610cb60e75768e2c06d055aa283a660fce85cfaf 100644 (file)
@@ -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);