2 if has_role?(:user, @project)
3 limit = widget_properties["numberOfLines"]
6 search_options['projects'] = @project.key
7 search_options['statuses'] = "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}"
9 if @dashboard_configuration.selected_period?
10 search_options['from'] = @dashboard_configuration.from_datetime
11 search_options['to'] = DateTime.now
14 title = message('widget.planned_reviews.name')
16 open_action_plans = ActionPlan.find(:all, :conditions => ['status= ? AND project_id=?', ActionPlan::STATUS_OPEN, @project.id],
17 :include => 'reviews', :order => 'deadline ASC')
19 if open_action_plans.empty?
22 <h3><%= title -%></h3>
23 <span class="empty_widget"><%= message('widget.planned_reviews.no_action_plan') -%></span>
27 first_action_plan = open_action_plans[0]
28 url_options = search_options.merge({:controller => 'project_reviews', :action => 'widget_reviews_list', :snapshot_id => @snapshot.id,
29 :limit => limit, :widget_id => widget.id, :period => params[:period] })
32 <script type="text/javascript">
33 function showActionPlanOpenReviews(actionPlanId) {
34 new Ajax.Updater('reviews-widget-<%= widget.id -%>',
35 '<%= url_for url_options -%>&action_plan_id=' + actionPlanId,
36 {asynchronous:true, evalScripts:true});
37 $('planned-review-more-link_<%= widget.id -%>').href = '<%= url_for url_options.merge({:action => 'index'}) -%>&action_plan_id=' + actionPlanId;
41 <div class="line-block">
44 <select class="small" style="margin-left: 20px" onchange="showActionPlanOpenReviews(this.value);" id="select-action-plan_<%= widget.id -%>">
45 <% open_action_plans.each do |plan| %>
46 <option value="<%= plan.id -%>"><%= h(plan.name) -%></option>
53 <div id="reviews-widget-<%= widget.id -%>">
54 <% search_options['action_plan_id'] = first_action_plan.id %>
55 <%= render :partial => 'project/widgets/reviews/reviews_list',
56 :locals => {:search_options => search_options,
58 :widget_id => widget.id.to_s} %>