From f753e1a452ff1f42478399e152e0debcc167dc20 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Thu, 22 Dec 2011 18:36:52 +0100 Subject: [PATCH] SONAR-2662 Insert feedback from Freddy - Smaller font-size for dates in the action plan widget - "Back" does not work on Chrome - A user shouldn't have to be authenticated to list reviews - In the "Plan" form, button "Plan" replaced by "Link" - Remove background color for the table in the action plan widget - Do not show closed action plans by default on the admin page so that the greatest "due for" date is displayed first --- .../widgets/actionPlans/action_plans.html.erb | 24 +++--- .../resources/org/sonar/l10n/core.properties | 4 +- .../controllers/action_plans_controller.rb | 3 +- .../controllers/project_reviews_controller.rb | 3 +- .../app/views/action_plans/index.html.erb | 76 +++++++++++++++++-- .../app/views/project_reviews/index.html.erb | 2 +- .../src/main/webapp/stylesheets/style.css | 6 +- 7 files changed, 93 insertions(+), 25 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb index e2041c65f75..68fd5a36010 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/actionPlans/action_plans.html.erb @@ -26,7 +26,7 @@ <% if open_action_plans.size ==0 %> <%= message('widget.action_plans.no_action_plan') -%> <% else %> - +
@@ -36,13 +36,13 @@ <% open_action_plans.each do |plan| %> - - - + + + <% if plan.progress[:total]==0 %> - + <% else %> - <% end %> @@ -73,7 +73,7 @@ }
<%= message('widget.action_plans.show_closed_action_plans') -%>
-
<%= h(plan.name) -%><%= plan.dead_line ? plan.dead_line.strftime("%d %b %Y") : ' ' -%>
<%= h(plan.name) -%><%= plan.dead_line ? plan.dead_line.strftime("%d %b %Y") : ' ' -%><%= message('action_plans.no_reviews_linked_to_action_plan') -%><%= message('action_plans.no_reviews_linked_to_action_plan') -%> + <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%>
+ @@ -83,13 +83,13 @@ <% closed_action_plans.each do |plan| %> - - - + + + <% if plan.progress[:total]==0 %> - + <% else %> - <% end %> diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index b79850b6d3e..8e53affb4a6 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -428,7 +428,7 @@ reviews.resolution.FALSE-POSITIVE=False-positive reviews.resolution.FIXED=Fixed reviews.link_to_action_plan=Plan reviews.action_plan_label=Action plan -reviews.action_plan_submit=Plan +reviews.action_plan_submit=Link reviews.unlink_action_plan_submit=Unlink reviews.no_action_plan=None reviews.planned_for_x=Planned for {0} @@ -467,6 +467,8 @@ action_plans.resolved_reviews_x_percent=Resolved reviews - {0}% ({1} reviews) action_plans.open_reviews_x_percent=Open reviews - {0}% ({1} reviews) action_plans.reopen=Reopen action_plans.close=Close +action_plans.show_closed_action_plans=Show closed action plans +action_plans.hide_closed_action_plans=Hide closed action plans #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb index 1a9cfc1ec48..6cd36500703 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/action_plans_controller.rb @@ -92,7 +92,8 @@ class ActionPlansController < ApplicationController end def load_action_plans - @action_plans = ActionPlan.find(:all, :conditions => ['project_id=?', @resource.id], :include => 'reviews', :order => 'dead_line ASC') + @open_action_plans = ActionPlan.find(:all, :conditions => ['status=? AND project_id=?', ActionPlan::STATUS_OPEN, @resource.id], :include => 'reviews', :order => 'dead_line ASC') + @closed_action_plans = ActionPlan.find(:all, :conditions => ['status=? AND project_id=?', ActionPlan::STATUS_CLOSED, @resource.id], :include => 'reviews', :order => 'dead_line ASC') end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb index 644c2fa0bfb..50ba007ca1a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb @@ -28,10 +28,11 @@ class ProjectReviewsController < ApplicationController :redirect_to => {:action => :error_not_post} helper SourceHelper, UsersHelper + # lists all the reviews of a project, filtered using the same parameters as for the review WS API def index @project=Project.by_key(params[:projects]) not_found("Project not found") unless @project - access_denied unless is_admin?(@project) + access_denied unless has_role?(:user, @project) found_reviews = Review.search(params) @reviews = select_authorized(:user, found_reviews, :project) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb index 14d1bc9d357..ed09e344db8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/action_plans/index.html.erb @@ -4,7 +4,7 @@

<%= message('action_plans.page_title') -%>

- +
@@ -17,11 +17,11 @@ - <% if @action_plans.empty? %> + <% if @open_action_plans.empty? %> <% end %> <% - @action_plans.each do |plan| + @open_action_plans.each do |plan| %> @@ -39,16 +39,14 @@ @@ -56,7 +54,69 @@ <% end %>
<%= message('action_plans.col.status') -%>
<%= message('action_plans.no_action_plan') -%>
<%= h(plan.description) -%> <%= h(plan.user.name) -%> - <% if plan.open? %> - <%= link_to message('edit'), :action => 'edit', :id => @resource.id, :plan_id => plan.id, :class => 'action' -%> - <% end %> + <%= link_to message('edit'), :action => 'edit', :id => @resource.id, :plan_id => plan.id, :class => 'action' -%> <% close_confirmation_message = {} if plan.open? && plan.has_open_reviews? close_confirmation_message = {:confirm => message('action_plans.confirm_close')} end %> - <%= link_to plan.open? ? message('action_plans.close') : message('action_plans.reopen'), + <%= link_to message('action_plans.close'), {:action => 'change_status', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :class => 'action'}.merge(close_confirmation_message) -%> <%= link_to message('delete'), {:action => 'delete', :id => @resource.id, :plan_id => plan.id}, {:method => 'POST', :confirm => message('action_plans.confirm_delete'), :class => 'action'} -%>
- + + + + <% unless @closed_action_plans.empty? %> + +
+ <%= message('action_plans.show_closed_action_plans') -%> +
+ + + + + + + + + + + + + + <% + @closed_action_plans.each do |plan| + %> + + + + + <% if plan.progress[:total]==0 %> + + <% else %> + + <% end %> + + + + + <% end %> + + + + <% end %> + diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb index ffc5d58a6e4..0b00d367835 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb @@ -1,5 +1,5 @@
-» <%= message('back') -%> +» <%= message('back') -%>