From a1e7eae74d461b6810de1b043ef02c95062c657e Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 3 Mar 2014 09:30:27 +0100 Subject: [PATCH] Process login link in order to add the anchor --- .../WEB-INF/app/views/layouts/_layout.html.erb | 2 +- .../src/main/webapp/javascripts/application.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 77ceacd7835..fcd90e58bfa 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -35,7 +35,7 @@ <% if logged_in? %> <%= render 'layouts/menu_user' -%> <% else %> -
  • <%= message('layout.login') -%>
  • +
  • <%= message('layout.login') -%>
  • <% end %> <% if is_admin? %>
  • <%= message('layout.settings') -%>
  • diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js index 318b8216d73..17ce4882b10 100644 --- a/sonar-server/src/main/webapp/javascripts/application.js +++ b/sonar-server/src/main/webapp/javascripts/application.js @@ -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; + }); }); + -- 2.39.5