From 2e4018f3d416cc696a883e719d9b9ee7bcd886bc Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Mon, 23 May 2011 10:04:09 +0200 Subject: [PATCH] SONAR-2450 Display last comment on each review in the Reviews page Displays only an excerpt of the comment if the comment is too long. --- .../webapp/WEB-INF/app/models/review_comment.rb | 9 +++++++++ .../WEB-INF/app/views/reviews/index.html.erb | 8 +++----- sonar-server/src/main/webapp/stylesheets/style.css | 14 +++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb index b8059c19b07..20113db2c35 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb @@ -32,6 +32,15 @@ class ReviewComment < ActiveRecord::Base def plain_text Api::Utils.convert_string_to_unix_newlines(review_text) end + + def excerpt + text = plain_text + if text.size > 101 + plain_text[0..100] + " ..." + else + text + end + end private diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb index b2f6762527e..5b4b818387c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb @@ -145,11 +145,9 @@ function launchSearch(columnName, link) { <%= link_to h(review.title), :controller => "reviews", :action => "view", :id => review.id -%> -
-

- <%= image_tag("reviews/comment.png") -%>  <%= comment.user.name -%> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>) -

- <%= comment.html_text -%> +
+ <%= image_tag("reviews/comment.png") -%>  <%= comment.user.name -%> : + <%= comment.excerpt -%>
<%= review.project.name -%> diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index dbf66f8982d..40cc82ebe77 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -887,13 +887,6 @@ div.discussionComment { margin: 0; padding: 5px 10px; } -table#reviews-list div.discussionComment { - background-color: transparent; - border-top: none; - border-left: 1px solid #DDDDDD; - margin: 5px 0 0 10px; - padding: 0px 10px; -} div.discussionComment h4 { font-size: 90%; margin-bottom: 2px; @@ -904,6 +897,13 @@ div.discussionComment h4 img { div.discussionComment li { list-style: square inside; } +div.comment-excerpt { + background-color: transparent; + margin: 5px; + padding: 0px 10px; + color: #777777; + font-size: 90%; +} -- 2.39.5