]> source.dussan.org Git - sonarqube.git/commitdiff
[SONAR-1973] Remodeling of UI based on Simon's feedback
authorFabrice Bellingard <bellingard@gmail.com>
Tue, 19 Apr 2011 16:36:31 +0000 (18:36 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Wed, 20 Apr 2011 06:57:57 +0000 (08:57 +0200)
14 files changed:
sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
sonar-server/src/main/webapp/WEB-INF/app/models/rule_failure.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form_assign.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form_comment.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/create_comment_result.js.rjs
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/create_result.js.rjs
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/update_comment_result.js.rjs [deleted file]
sonar-server/src/main/webapp/images/reviews/comment.png [new file with mode: 0644]
sonar-server/src/main/webapp/stylesheets/style.css

index 5cbf398eae52e2218a1075080911028f9c1b617f..12bfbb61ff6b61f75a5ec7b343c01c09bfd592a8 100644 (file)
@@ -171,7 +171,7 @@ class ResourceController < ApplicationController
     @expandable=(@lines!=nil)\r
     @filtered=!@expanded\r
 \r
-    conditions='snapshot_id=?'\r
+    conditions='switched_off is not true AND snapshot_id=?'\r
     values=[@snapshot.id]\r
     unless params[:rule].blank?\r
       severity=Sonar::RulePriority.id(params[:rule])\r
index 39207c27671a65fb95fa530d1fc855017b30ce74..d5c3b7c56a0a2fb0571cb5cce4155310720f8233 100644 (file)
@@ -38,30 +38,23 @@ class ReviewsController < ApplicationController
     render :partial => "list", :locals => { :reviews => reviews }\r
   end\r
 \r
+  def display_violation\r
+    violation = find_last_rule_failure_with_permanent_id params[:rule_failure_permanent_id]\r
+    render :partial => "resource/violation", :locals => { :violation => violation }\r
+  end\r
+\r
   def form\r
     rule_failure = find_last_rule_failure_with_permanent_id params[:rule_failure_permanent_id]\r
     @review = Review.new\r
     @review.rule_failure_permanent_id = rule_failure.permanent_id\r
-    @review.user = current_user\r
-    @review.assignee = current_user\r
-    @user_options = add_all_users []\r
-    @review.title = rule_failure.message\r
     @review_comment = ReviewComment.new\r
     @review_comment.review_text = ""\r
-    render :partial => "form"\r
-  end\r
-\r
-  def form_comment\r
-    @review_comment = ReviewComment.new\r
-    @review_comment.user = current_user\r
-    @review_comment.review_id = params[:review_id]\r
-    @review_comment.review_text = ""\r
-    @rule_failure_permanent_id = params[:rule_failure_permanent_id]\r
-    if params[:update_comment]\r
-      @update_comment = "true"\r
-      @review_comment.review_text = params[:review_text]\r
+    if params[:switch_off]\r
+      @review.review_type = "f-positive"\r
+    else\r
+      @review.review_type = Review.default_type\r
     end\r
-    render :partial => "form_comment"\r
+    render :partial => "form"\r
   end\r
 \r
   def create\r
@@ -73,22 +66,45 @@ class ReviewsController < ApplicationController
 \r
     @review = Review.new(params[:review])\r
     @review.user = current_user\r
+    if params[:assign_to_me]\r
+      @review.assignee = current_user\r
+    end\r
+    @review.title = rule_failure.message\r
     @review.status = Review.default_status\r
-    @review.review_type = Review.default_type\r
     @review.severity = Sonar::RulePriority.to_s rule_failure.failure_level\r
     @review.resource = RuleFailure.find( @review.rule_failure_permanent_id, :include => ['snapshot'] ).snapshot.project\r
     @review_comment = ReviewComment.new(params[:review_comment])\r
     @review_comment.user = current_user\r
     @review.review_comments << @review_comment\r
     if @review.valid?\r
+      if @review.review_type == "f-positive" \r
+        if rule_failure.get_open_review\r
+          current_open_review = rule_failure.get_open_review\r
+          current_open_review.status = "closed"\r
+          current_open_review.save\r
+        end\r
+        rule_failure.switched_off = true\r
+        rule_failure.save\r
+      end\r
       @review.save\r
-      @reviews = find_reviews_for_rule_failure @review.rule_failure_permanent_id\r
-    else\r
-      @user_options = add_all_users []\r
+      @violation = rule_failure\r
     end\r
     render "create_result"\r
   end\r
 \r
+  def form_comment\r
+    @review_comment = ReviewComment.new\r
+    @review_comment.user = current_user\r
+    @review_comment.review_id = params[:review_id]\r
+    @review_comment.review_text = ""\r
+    @rule_failure_permanent_id = params[:rule_failure_permanent_id]\r
+    if params[:update_comment]\r
+      @update_comment = true\r
+      @review_comment.review_text = params[:review_text]\r
+    end\r
+    render :partial => "form_comment"\r
+  end\r
+\r
   def create_comment\r
     rule_failure = find_last_rule_failure_with_permanent_id params[:rule_failure_permanent_id]\r
     unless has_rights_to_create? rule_failure\r
@@ -106,7 +122,7 @@ class ReviewsController < ApplicationController
       review.updated_at = @review_comment.created_at\r
       review.save\r
       # -- End of TODO code --\r
-      @reviews = find_reviews_for_rule_failure @rule_failure_permanent_id\r
+      @violation = rule_failure\r
     end\r
     render "create_comment_result"\r
   end\r
@@ -124,9 +140,44 @@ class ReviewsController < ApplicationController
     @rule_failure_permanent_id = params[:rule_failure_permanent_id]\r
     if @review_comment.valid?\r
       @review_comment.save\r
-      @reviews = find_reviews_for_rule_failure @rule_failure_permanent_id\r
+      review.updated_at = @review_comment.updated_at\r
+      review.save\r
+      @violation = find_last_rule_failure_with_permanent_id review.rule_failure_permanent_id\r
     end\r
-    render "update_comment_result"\r
+    render "create_comment_result"\r
+  end\r
+  \r
+  def form_assign\r
+    @user_options = add_all_users []\r
+    @review_id = params[:review_id]\r
+    @rule_failure_permanent_id = params[:rule_failure_permanent_id]\r
+    render :partial => "form_assign"\r
+  end\r
+  \r
+  def assign\r
+    review = Review.find params[:review_id]\r
+    unless current_user\r
+      render :text => "<b>Cannot edit the review</b> : access denied."\r
+      return\r
+    end\r
+    \r
+    review.assignee = User.find params[:assignee_id]\r
+    review.save\r
+    violation = find_last_rule_failure_with_permanent_id review.rule_failure_permanent_id\r
+    render :partial => "resource/violation", :locals => { :violation => violation }\r
+  end\r
+  \r
+  def close_review\r
+    review = Review.find params[:review_id]\r
+    unless current_user\r
+      render :text => "<b>Cannot edit the review</b> : access denied."\r
+      return\r
+    end\r
+    \r
+    review.status = "closed"\r
+    review.save\r
+    violation = find_last_rule_failure_with_permanent_id review.rule_failure_permanent_id\r
+    render :partial => "resource/violation", :locals => { :violation => violation }\r
   end\r
 \r
   ## -------------- PRIVATE -------------- ##\r
@@ -136,7 +187,6 @@ class ReviewsController < ApplicationController
     @user_names = [["Any", ""]]\r
     default_user = [""]\r
     if current_user\r
-      @user_names << ["Me", current_user.id]\r
       default_user = [current_user.id]\r
     end\r
     add_all_users @user_names\r
@@ -148,7 +198,11 @@ class ReviewsController < ApplicationController
   \r
   def add_all_users ( user_options )\r
     User.find( :all ).each do |user|\r
-      user_options << [user.name, user.id.to_s]\r
+      userName = user.name\r
+      if current_user.id == user.id\r
+        userName = "Me (" + user.name + ")"\r
+      end\r
+      user_options << [userName, user.id.to_s]\r
     end\r
     return user_options\r
   end\r
index 9c6cb791852dabf925296ba0abe78b18df1869f6..df4179f309dff6611dfd2ef01981b487d158cdb0 100644 (file)
@@ -23,7 +23,6 @@ class Review < ActiveRecord::Base
   belongs_to :resource, :class_name => "Project", :foreign_key => "resource_id"\r
   has_many :review_comments, :order => "created_at", :dependent => :destroy\r
   validates_presence_of :user, :message => "can't be empty"\r
-  validates_presence_of :assignee, :message => "can't be empty"\r
   validates_presence_of :title, :message => "can't be empty"\r
   validates_presence_of :review_type, :message => "can't be empty"\r
   validates_presence_of :status, :message => "can't be empty"\r
index 27e1ec254017e6ce8e890a85c329a1bd39866be1..45253ed2da99bb500d475413f6735e0b424404bb 100644 (file)
@@ -24,6 +24,15 @@ class RuleFailure < ActiveRecord::Base
   belongs_to :snapshot\r
   has_many :reviews, :primary_key => "permanent_id", :foreign_key => "rule_failure_permanent_id", :order => "created_at"\r
 \r
+  def get_open_review\r
+    reviews.each do |review|\r
+      if review.status == "open"\r
+        return review\r
+      end\r
+    end\r
+    return nil\r
+  end\r
+  \r
   def to_hash_json\r
     json = {}\r
     json['message'] = message\r
index 3a599ba11e6d62443eba52eacd3c201b9a43845c..de7ec93b15219cbae0d9b65451b74e01d242cc07 100644 (file)
-<% \r
-  displayReviewFailureDiv = 'block'\r
-  if violation.reviews.blank?\r
-    displayReviewFailureDiv = 'none'\r
-  end\r
-%>\r
-<div class="violation">\r
-  <table style="width:100%">\r
-    <tr>\r
-      <td style="width: 30px; vertical-align: top; text-align: center;">\r
-       <% if current_user && violation.reviews.blank? %>\r
-          <%= link_to_remote image_tag("reviews/+review.png"),  \r
-                       :url => { :controller => "reviews", :action => "form", :rule_failure_permanent_id => violation.permanent_id },\r
-                       :update => "reviewFailure" + violation.permanent_id.to_s,\r
-                       :html => { :id => "createReviewLink" + violation.permanent_id.to_s, :title => "Add a review" },\r
-                       :complete => "$('reviewFailure" + violation.permanent_id.to_s + "').style.display='';$('reviewText').focus();" -%>\r
-       <% end %>\r
-       <% unless violation.reviews.blank? %>\r
-         <%= image_tag("reviews/review.png") -%>\r
-       <% end %>\r
-      </td>\r
-      \r
-      <td>\r
-               <img src="<%= ApplicationController.root_context -%>/images/priority/<%=violation.failure_level-%>.png"/>\r
-               \r
-               <span class="rulename"><a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a></span>\r
-                ยป\r
-               <%= h(violation.message) -%>\r
-               <%\r
-                  if violation.created_at\r
-                   duration=Date.today - violation.created_at.to_date\r
-               %>\r
-                 <span class="violation_date"><%= duration==0 ? 'today' : "#{duration} days ago" -%></span>\r
-               <% end %>\r
-               \r
-      </td>\r
-    </tr>\r
-    \r
-    <tr>\r
-      <td colspan="2">\r
-               <div id="reviewFailure<%= violation.permanent_id -%>" style="margin-left: 13px; padding: 10px 5px 5px 10px; border-left: 2px solid #EFEFEF; display:<%= displayReviewFailureDiv -%>">\r
-                 <%= render :partial => "reviews/list", :locals => { :reviews => violation.reviews } %>\r
-               </div>\r
-      </td>\r
-    </tr>\r
-    \r
-  </table>\r
-</div>
\ No newline at end of file
+<div id="vId<%= violation.permanent_id -%>">
+<%
+  current_open_review = violation.get_open_review
+%>
+
+<div class="violation">
+
+  <div class="vtitle">
+    <% if current_open_review %>
+    <div style="float: right"><span class="violation_date">#<%= current_open_review.id.to_s -%></span></div>
+    <% end %>
+    
+    <%= image_tag("priority/" + violation.failure_level.to_s + ".png") -%>
+    &nbsp;
+    <%= image_tag("sep12.png") -%>
+    &nbsp;&nbsp;
+    <span class="rulename">
+      <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a>
+    </span>
+    &nbsp;&nbsp;
+    <%= image_tag("sep12.png") -%>
+    &nbsp;&nbsp;
+    <%
+         if violation.created_at
+               duration=Date.today - violation.created_at.to_date
+    %>
+         <span class="violation_date"><%= duration==0 ? 'today' : "#{duration} days ago" -%></span>
+    <% end %>
+    <% if current_open_review && current_open_review.assignee %>
+      <%= image_tag("sep12.png") -%>
+      &nbsp;&nbsp;
+      <%= h(current_open_review.assignee.name) -%>
+    <% end %>
+    
+    
+    <% if current_user %>
+    <span class="actions" id="vActions<%= violation.permanent_id.to_s -%>">
+      &nbsp;&nbsp;
+      <%= image_tag("sep12.png") -%>
+      &nbsp;&nbsp;
+      <% if current_open_review %>
+        <%= link_to_remote "Close review",  
+                       :url => { :controller => "reviews", :action => "close_review", :review_id => current_open_review.id, :rule_failure_permanent_id => violation.permanent_id },
+                       :update => "vId" + violation.permanent_id.to_s -%>
+        &nbsp;&nbsp;
+        <% if current_open_review.assignee == nil %>
+          <%= link_to_remote "Assign",  
+                       :url => { :controller => "reviews", :action => "form_assign", :review_id => current_open_review.id, :rule_failure_permanent_id => violation.permanent_id },
+                       :update => "vActions" + violation.permanent_id.to_s -%>
+          &nbsp;&nbsp;
+        <% end %>
+      <% end %>
+      <% unless current_open_review %>
+        <%= link_to_remote "Review",  
+                       :url => { :controller => "reviews", :action => "form", :rule_failure_permanent_id => violation.permanent_id },
+                       :update => "reviewForm" + violation.permanent_id.to_s,
+                       :complete => "$('reviewForm" + violation.permanent_id.to_s + "').style.display='';$('reviewText').focus();" -%>
+        &nbsp;&nbsp;
+      <% end %>
+      <%= link_to_remote "Switch-off",  
+                       :url => { :controller => "reviews", :action => "form", :rule_failure_permanent_id => violation.permanent_id, :switch_off => true },
+                       :update => "reviewForm" + violation.permanent_id.to_s,
+                       :complete => "$('reviewForm" + violation.permanent_id.to_s + "').style.display='';$('reviewText').focus();" -%>
+      &nbsp;&nbsp;
+    </span>
+    <% end %>
+    
+  </div>
+
+  <div class="comment">
+    <%= h(violation.message) -%>
+  </div>
+
+  <% 
+    if current_open_review
+      last_comment = current_open_review.review_comments.last
+      current_open_review.review_comments.each do |review_comment|
+  %>
+  <div class="comment">
+    <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= review_comment.user.name -%></b> on <%= l review_comment.created_at -%>
+    <% if review_comment == last_comment && current_user && current_user.id == review_comment.user.id %>
+      <span class="actions">
+        &nbsp;&nbsp;
+        <%= image_tag("sep12.png") -%>
+        &nbsp;&nbsp;
+        <%= link_to_remote "Edit", 
+               :url => { :controller => "reviews", :action => "form_comment", :review_id => current_open_review.id, :rule_failure_permanent_id => violation.permanent_id, :review_text => last_comment.review_text, :update_comment => "true" },
+               :update => "lastComment" + violation.permanent_id.to_s,
+               :complete => "$('commentText" + violation.permanent_id.to_s + "').focus()" -%>
+      </span>
+    <% end %>
+    </h4> 
+      <% if review_comment == last_comment %>
+        <div id="lastComment<%= violation.id -%>">
+          <%= h(review_comment.review_text) -%>
+        </div>
+      <% else %>
+        <%= h(review_comment.review_text) -%>
+      <% end %>
+  </div>
+  <% 
+      end
+    end
+  %>
+
+  <div class="comment" id="reviewForm<%= violation.permanent_id.to_s -%>" style="display: none">
+  </div>
+
+</div>
+
+<% if current_user && current_open_review %>
+<div style="padding: 5px" id="commentAction<%= violation.permanent_id -%>">
+  <%= link_to_remote "Add comment", 
+               :url => { :controller => "reviews", :action => "form_comment", :review_id => current_open_review.id, :rule_failure_permanent_id => violation.permanent_id },
+               :update => "reviewForm" + violation.permanent_id.to_s, 
+               :complete => "$('commentAction" + violation.permanent_id.to_s + "').style.display='none';$('reviewForm" + violation.permanent_id.to_s + "').style.display='';$('commentText" + violation.permanent_id.to_s + "').focus()" -%>
+</div>
+<% end %>
+
+<div>
\ No newline at end of file
index 71d1e4634a343e8151919b03d7cd0d24a5813b2e..b8e8092b36e0b936b5ab5856a419d6418b3f4b21 100644 (file)
     <% end %>
     <td class="line <%= status -%>">
       <pre><%= line.source -%></pre>
-      <% if @display_violations && line.violations? %>
-        <div class="violations">
+    </td>
+  </tr>
+    <% if @display_violations && line.violations? %>
+    <tr>
+      <% if @scm_available %>
+      <td class="scm"></td>
+      <% end %>
+      <td class="lid section"></td>
+      <td class="violations">
         <% line.violations.each do |violation| %>
           <%= render :partial => 'violation', :locals => {:violation => violation} -%>
         <% end %>
-        </div>
-      <% end %>
-    </td>
-  </tr>
+      </td>
+    </tr>
+    <% end %> 
   <% end %>
 </table>
 
index 16e214941c6c3796b02e9ac260df60f0d0d58243..ceb5210de513098491e8c91e56e1d99d2f617904 100644 (file)
@@ -1,18 +1,30 @@
 <% form_for :review, @review do |f| %>\r
-      <%= f.hidden_field :rule_failure_permanent_id %>\r
-      <b>New review</b>: \r
-      <%= f.text_field :title, :size => 100 %>\r
-      <br/>\r
-      Assignee: \r
-      <%= select_tag "review[assignee_id]", options_for_select(@user_options, @review.assignee.id.to_s)  %>\r
-      <br/>\r
-      <%= text_area :review_comment, :review_text, :id => "reviewText", :rows => 8, :style => "width:100%" %>\r
-      <br/>\r
+      <%= f.hidden_field :rule_failure_permanent_id -%>\r
+      <%= f.hidden_field :review_type -%>\r
       \r
-      <%= submit_to_remote "create_btn", "Create review", :url => { :action => 'create' } %>\r
-      <input type="button" name="cancel_btn" value="Cancel" \r
-             onclick="new Ajax.Updater({success:'reviewFailure<%= @review.rule_failure_permanent_id.to_s -%>'}, '<%= ApplicationController.root_context -%>/reviews/list?rule_failure_permanent_id=<%= @review.rule_failure_permanent_id.to_s -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form), }); $('reviewFailure<%= @review.rule_failure_permanent_id.to_s -%>').style.display='none';">\r
-\r
-      <%= f.error_messages :header_message => "Can't create the review", :message => "", :header_tag => :h3 %>\r
+      <% if @review.review_type == "f-positive" %>\r
+          <b>Reason for flagging this violation as a false-positive:</b>\r
+      <% end %>\r
+      <%= text_area :review_comment, :review_text, \r
+           :id => "reviewText", :rows => 8, \r
+           :style => "width:100%", :onKeyUp => "if (this.value=='') $('submit_btn').disabled='true'; else $('submit_btn').disabled='';" -%>\r
+      <br/>\r
       \r
+      <div>\r
+        <%\r
+          if @review.review_type == "comments"\r
+            button_text = "Post review"\r
+          else\r
+            button_text = "Switch-off violation"\r
+          end\r
+        %>\r
+        <%= submit_to_remote "submit_btn", button_text, :url => { :action => 'create' }, :html => { :id => "submit_btn", :disabled => "true" } -%>\r
+        &nbsp;&nbsp;\r
+        <a onclick="$('reviewForm<%= @review.rule_failure_permanent_id.to_s -%>').style.display='none';" href="#">Cancel</a>\r
+        <% if @review.review_type == "comments" %>\r
+          &nbsp;&nbsp;\r
+          <%= check_box_tag "assign_to_me", "me", true -%> Assign to me\r
+        <% end %>\r
+      </div>\r
+      </div class="clear"></div>      \r
 <% end %>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form_assign.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_form_assign.html.erb
new file mode 100644 (file)
index 0000000..575c2f8
--- /dev/null
@@ -0,0 +1,12 @@
+<% form_tag do %>
+  <%= hidden_field_tag :review_id, @review_id -%>
+  <%= select_tag "assignee_id", options_for_select(@user_options, current_user.id.to_s)  %>
+  &nbsp;&nbsp;
+  <%= submit_to_remote "submit_btn", "Assign", 
+         :url => { :action => 'assign' }, 
+         :update => "vId" + @rule_failure_permanent_id.to_s -%>
+  &nbsp;&nbsp;
+  <%= link_to_remote 'Cancel', 
+         :url => { :action => 'display_violation', :rule_failure_permanent_id => @rule_failure_permanent_id },
+         :update => "vId" + @rule_failure_permanent_id.to_s %> 
+<% end %>
\ No newline at end of file
index 8d5b25accd3a5bdd1e7082d19f372fc14eb92313..79ad5010402b21ef7b8e650783009d3b863d1e72 100644 (file)
@@ -1,22 +1,28 @@
 <% form_for :review_comment, @review_comment do |f| %>\r
       <%= f.hidden_field :review_id %>\r
       <%= f.text_area :review_text, :rows => 8, \r
-            :id => "commentText" + @review_comment.review_id.to_s,\r
-            :style => "width:100%" %>\r
+            :id => "commentText" + @rule_failure_permanent_id.to_s,\r
+            :style => "width:100%",\r
+            :onKeyUp => "if (this.value=='') $('submit_btn').disabled='true'; else $('submit_btn').disabled='';" %>\r
       <br/>\r
+      \r
       <% if @update_comment %>\r
-        <%= submit_to_remote 'create_btn', 'Update', \r
+        <%= submit_to_remote 'submit_btn', 'Update comment', \r
                      :url => { :action => 'update_comment', \r
-                               :rule_failure_permanent_id => @rule_failure_permanent_id } %>      \r
+                               :rule_failure_permanent_id => @rule_failure_permanent_id },\r
+                     :html => { :id => "submit_btn" } %>\r
+        &nbsp;&nbsp;\r
+        <%= link_to_remote 'Cancel', \r
+                     :url => { :action => 'display_violation', \r
+                               :rule_failure_permanent_id => @rule_failure_permanent_id },\r
+                     :update => "vId" + @rule_failure_permanent_id.to_s %>     \r
       <% else %>\r
-        <%= submit_to_remote 'create_btn', 'Post', \r
+        <%= submit_to_remote 'submit_btn', 'Post comment', \r
                      :url => { :action => 'create_comment', \r
-                               :rule_failure_permanent_id => @rule_failure_permanent_id } %>\r
+                               :rule_failure_permanent_id => @rule_failure_permanent_id },\r
+                     :html => { :id => "submit_btn", :disabled => true } %>\r
+        &nbsp;&nbsp;\r
+        <a onclick="$('reviewForm<%= @rule_failure_permanent_id.to_s -%>').style.display='none'; $('commentAction<%= @rule_failure_permanent_id.to_s -%>').style.display='';" href="#">Cancel</a>\r
       <% end %>\r
-      <%= submit_to_remote 'cancel_btn', 'Cancel', \r
-                     :url => { :action => 'list', :rule_failure_permanent_id => @rule_failure_permanent_id.to_s },\r
-                     :update => { :success => "reviewFailure" + @rule_failure_permanent_id.to_s } %>\r
-      \r
-      <%= f.error_messages :header_message => "Can't save the comment", :message => "", :header_tag => :h3%>\r
       \r
 <% end %>
\ No newline at end of file
index 6eae877ae47f2026a495da783048ddc15f0eab50..f177aae9cb22cda799daa8d14292b3f0f9657d28 100644 (file)
@@ -1,5 +1,5 @@
-if @reviews\r
-  page.replace_html "reviewFailure" + @rule_failure_permanent_id.to_s, :partial => "list", :locals => { :reviews => @reviews }\r
+if @violation\r
+  page.replace "vId" + @violation.permanent_id.to_s, :partial => "resource/violation", :locals => { :violation => @violation }\r
 else\r
-  page.replace_html "createComment" + @review_comment.review_id.to_s, :partial => "form_comment"\r
+  page.replace_html "reviewForm" + @rule_failure_permanent_id.to_s, :partial => "form_comment"\r
 end
\ No newline at end of file
index 5f802780b34f7cb36f75f4871c4c40f179a9eba7..720e00f11b3072141e7007c0e84fc392b8a6c6e6 100644 (file)
@@ -1,6 +1,5 @@
-if @reviews\r
-  page.replace_html "createReviewLink" + @review.rule_failure_permanent_id.to_s, image_tag("reviews/review.png")\r
-  page.replace_html "reviewFailure" + @review.rule_failure_permanent_id.to_s, :partial => "list", :locals => { :reviews => @reviews }\r
-else\r
-  page.replace_html "reviewFailure" + @review.rule_failure_permanent_id.to_s, :partial => "form"\r
+if @violation\r
+  page.replace "vId" + @violation.permanent_id.to_s, :partial => "resource/violation", :locals => { :violation => @violation }\r
+else \r
+  page.replace_html "reviewForm" + @review.rule_failure_permanent_id.to_s, :partial => "form"\r
 end
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/update_comment_result.js.rjs b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/update_comment_result.js.rjs
deleted file mode 100644 (file)
index f127394..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-if @reviews\r
-  page.replace_html "reviewFailure" + @rule_failure_permanent_id.to_s, :partial => "list", :locals => { :reviews => @reviews }\r
-else\r
-  @update_comment = "true"\r
-  page.replace_html "lastComment" + @review_comment.review_id.to_s, :partial => "form_comment"\r
-end
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/images/reviews/comment.png b/sonar-server/src/main/webapp/images/reviews/comment.png
new file mode 100644 (file)
index 0000000..d2b4d64
Binary files /dev/null and b/sonar-server/src/main/webapp/images/reviews/comment.png differ
index be59f091b7627d8381cfb93895d4da149942e075..2e7a321d550d12626f273d2cd4c65013e8d98567 100644 (file)
@@ -665,23 +665,47 @@ ul.operations li img {
 .sources2 span.author, .sources2 span.author a {\r
   font-size: 85%;\r
 }\r
-.sources2 div.violations {\r
-  background-color: #FFFFFF; /* #EFEFEF */\r
-  margin: 2px;\r
+.sources2 div.violation {\r
+  background-color:#FFF;\r
+  margin:0;\r
   border: 1px solid #DDD;\r
 }\r
-.sources2 div.violation {\r
-  background-color: #FFFFFF; /* #EFEFEF */\r
-  margin: 0;\r
-  padding: 3px 5px;\r
+.sources2 div.comment{\r
+  background-color:#FBFBFB;\r
+  margin:0;\r
+  padding:5px 10px;\r
+  border-top: 1px solid #DDD;\r
+  line-height: 1.5em;\r
+}\r
+.sources2 div.comment h4{\r
+  font-size: 90%;\r
+  margin-bottom: 2px;\r
+}\r
+.sources2 div.violation .actions{\r
+  visibility: hidden;\r
+}\r
+.sources2 div.violation:hover .actions{\r
+  visibility: visible;\r
+}\r
+.sources2 div.vtitle{\r
+  background-color:#E4ECF3;\r
+  margin:0;\r
+  padding:0 10px;\r
+  line-height: 2.2em;\r
+  text-shadow: 1px 1px 0 #FFF;\r
+  color:#777\r
+}\r
+.sources2 div.vtitle a.action {\r
+  color: #777;\r
 }\r
 span.rulename, span.rulename a {\r
-  color: #4183C4;\r
-  text-decoration: none;\r
+  color:#4183C4;\r
+  text-decoration:none;\r
+  font-weight: bold;\r
 }\r
 span.violation_date {\r
-  color: #AAA;\r
-  font-size: 85%;\r
+  color:#777;\r
+  font-size:90%;\r
 }\r
 span.rulename a:hover {\r
   text-decoration: underline;\r
@@ -725,6 +749,13 @@ span.rulename a:hover {
   border-bottom: 1px solid #DDD;\r
   height: 40px;\r
 }\r
+.sources2 td.violations{\r
+  background-color: #FFF;\r
+  padding: 10px;\r
+  border-bottom: 1px solid #DDD;\r
+  border-right: 1px solid #DDD;\r
+  border-top: 1px solid #DDD;\r
+}\r
 #source_title {\r
   padding: 10px 0;\r
 }\r