aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb18
1 files changed, 18 insertions, 0 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 55432e2504a..d2b9a3c332d 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
@@ -140,6 +140,24 @@ module ApplicationHelper
Metric.by_key(key)
end
+ # URL to static resource.
+ #
+ # === Optional parameters
+ #
+ # * <tt>:plugin</tt> - key of plugin, from where this resource should be loaded.
+ #
+ # === Examples
+ #
+ # url_for_static(:path => 'images/sonarqube-24x100.png')
+ # url_for_static(:plugin => 'myplugin', :path => 'image.png')
+ def url_for_static(options={})
+ if options[:plugin]
+ "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}"
+ else
+ "#{ApplicationController.root_context}/#{options[:path]}"
+ end
+ end
+
#
#
# Numeric value of variation