]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1973, SONAR-2327 Fix issues based on Evgeny's feedback
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 28 Apr 2011 13:14:19 +0000 (15:14 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 28 Apr 2011 13:15:49 +0000 (15:15 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.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/_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 69848be04e1beb6237041b6120a1b8fe437f2be4..c037867e9c31a390556037a5ff6a8cddf120ed28 100644 (file)
@@ -33,6 +33,19 @@ class ReviewsController < ApplicationController
     search_reviews()
   end
   
+  # Used for the permalink, e.g. http://localhost:9000/reviews/view/1
+  def view
+    @review=Review.find(params[:id], :include => ['resource', 'project'])
+    render 'reviews/_review', :locals => {:review => @review}
+  end
+
+
+  #
+  #
+  # ACTIONS FROM REVIEW SERVICE PAGE
+  #
+  #
+
   def show
     @review=Review.find(params[:id], :include => ['resource', 'project'])
     render :partial => 'reviews/show'
@@ -262,7 +275,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] || ""
+    @id = params[:review_id] || ""
   end
 
   def options_for_users
index aa187b7b5be41493bc824113006b9f45949c0ce1..bd4e5c8e920fbc7c0632fcda7ff6509a69d5c261 100644 (file)
@@ -2,7 +2,7 @@
 <div class="violation">
   <div class="vtitle">
     <% if violation.review %>
-      <div style="float: right"><span class="violation_date">#<%= violation.review.id -%></span></div>
+      <div style="float: right"><span class="review_permalink"><%= link_to "#"+violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%></span></div>
     <% end %>
     
     <%= image_tag("priority/" + violation.failure_level.to_s + '.png') -%>
   %>
   <div class="discussionComment">
     <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= review_comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(review_comment.created_at) -%>)
-    <% if is_last_comment && current_user && current_user.id == review_comment.user_id %>
-      <span class="actions">
+    <!-- && current_user.id == review_comment.user_id -->
+    <% if is_last_comment && current_user %>
+      <span class="actions" id="commentActions<%= violation.id -%>">
         &nbsp;&nbsp;
         <%= image_tag("sep12.png") -%>
         &nbsp;&nbsp;
-        <%= link_to_remote "Edit", 
-               :url => { :controller => "reviews", :action => "violation_comment_form", :comment_id => review_comment.id, :id => violation.id },
-               :update => "lastComment" + violation.id.to_s,
-               :complete => "$('reviewForm#{violation.id}').hide();$('vActions#{violation.id}').hide();$('commentAction#{violation.id}').hide();$('commentText#{violation.id}').focus();" -%>
-        <% unless comment_index == 0 %>
+        <%= link_to_remote "Add comment",
+               :url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
+               :update => "reviewForm" + violation.id.to_s,
+               :complete => "$('vActions#{violation.id}').hide();$('commentActions" + violation.id.to_s + "').hide();$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus()" -%>
+        <% 
+          if current_user.id == review_comment.user_id 
+        %>
+          &nbsp;
+          <%= link_to_remote "Edit", 
+            :url => { :controller => "reviews", :action => "violation_comment_form", :comment_id => review_comment.id, :id => violation.id },
+            :update => "lastComment" + violation.id.to_s,
+            :complete => "$('reviewForm#{violation.id}').hide();$('vActions#{violation.id}').hide();$('commentAction#{violation.id}').hide();$('commentText#{violation.id}').focus();" -%>
+          <% unless comment_index == 0 %>
+          &nbsp;
           <%= link_to_remote "Delete",
                :url => { :controller => "reviews", :action => "violation_delete_comment", :comment_id => review_comment.id, :id => violation.id },
                :update => "vId" + violation.id.to_s,
             :confirm => "Do you want to delete this comment ?" -%>
-        <% end %>
+          <% end %>
+        <%
+          end 
+        %>
       </span>
     <% end %>
     </h4> 
   <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
 </div>
 
-
-
-<% if current_user && violation.review %>
-<div style="padding: 5px" id="commentAction<%= violation.id -%>">
-  <%= link_to_remote "Add comment",
-               :url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
-               :update => "reviewForm" + violation.id.to_s,
-               :complete => "$('vActions#{violation.id}').hide();$('commentAction" + violation.id.to_s + "').hide();$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus()" -%>
-</div>
-<% end %>
-
 </div>
\ No newline at end of file
index b8e8092b36e0b936b5ab5856a419d6418b3f4b21..81daaa4ca632e0efbd938c91fc2c135185fbb987 100644 (file)
       <% end %>
       <td class="lid section"></td>
       <td class="violations">
-        <% line.violations.each do |violation| %>
+        <% line.violations.each_with_index do |violation, index| %>
           <%= render :partial => 'violation', :locals => {:violation => violation} -%>
+          <% if index < line.violations.size-1 %>
+            &nbsp;
+          <% end %>
         <% end %>
       </td>
     </tr>
index 2cb37687ff4bb45179cf421965191ed3878db82d..ef40b132d6c69a12fa7deaea26e6e68cd491a163 100644 (file)
           <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) -%>)
-           <% if is_last_comment && current_user && current_user.id == comment.user_id %>
+           <% if is_last_comment && current_user %>
            <span class="actions" id="editActions">
              &nbsp;&nbsp;
              <%= image_tag("sep12.png") -%>
              &nbsp;&nbsp;
-             <%= link_to_remote "Edit", 
+             <%= link_to_remote "Add comment",
+                    :url => { :controller => "reviews", :action => "comment_form", :id => review.id },
+                    :update => "reviewForm",
+                    :complete => "$('rActions').hide();$('editActions').hide();$('reviewForm').show();$('commentText').focus();" -%>
+             <%
+               if current_user.id == comment.user_id
+             %>
+               &nbsp;
+               <%= link_to_remote "Edit", 
                  :url => { :controller => "reviews", :action => "comment_form", :comment_id => comment.id, :id => review.id },
                     :update => "lastComment",
-                    :complete => "$('rActions').hide();$('commentAction').hide();$('editActions').hide();$('commentText').focus();" -%>
-                <% unless comment_index == 0 %>
+                    :complete => "$('rActions').hide();$('editActions').hide();$('commentText').focus();" -%>
+                  <% unless comment_index == 0 %>
+               &nbsp;
                <%= link_to_remote "Delete",
                     :url => { :controller => "reviews", :action => "delete_comment", :comment_id => comment.id, :id => review.id },
                 :update => "review",
                  :confirm => "Do you want to delete this comment ?" -%>
-             <% end %>
+               <% end %>
+             <% 
+               end 
+             %>
            </span>
            <% end %>
          </h4>
         <% end %>
   </div>
   
-  <% if current_user && review.status != "CLOSED" %>
   <div class="discussionComment" id="reviewForm" style="display:none"></div>
-  <div style="padding: 5px" id="commentAction">
-    <%= link_to_remote "Add comment",
-               :url => { :controller => "reviews", :action => "comment_form", :id => review.id },
-               :update => "reviewForm",
-               :complete => "$('rActions').hide();$('commentAction').hide();$('reviewForm').show();$('commentText').focus();$('editActions').hide();" -%>
-  </div>
-  <% end %>
   
 </div>
\ No newline at end of file
index ca4b8de476313ca87fed9480f2906f1f0ce4d511..d77813855a7ba2ccfc09590f89372f456ec17b83 100644 (file)
             <option value="<%= Review::STATUS_CLOSED -%>" class="status_closed" <%= 'selected' if @statuses.include?(Review::STATUS_CLOSED) -%>>Closed</option>
           </select>
         </td>
+        <td width="1%" nowrap>
+          <span class="note">Severity</span><br/>
+          <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons">
+            <option <%= 'selected' if @severities.include?('') -%> value="">Any</option>
+            <option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>>Blocker</option>
+            <option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>>Critical</option>
+            <option value="<%= Severity::MAJOR -%>" class="sev_MAJOR" <%= 'selected' if @severities.include?(Severity::MAJOR) -%>>Major</option>
+            <option value="<%= Severity::MINOR -%>" class="sev_MINOR" <%= 'selected' if @severities.include?(Severity::MINOR) -%>>Minor</option>
+            <option value="<%= Severity::INFO -%>" class="sev_INFO" <%= 'selected' if @severities.include?(Severity::INFO) -%>>Info</option>
+           </select>
+        </td>
 
         <td width="1%" nowrap>
           <span class="note">Project</span><br/>
             <% end %>
           </select>
         </td>
-        <td width="1%" nowrap>
-          <span class="note">Severity</span><br/>
-          <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons">
-            <option <%= 'selected' if @severities.include?('') -%> value="">Any</option>
-            <option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>>Blocker</option>
-            <option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>>Critical</option>
-            <option value="<%= Severity::MAJOR -%>" class="sev_MAJOR" <%= 'selected' if @severities.include?(Severity::MAJOR) -%>>Major</option>
-            <option value="<%= Severity::MINOR -%>" class="sev_MINOR" <%= 'selected' if @severities.include?(Severity::MINOR) -%>>Minor</option>
-            <option value="<%= Severity::INFO -%>" class="sev_INFO" <%= 'selected' if @severities.include?(Severity::INFO) -%>>Info</option>
-           </select>
-        </td>
 
         <td width="1%" nowrap>
           <span class="note">Created by</span><br/>
@@ -69,7 +69,7 @@
         </td>
         <td width="1%" nowrap>
           <span class="note">Id</span><br/>
-          <%= text_field_tag "id", @id, :size => 10 -%>
+          <%= text_field_tag "review_id", @id, :size => 10 -%>
           <br/>
           <br/>
           <br/>
     <table id="reviews-list" class="data width100">
       <thead>
       <tr>
-        <th width="1%" nowrap>St.</th>
+        <th width="1%" nowrap></th>
+        <th width="1%" nowrap>Id</th>
+        <th width="1%" nowrap></th>
         <th>Title</th>
         <th width="1%">Project</th>
-        <th width="1%" nowrap>Se.</th>
         <th>Assignee</th>
         <th>Age</th>
-        <th width="1%" nowrap>Id</th>
 
       </tr>
       </thead>
          @reviews.each do |review|
       %>
         <tr class="<%= cycle('even', 'odd') -%>">
-          <td><img src="<%= ApplicationController.root_context -%>/images/status/<%= review.status -%>.png"/></td>
+          <td><img src="<%= ApplicationController.root_context -%>/images/status/<%= review.status -%>.png" title="<%= review.status.capitalize -%>"/></td>
+          <td>
+            <%= link_to_remote( "#"+h(review.id), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%>
+          </td>
+          <td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= review.severity -%>.png" title="<%= review.severity.capitalize -%>"/></td>
           <td>
             <%= link_to_remote(h(review.title), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%>
           </td>
           <td><%= review.project.name -%>
             <br/><span class="note"><%= review.resource.long_name -%></span></td>
-          <td><img src="<%= ApplicationController.root_context -%>/images/priority/<%= review.severity -%>.png"/></td>
           <td><%= review.assignee ? h(review.assignee.name) : '-' -%></td>
           <td><%= distance_of_time_in_words_to_now(review.created_at) -%></td>
-          <td style="font-weight:bold">
-            <%= link_to_remote( "#"+h(review.id), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%>
-          </td>
         </tr>
       <%
          end
 </div>
 
 <div id="review-loading" style="display: none"><%= image_tag 'loading.gif' -%></div>
-<div id="review" style="display: none"></div>
\ No newline at end of file
+<div id="review" style="display: none"></div>
+<script>
+  $('review_id').focus();
+</script>
\ No newline at end of file
index e209d06550d131d07ff19841efe6d7c0ff82585a..b00b47bc7a857d65868c1c5b7dc96455af5d31a0 100644 (file)
@@ -705,6 +705,10 @@ span.violation_date {
   color:#777;
   font-size:90%;
 }
+span.review_permalink a {
+  color:#777;
+  font-size:90%;
+}
 span.rulename a:hover {
   text-decoration: underline;
 }