From 3407c9cf51e78b3b15179d58824e62d99e21fa23 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Thu, 22 Dec 2011 17:10:41 +0100 Subject: [PATCH] SONAR-2662 Add the "Planned reviews" widget --- .../widgets/reviews/planned_reviews.html.erb | 71 ++++++++++++++++++- .../resources/org/sonar/l10n/core.properties | 1 + 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb index a81fe827804..6976e7ef4e1 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/reviews/planned_reviews.html.erb @@ -1 +1,70 @@ - Under construction ;-) +<% + if has_role?(:user, @project) + limit = widget_properties["numberOfLines"] + + search_options = {} + search_options['projects'] = @project.key + search_options['statuses'] = "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}" + + if @dashboard_configuration.selected_period? + search_options['from'] = @dashboard_configuration.from_datetime + search_options['to'] = DateTime.now + end + + title = message('widget.planned_reviews.name') + + open_action_plans = ActionPlan.find(:all, :conditions => ['status= ? AND project_id=?', ActionPlan::STATUS_OPEN, @project.id], + :include => 'reviews', :order => 'dead_line ASC') + + if open_action_plans.empty? +%> + +

<%= title -%>

+<%= message('widget.planned_reviews.no_action_plan') -%> + +<% + else + first_action_plan = open_action_plans[0] + url_options = search_options.merge({:controller => 'project_reviews', :action => 'widget_reviews_list', :snapshot_id => @snapshot.id, + :limit => limit, :widget_id => widget.id, :period => params[:period] }) +%> + + + +
+
+ + <%= message('widgets.more') -%> + +
+ +

+ <%= title -%> + +

+
+ + +
+ <% search_options['action_plan_id'] = first_action_plan.id %> + <%= render :partial => 'project/widgets/reviews/reviews_list', + :locals => {:search_options => search_options, + :limit => limit, + :widget_id => widget.id.to_s} %> +
+ +<% + end + 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 165578cefb2..74bcc702c31 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 @@ -701,6 +701,7 @@ widget.action_plans.hide_closed_action_plans=Hide closed action plans widget.planned_reviews.name=Planned reviews widget.planned_reviews.description=Shows all the planned reviews of the project, gathered by action plan +widget.planned_reviews.no_action_plan=No action plan widget.unplanned_reviews.name=Unplanned reviews widget.unplanned_reviews.description=Shows all the reviews of the project that are not planned yet in an action plan -- 2.39.5