aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-08-28 13:40:21 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-08-28 14:06:44 +0200
commite56ff9d45ca09c94978d5416fbdd63b0c2bf9332 (patch)
tree0ed41e309874f0e86d4d38c801a80ba49c0ae116 /server/sonar-web
parentd6a0ac843d379512fff46f283289f3f343d3db52 (diff)
downloadsonarqube-e56ff9d45ca09c94978d5416fbdd63b0c2bf9332.tar.gz
sonarqube-e56ff9d45ca09c94978d5416fbdd63b0c2bf9332.zip
Remove rule and period options from link_to_resource as it's not managed
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb34
1 files changed, 9 insertions, 25 deletions
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 41c825e07aa..9830f89dd3b 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
@@ -309,41 +309,25 @@ 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]
root = "#{ApplicationController.root_context}/dashboard/index?"
- path = ''
- query = request.query_parameters
- query[:id] = resource.id
- query[:period] = period_index if period_index
- query[:rule] = options[:rule] if options[:rule]
- query.each do |key, value|
- path += '&' unless path.empty?
- path += "#{u key}=#{u value}"
- end
- "<a class='#{options[:class]}' title='#{options[:title]}' href='#{root + path}'>#{name || resource.name}</a>"
else
# stay on the same page (for example components)
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[:rule] = options[:rule] if options[:rule]
- query.each do |key, value|
- path += '&' unless path.empty?
- path += "#{u key}=#{u value}"
- end
- "<a class='#{options[:class]}' title='#{options[:title]}' href='#{root + path}'>#{name || resource.name}</a>"
end
+ path = ''
+ query = request.query_parameters
+ query[:id] = resource.id
+ query[:metric] = options[:metric] if options[:metric]
+ query.each do |key, value|
+ path += '&' unless path.empty?
+ path += "#{u key}=#{u value}"
+ end
+ "<a class='#{options[:class]}' title='#{options[:title]}' href='#{root + path}'>#{name || resource.name}</a>"
else
url = "#{ApplicationController.root_context}/dashboard/index?id=#{u resource.key}"
- url += "&period=#{u period_index}" if period_index
- 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]
"<a class='#{options[:class]}' title='#{options[:title]}' " +
"onclick='window.open(this.href,\"resource-#{resource.key.parameterize}\",\"\");return false;' " +
"href='#{url}'>#{name || resource.name}</a>"