]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2249 Display Violation message with new lines in web
authorsimonbrandhof <simon.brandhof@gmail.com>
Sun, 17 Apr 2011 20:01:51 +0000 (22:01 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Sun, 17 Apr 2011 20:01:51 +0000 (22:01 +0200)
sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb

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 (file)
index 0000000..fc4131f
--- /dev/null
@@ -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
index 341ef262011488ff63f312983ef66d310bb8f88d..4ede0c4139826a88de2d49914eab593da5463780 100644 (file)
@@ -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