aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-11-10 08:48:45 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-11-10 08:48:45 +0100
commit7231cb649072d9396e2f89207503c265f15e06ab (patch)
treef5c826d1779ee58ea6a633011adf92d82130acf7
parentbcd0f171c81a84d9c21ca00816194f35a3279fac (diff)
downloadsonarqube-7231cb649072d9396e2f89207503c265f15e06ab.tar.gz
sonarqube-7231cb649072d9396e2f89207503c265f15e06ab.zip
Restore url_for_static method because it's used by Governance plugin
-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