]> source.dussan.org Git - sonarqube.git/commitdiff
Restore url_for_static method because it's used by Governance plugin
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 10 Nov 2016 07:48:45 +0000 (08:48 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 10 Nov 2016 07:48:45 +0000 (08:48 +0100)
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/application_helper.rb

index 55432e2504af629de249fc87dd475e83ec5709e4..d2b9a3c332de5ab631fb4a149a1bd2d17d6c4a3f 100644 (file)
@@ -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