aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-04-17 22:01:51 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-04-17 22:01:51 +0200
commit95f0e322189997ffc5692dd3b6103cb58177e6db (patch)
treef776d8cbeb4dbe68d03450dec5bc2b7a88341ce0 /sonar-server
parentf33f28795a4ce4f414f3c22ee48016d282bc90c1 (diff)
downloadsonarqube-95f0e322189997ffc5692dd3b6103cb58177e6db.tar.gz
sonarqube-95f0e322189997ffc5692dd3b6103cb58177e6db.zip
SONAR-2249 Display Violation message with new lines in web
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb25
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb2
2 files changed, 26 insertions, 1 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb
new file mode 100644
index 00000000000..fc4131f6e29
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb
@@ -0,0 +1,25 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+module ResourceHelper
+
+ def violation_html_message(violation)
+ violation.message ? h(violation.message).split(/\r?\n|\r/).join('<br/>') : ''
+ end
+end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
index 341ef262011..4ede0c41398 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
@@ -3,7 +3,7 @@
<span class="rulename"><a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a></span>
ยป
-<%= h(violation.message) -%>
+<%= violation_html_message(violation) -%>
<%
if violation.created_at
duration=Date.today - violation.created_at.to_date