From: Fabrice Bellingard Date: Thu, 28 Apr 2011 13:14:19 +0000 (+0200) Subject: SONAR-1973, SONAR-2327 Fix issues based on Evgeny's feedback X-Git-Tag: 2.8~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c8ab08d28bbe90b03db0db7a79d756d523e1ade9;p=sonarqube.git SONAR-1973, SONAR-2327 Fix issues based on Evgeny's feedback --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index 69848be04e1..c037867e9c3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -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 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb index aa187b7b5be..bd4e5c8e920 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb @@ -2,7 +2,7 @@
<% if violation.review %> -
#<%= violation.review.id -%>
+
<%= link_to "#"+violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%>
<% end %> <%= image_tag("priority/" + violation.failure_level.to_s + '.png') -%> @@ -76,21 +76,34 @@ %>

<%= image_tag("reviews/comment.png") -%>  <%= review_comment.user.name -%> (<%= distance_of_time_in_words_to_now(review_comment.created_at) -%>) - <% if is_last_comment && current_user && current_user.id == review_comment.user_id %> - + + <% if is_last_comment && current_user %> +    <%= image_tag("sep12.png") -%>    - <%= 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 + %> +   + <%= 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 "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 + %> <% end %>

@@ -110,15 +123,4 @@
- - -<% if current_user && violation.review %> -
- <%= 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()" -%> -
-<% end %> -
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb index b8e8092b36e..81daaa4ca63 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb @@ -105,8 +105,11 @@ <% end %> - <% 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 %> +   + <% end %> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb index 2cb37687ff4..ef40b132d6c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb @@ -95,21 +95,33 @@

<%= image_tag("reviews/comment.png") -%>  <%= comment.user.name -%> (<%= 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 %>    <%= image_tag("sep12.png") -%>    - <%= 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 + %> +   + <%= 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 %> +   <%= 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 + %> <% end %>

@@ -124,14 +136,6 @@ <% end %>
- <% if current_user && review.status != "CLOSED" %> -
- <%= 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();" -%> -
- <% end %>
\ No newline at end of file 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 ca4b8de4763..d77813855a7 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 @@ -35,6 +35,17 @@ + + Severity
+ + Project
@@ -47,17 +58,6 @@ <% end %> - - Severity
- - Created by
@@ -69,7 +69,7 @@ Id
- <%= text_field_tag "id", @id, :size => 10 -%> + <%= text_field_tag "review_id", @id, :size => 10 -%>


@@ -92,13 +92,13 @@ - + + + - - @@ -112,18 +112,18 @@ @reviews.each do |review| %> - + + + - - <% end @@ -140,4 +140,7 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index e209d06550d..b00b47bc7a8 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -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; }
St.Id Title ProjectSe. Assignee AgeId
+ <%= link_to_remote( "#"+h(review.id), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%> + <%= link_to_remote(h(review.title), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%> <%= review.project.name -%>
<%= review.resource.long_name -%>
<%= review.assignee ? h(review.assignee.name) : '-' -%> <%= distance_of_time_in_words_to_now(review.created_at) -%> - <%= link_to_remote( "#"+h(review.id), :update => 'review', :url => {:action => 'show', :id => review.id}, :loading => 'onReviewLoading()', :complete => "onReviewLoaded()") -%> -