diff options
3 files changed, 41 insertions, 0 deletions
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 @@ +<html>
+<body>
+Text from static resource
+</body>
+</html>
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="" /> +<title>SONAR-1709-static-resources</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">SONAR-1709-static-resources</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/static/reference-plugin/file.html</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>//body</td> + <td>Text from static resource</td> +</tr> + +</tbody></table> +</body> +</html> |