From bf5a7b8d94ce9e7d69eed4f2459ce7ac7fd7bfaf Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 10 Feb 2011 18:33:19 +0100 Subject: [PATCH] Ruby API: add widget.html_id to get the id of the widget HTML element + add model and characteristic parameters to url_for_drilldown() --- .../main/webapp/WEB-INF/app/helpers/application_helper.rb | 7 +++++-- sonar-server/src/main/webapp/WEB-INF/app/models/widget.rb | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 3a06e83d213..96e5742d1e9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -215,9 +215,12 @@ module ApplicationHelper end if options[:resource] - url_for(:controller => 'drilldown', :action => 'measures', :id => options[:resource], :metric => metric_key, :highlight => options[:highlight], :viewer_plugin_key => options[:viewer_plugin_key]) + url_for(:controller => 'drilldown', :action => 'measures', :id => options[:resource], :metric => metric_key, + :highlight => options[:highlight], :viewer_plugin_key => options[:viewer_plugin_key], :model => options[:model], :characteristic => options[:characteristic]) elsif @project - url_for(:controller => 'drilldown', :action => 'measures', :id => @project.id, :metric => metric_key, :highlight => options[:highlight], :viewer_plugin_key => options[:viewer_plugin_key]) + url_for(:controller => 'drilldown', :action => 'measures', :id => @project.id, :metric => metric_key, + :highlight => options[:highlight], :viewer_plugin_key => options[:viewer_plugin_key], + :model => options[:model], :characteristic => options[:characteristic]) else '' end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/widget.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/widget.rb index d10262a99ed..7a10a4791ec 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/widget.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/widget.rb @@ -34,6 +34,14 @@ class Widget < ActiveRecord::Base nil end + def key + widget_key + end + + def html_id + "block_#{id}" + end + def property_value(key, default_value=nil) prop=property(key) (prop ? prop.value : nil) || default_value -- 2.39.5