]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2327 Provide a new "Reviews" service
authorFabrice Bellingard <bellingard@gmail.com>
Wed, 27 Apr 2011 09:06:47 +0000 (11:06 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 27 Apr 2011 09:06:47 +0000 (11:06 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb
sonar-server/src/main/webapp/stylesheets/style.css

index 74311837a18472dda117b7791f78050af70c5562..4df243f2de1bd316e65f037f0fa980c7451eb382 100644 (file)
@@ -262,6 +262,7 @@ class ReviewsController < ApplicationController
     @severities = filter_any(params[:severities]) || ['']
     @statuses = filter_any(params[:statuses]) || [Review::STATUS_OPEN]
     @projects = filter_any(params[:projects]) || ['']
+    @id = params[:id] || ""
   end
 
   def options_for_users
@@ -303,10 +304,23 @@ class ReviewsController < ApplicationController
       conditions << "assignee_id in (:assignees)"
       values[:assignees]=@assignees.map{|s| s.to_i}
     end
+    unless @id  == ""
+      if is_number? @id
+        conditions << "id = :id"
+        values[:id] = @id
+      else
+        conditions << "id = :id"
+        values[:id] = -1
+      end
+    end
 
     @reviews = Review.find( :all, :order => "created_at DESC", :conditions => [ conditions.join(" AND "), values] ).uniq
   end
 
+  def is_number?(s)
+    true if Float(s) rescue false
+  end
+  
   def has_rights_to_modify?(violation)
     current_user && has_role?(:user, violation.snapshot)
   end
index bc87b3a9ad12410fccd88ebd5b3cb03378f5cc7c..aa13895b6edb54908ab97f3e17a134e5eb25fa68 100644 (file)
@@ -51,7 +51,7 @@
                  Created by:
           </td>
           <td  class="val">
-                 <%= h(review.user.name) -%> on <%= l(review.created_at, :format => :long) -%>
+                 <%= h(review.user.name) -%>, on <%= l(review.created_at, :format => :long) -%>
           </td>
         </tr>
        <% if review.rule %>
@@ -77,7 +77,7 @@
   </table>
 
   <% if review.rule_failure && review.resource_line && review.rule_failure.snapshot %>
-    <div class="marginbottom10">
+    <div class="marginbottom10 marginleft10">
       <%= snapshot_source_to_html(review.rule_failure.snapshot, {:line_range => (review.resource_line-5)..(review.resource_line+5), :highlighted_lines => [review.resource_line]}) -%>
     </div>
   <% end %>
index 6d4daf0d084fb8f940f00ed497c2322668819af8..7926a40111920c1e30a21caca8313baf6ab0fe64 100644 (file)
           <span class="note">Assigned to</span><br/>
           <%= select_tag "assignees", options_for_select(@user_names, @assignees), :multiple => true, :size => 6 %>
         </td>
-        <td>
+        <td width="1%" nowrap>
+          <span class="note">Id</span><br/>
+          <%= text_field_tag "id", @id, :size => 10 -%>
+          <br/>
+          <br/>
           <br/>
+          <br/>
+          <div style="width:100%; text-align: right">
           <%= submit_tag "Search", :id => 'submit_search' %>
+          </div>
+        </td>
+        <td>
         </td>
       </tr>
       </tbody>
index 00e5cb59976a0a8ebd711da114e6844b3efe46bb..d1d5b596431dddf3be58e49dced6bf7dbda81ce4 100644 (file)
@@ -814,7 +814,12 @@ span.rulename a:hover {
 
 
 
-
+div#review .actions{
+  visibility: hidden;
+}
+div#review:hover .actions{
+  visibility: visible;
+}
 div.reportTitle {
        background-color: #E4ECF3;
        color: #4B9FD5;