From 7231cb649072d9396e2f89207503c265f15e06ab Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 10 Nov 2016 08:48:45 +0100 Subject: [PATCH] Restore url_for_static method because it's used by Governance plugin --- .../WEB-INF/app/helpers/application_helper.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 + # + # * :plugin - 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 -- 2.39.5