aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-05-23 10:04:09 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-05-23 10:05:18 +0200
commit2e4018f3d416cc696a883e719d9b9ee7bcd886bc (patch)
treec3e872aaf4f3916b923c7492646a9826c23ff77b /sonar-server
parent9b11f3ec188d87912f48b2aaf0bef14298b7d8da (diff)
downloadsonarqube-2e4018f3d416cc696a883e719d9b9ee7bcd886bc.tar.gz
sonarqube-2e4018f3d416cc696a883e719d9b9ee7bcd886bc.zip
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.
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb9
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb8
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css14
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) {
<td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= review.severity -%>.png" title="<%= review.severity.capitalize -%>"/></td>
<td>
<%= link_to h(review.title), :controller => "reviews", :action => "view", :id => review.id -%>
- <div class="discussionComment">
- <h4>
- <%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>)
- </h4>
- <%= comment.html_text -%>
+ <div class="comment-excerpt">
+ <%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= comment.user.name -%> :</b>
+ <%= comment.excerpt -%>
</div>
</td>
<td><%= 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%;
+}