]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2450 Display last comment on each review in the Reviews page
authorFabrice Bellingard <bellingard@gmail.com>
Mon, 23 May 2011 08:04:09 +0000 (10:04 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Mon, 23 May 2011 08:05:18 +0000 (10:05 +0200)
Displays only an excerpt of the comment if the comment is too long.

sonar-server/src/main/webapp/WEB-INF/app/models/review_comment.rb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb
sonar-server/src/main/webapp/stylesheets/style.css

index b8059c19b07017bfe0529f1d6260c58089058db1..20113db2c3510ad3aee87745168c20b3ad167f1e 100644 (file)
@@ -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
 
index b2f6762527e8f6b7d5afeff238d2a4678cf2014d..5b4b818387cdae4af2cf333af062e2bf0ba946bb 100644 (file)
@@ -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 -%>
index dbf66f8982d0d5eed211a679dd596a03694c79c1..40cc82ebe7759bbadf2e80683e9c649bb721afc7 100644 (file)
@@ -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%;
+}