From 95f0e322189997ffc5692dd3b6103cb58177e6db Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Sun, 17 Apr 2011 22:01:51 +0200 Subject: [PATCH] SONAR-2249 Display Violation message with new lines in web --- .../WEB-INF/app/helpers/resource_helper.rb | 25 +++++++++++++++++++ .../app/views/resource/_violation.html.erb | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb 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('
') : '' + 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 @@ <%= h(violation.rule.name) -%> » -<%= h(violation.message) -%> +<%= violation_html_message(violation) -%> <% if violation.created_at duration=Date.today - violation.created_at.to_date -- 2.39.5