]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1709: in ruby-helper parameter :plugin should be optional
authorGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 12:09:38 +0000 (12:09 +0000)
committerGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 12:09:38 +0000 (12:09 +0000)
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb

index bb1934c9e3f645c1dd3b9025085e753a951da7a3..d728ba39ec76e6a607d1ce7efe0e0ebdf1887e49 100644 (file)
@@ -144,13 +144,22 @@ module ApplicationHelper
     Metric.by_key(key)
   end
 
-  # URL to static resource from plugin.
+  # 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/sonar.png')
   #   url_for_static(:plugin => 'myplugin', :path => 'image.png')
   def url_for_static(options={})
-    "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}"
+    if options[:plugin]
+      "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}"
+    else
+      "#{ApplicationController.root_context}/#{options[:path]}"
+    end
   end
 
   def url_for_gwt(page)