From: Godin Date: Mon, 27 Sep 2010 10:09:23 +0000 (+0000) Subject: SONAR-1709: X-Git-Tag: 2.6~939 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3727f84e84453381a51ae40a6e804520e6d0d31a;p=sonarqube.git SONAR-1709: * Add ruby-helper for URL construction for static resources from plugins * Add integration test --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index f8997db4be1..bb1934c9e3f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -144,6 +144,15 @@ module ApplicationHelper Metric.by_key(key) end + # URL to static resource from plugin. + # + # === Examples + # + # url_for_static(:plugin => 'myplugin', :path => 'image.png') + def url_for_static(options={}) + "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}" + end + def url_for_gwt(page) "#{ApplicationController.root_context}/plugins/home/#{page}" end diff --git a/tests/integration/reference-plugin/src/main/resources/static/file.html b/tests/integration/reference-plugin/src/main/resources/static/file.html new file mode 100644 index 00000000000..5ae990c1af3 --- /dev/null +++ b/tests/integration/reference-plugin/src/main/resources/static/file.html @@ -0,0 +1,5 @@ + + +Text from static resource + + diff --git a/tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html b/tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html new file mode 100644 index 00000000000..b172c2a6728 --- /dev/null +++ b/tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html @@ -0,0 +1,27 @@ + + + + + + +SONAR-1709-static-resources + + + + + + + + + + + + + + + + + +
SONAR-1709-static-resources
open/static/reference-plugin/file.html
assertText//bodyText from static resource
+ +