]> source.dussan.org Git - sonarqube.git/blob
5054635cd9a38732b154619743c657b77d556f26
[sonarqube.git] /
1 <%
2    if has_role?(:user, @project)
3      action_plans = Internal.issues.findActionPlanStats(@resource.key)
4      open_action_plans = action_plans.select {|plan| plan.isOpen()}
5
6      div_id = "issues-action-plan-widget-#{widget.id.to_s}"
7 %>
8
9 <div class="line-block">
10   <% if has_role?(:admin, @project) %>
11   <div style="float:right">
12     <a href="<%= url_for :controller => 'issues_action_plans', :action => 'index', :id => @project.id -%>">
13       <%= message('widgets.more') -%>
14     </a>
15   </div>
16   <% end %>
17   
18   <h3><%= message('widget.action_plans.title') -%></h3>
19 </div>
20
21
22 <div id="<%= div_id -%>">
23
24 <% if open_action_plans.size ==0 %>
25
26   <span class="empty_widget"><%= message('widget.action_plans.no_action_plan') -%></span>
27
28 <% 
29    else
30      show_resolved_issues = widget_properties["showResolvedIssues"]
31      if show_resolved_issues
32        line_class = "top"
33      else
34        line_class = "middle"
35        max_unresolved_issues = open_action_plans.map {|plan| plan.unresolvedIssues()}.max
36      end 
37 %>
38
39   <table class="width100 <%= show_resolved_issues ? 'actionPlans' : 'data' -%>">
40     <thead>
41     <tr>
42       <th colspan="<%= show_resolved_issues ? '3' : '4' %>"></th>
43     </tr>
44     </thead>
45     <tbody>
46       <%
47          open_action_plans.each do |plan|
48       %>
49       <tr class="<%= show_resolved_issues ? '' : cycle("even", "odd", :name => "action_plan_" + widget.id.to_s) -%>">
50         <td class="nowrap <%= line_class -%>"><%= h(plan.name) -%></td>
51         <td class="nowrap small <%= line_class -%> <%= 'over-due' if plan.overDue() -%>" style="text-align: right; padding-left:10px"><%= format_date(plan.deadLine())  -%></td>
52         
53         <% if show_resolved_issues %>
54           <% if plan.totalIssues()==0 %>
55             <td class="noprogress nowrap <%= line_class -%>"><%= message('action_plans.no_issues_linked_to_action_plan') -%></td>
56           <% else %>
57             <td class="progress <%= line_class -%>">
58               <%= render :partial => 'action_plans/progress', :locals => {:action_plan => plan} -%>
59             </td>
60           <% end %>
61         <% 
62            else
63              unresolved_issues_size = plan.unresolvedIssues()
64         %>
65           <td class="right <%= line_class -%>" style="padding-left:20px">
66             <% if unresolved_issues_size == 0 %>
67               <%= unresolved_issues_size -%>
68             <% else %>
69               <a href="<%= url_for({:controller => 'issues', :action => 'search',
70                                     :actionPlans => plan.key, :resolved => 'false'}) -%>"
71                  title="<%= message('widget.action_plans.x_unresolved_issues', :params => unresolved_issues_size.to_s) -%>"><%= unresolved_issues_size -%></a>
72             <% end %>
73           </td>
74           <td class="<%= line_class -%>" style="padding: 0 40px 0 10px; width: 300px;">
75             <div class="barchart" style="width: 100%">
76               <div style="width: <%= max_unresolved_issues > 0 ? 100 * unresolved_issues_size / max_unresolved_issues : 0 -%>%;background-color:#777;"></div>
77             </div>
78           </td>
79         <% end %>
80         
81       </tr>
82       <% 
83          end 
84       %>
85     </tbody>
86   </table>
87
88 <% end %>
89   
90 </div>
91
92 <% end %>