]> source.dussan.org Git - sonarqube.git/commitdiff
Process login link in order to add the anchor
authorStas Vilchik <vilchiks@gmail.com>
Mon, 3 Mar 2014 08:30:27 +0000 (09:30 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 3 Mar 2014 08:33:46 +0000 (09:33 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/javascripts/application.js

index e477dcc3edd18f05afbaee1c19e5fa91497336d0..48e9b19095efe1c44ba5af31640d628328f3af41 100644 (file)
@@ -38,7 +38,7 @@
         <% if logged_in? %>
           <%= render 'layouts/menu_user' -%>
         <% else %>
-          <li><a href="<%= ApplicationController.root_context -%>/sessions/new?return_to=<%= u (request.request_uri) -%>"><%= message('layout.login') -%></a></li>
+          <li><a id="login-link" href="<%= ApplicationController.root_context -%>/sessions/new?return_to=<%= u (request.request_uri) -%>"><%= message('layout.login') -%></a></li>
         <% end %>
         <% if is_admin? %>
           <li><a href="<%= ApplicationController.root_context -%>/settings/index" class="<%= 'selected' if selected_section==Navigation::SECTION_CONFIGURATION -%>"><%= message('layout.settings') -%></a></li>
index 65fa62fce16b6c23013716f7b550bd66d9cc0926..2fa6cca9e282ce6a7570c4aa8309324e776be1a2 100644 (file)
@@ -533,9 +533,24 @@ function openPopup(url, popupId) {
 
 
 jQuery(function() {
+
+  // Initialize top search
   jQuery('#searchInput').topSearch({
     minLength: 2,
     results: '#searchResourcesResults',
     spinner: '#searchingResources'
   });
+
+
+  // Process login link in order to add the anchor
+  jQuery('#login-link').on('click', function(e) {
+    e.preventDefault();
+    var href = jQuery(this).prop('href'),
+        hash = window.location.hash;
+    if (hash.length > 0) {
+      href += decodeURIComponent(hash);
+    }
+    window.location = href;
+  });
 });
+