From: Julien Lancelot Date: Thu, 28 Aug 2014 09:13:46 +0000 (+0200) Subject: SONAR-5540 "http" should not be in the url X-Git-Tag: 4.5-RC1~61 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3b44df364cdb3a02aff59ee49faf83c694945288;p=sonarqube.git SONAR-5540 "http" should not be in the url --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 775a114120a..72977009397 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -311,37 +311,46 @@ module ApplicationHelper def link_to_resource(resource, name=nil, options={}) period_index=options[:period] period_index=nil if period_index && period_index<=0 - if resource.display_dashboard? if options[:dashboard] - query = request.query_parameters.merge({:id => resource.id}) + root = "#{ApplicationController.root_context}/dashboard/index?" + path = '' + query = request.query_parameters + query[:id] = resource.id query[:period] = period_index if period_index query[:tab] = options[:tab] if options[:tab] query[:rule] = options[:rule] if options[:rule] - url = URI::HTTP.build(:path => "#{ApplicationController.root_context}/dashboard/index", :query => query.to_query) - "#{h(name || resource.name)}" + query.each do |key, value| + path += '&' unless path.empty? + path += "#{u key}=#{u value}" + end + "#{name || resource.name}" else # stay on the same page (for example components) - query = request.query_parameters.merge({:id => resource.id}) + root = "#{ApplicationController.root_context}/#{u params[:controller]}/#{u params[:action]}?" + path = '' + query = request.query_parameters + query[:id] = resource.id query[:period] = period_index if period_index query[:tab] = options[:tab] if options[:tab] query[:rule] = options[:rule] if options[:rule] - url = URI::HTTP.build(:path => "#{ApplicationController.root_context}/#{u params[:controller]}/#{u params[:action]}", :query => query.to_query) - "#{h(name || resource.name)}" + query.each do |key, value| + path += '&' unless path.empty? + path += "#{u key}=#{u value}" + end + "#{name || resource.name}" end else - query = {:id => resource.id} - query[:period] = period_index if period_index - query[:tab] = options[:tab] if options[:tab] - query[:rule] = options[:rule] if options[:rule] - query[:metric] = options[:metric] if options[:metric] - url = URI::HTTP.build(:path => "#{ApplicationController.root_context}/dashboard/index", :query => query.to_query) + url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.key}" + url += "&period=#{u period_index}" if period_index + url += "&tab=#{u options[:tab]}" if options[:tab] + url += "&rule=#{u options[:rule]}" if options[:rule] + url += "&metric=#{u options[:metric]}" if options[:metric] url += '#L' + options[:line].to_s if options[:line] "#{h(name || resource.name)}" + "href='#{url}'>#{name || resource.name}" end - end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb index 3d7974dc9ea..7b8d6f680e8 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb @@ -80,9 +80,15 @@ <%= qualifier_icon(resource) -%>   <%= - query = request.query_parameters.merge({:id => resource.key}) - url = URI::HTTP.build(:path => "#{ApplicationController.root_context}/#{u resource_link[:controller]}/#{u resource_link[:action]}", :query => query.to_query) - "#{h(resource.name)}" + root = "#{ApplicationController.root_context}/#{u resource_link[:controller]}/#{u resource_link[:action]}?" + path = '' + query = request.query_parameters + query[:id] = resource.key + query.each do |key, value| + path += '&' unless path.empty? + path += "#{u key}=#{u value}" + end + "#{h(resource.name)}" -%> <%