]> source.dussan.org Git - sonarqube.git/blob
cbb0a088b0b67a0504b333b4ad054327422a8c59
[sonarqube.git] /
1 <%
2    if has_role?(:user, @project)
3      limit = widget_properties["numberOfLines"]
4
5      search_options = {}
6      search_options['projects'] = @project.key
7      search_options['statuses'] = "#{Review::STATUS_OPEN},#{Review::STATUS_REOPENED}"
8      
9      if @dashboard_configuration.selected_period?
10        search_options['from'] = @dashboard_configuration.from_datetime
11        search_options['to'] = DateTime.now
12      end
13      
14      title = message('widget.planned_reviews.name')
15      
16      open_action_plans = ActionPlan.find(:all, :conditions => ['status= ? AND project_id=?', ActionPlan::STATUS_OPEN, @project.id], 
17                                          :include => 'reviews', :order => 'dead_line ASC')
18      
19      if open_action_plans.empty? 
20 %>
21   
22 <h3><%= title -%></h3>
23 <span class="empty_widget"><%= message('widget.planned_reviews.no_action_plan') -%></span>
24
25 <% 
26      else
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] })
30 %>
31
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;
38   }
39 </script>
40
41 <div class="line-block">
42   <h3>
43     <%= title -%>
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>
47       <% end %>
48     </select>
49   </h3>
50 </div>
51
52
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,
57                          :limit => limit,
58                          :widget_id => widget.id.to_s} %>
59 </div>
60
61 <% 
62      end
63    end 
64 %>