##// END OF EJS Templates
On the issue report page, 0 issue counts are now displayed as dashes....
Jean-Philippe Lang -
r626:b3f3634df3de
parent child
Show More
@@ -1,32 +1,36
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module ReportsHelper
19 19
20 20 def aggregate(data, criteria)
21 21 a = 0
22 22 data.each { |row|
23 23 match = 1
24 24 criteria.each { |k, v|
25 25 match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t"))
26 26 } unless criteria.nil?
27 27 a = a + row["total"].to_i if match == 1
28 28 } unless data.nil?
29 29 a
30 30 end
31 31
32 def aggregate_link(data, criteria, *args)
33 a = aggregate data, criteria
34 a > 0 ? link_to(a, *args) : '-'
35 end
32 36 end
@@ -1,48 +1,48
1 1 <% if @statuses.empty? or rows.empty? %>
2 2 <p><i><%=l(:label_no_data)%></i></p>
3 3 <% else %>
4 4 <% col_width = 70 / (@statuses.length+3) %>
5 5 <table class="list">
6 6 <thead><tr>
7 7 <th style="width:25%"></th>
8 8 <% for status in @statuses %>
9 9 <th style="text-align:left;width:<%= col_width %>%"><div class="square" style="background:#<%= status.html_color %>;"></div> <small><%= status.name %></small></th>
10 10 <% end %>
11 11 <th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_open_issues_plural)%></strong></th>
12 12 <th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_closed_issues_plural)%></strong></th>
13 13 <th align="center" style="width:<%= col_width %>%"><strong><%=l(:label_total)%></strong></th>
14 14 </tr></thead>
15 15 <tbody>
16 16 <% for row in rows %>
17 17 <tr class="<%= cycle("odd", "even") %>">
18 18 <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
19 19 :set_filter => 1,
20 20 "#{field_name}" => row.id %></td>
21 21 <% for status in @statuses %>
22 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "status_id" => status.id }),
22 <td align="center"><%= aggregate_link data, { field_name => row.id, "status_id" => status.id },
23 23 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
24 24 :set_filter => 1,
25 25 "status_id" => status.id,
26 26 "#{field_name}" => row.id %></td>
27 27 <% end %>
28 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
28 <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 },
29 29 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
30 30 :set_filter => 1,
31 31 "#{field_name}" => row.id,
32 32 "status_id" => "o" %></td>
33 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
33 <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 },
34 34 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
35 35 :set_filter => 1,
36 36 "#{field_name}" => row.id,
37 37 "status_id" => "c" %></td>
38 <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
38 <td align="center"><%= aggregate_link data, { field_name => row.id },
39 39 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
40 40 :set_filter => 1,
41 41 "#{field_name}" => row.id,
42 42 "status_id" => "*" %></td>
43 43 </tr>
44 44 <% end %>
45 45 </tbody>
46 46 </table>
47 47 <% end
48 48 reset_cycle %> No newline at end of file
@@ -1,37 +1,37
1 1 <% if @statuses.empty? or rows.empty? %>
2 2 <p><i><%=l(:label_no_data)%></i></p>
3 3 <% else %>
4 4 <table class="list">
5 5 <thead><tr>
6 6 <th style="width:25%"></th>
7 7 <th align="center" style="width:25%"><%=l(:label_open_issues_plural)%></th>
8 8 <th align="center" style="width:25%"><%=l(:label_closed_issues_plural)%></th>
9 9 <th align="center" style="width:25%"><%=l(:label_total)%></th>
10 10 </tr></thead>
11 11 <tbody>
12 12 <% for row in rows %>
13 13 <tr class="<%= cycle("odd", "even") %>">
14 14 <td><%= link_to row.name, :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
15 15 :set_filter => 1,
16 16 "#{field_name}" => row.id %></td>
17 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 0 }),
17 <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 0 },
18 18 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
19 19 :set_filter => 1,
20 20 "#{field_name}" => row.id,
21 21 "status_id" => "o" %></td>
22 <td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
22 <td align="center"><%= aggregate_link data, { field_name => row.id, "closed" => 1 },
23 23 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
24 24 :set_filter => 1,
25 25 "#{field_name}" => row.id,
26 26 "status_id" => "c" %></td>
27 <td align="center"><%= link_to (aggregate data, { field_name => row.id }),
27 <td align="center"><%= aggregate_link data, { field_name => row.id },
28 28 :controller => 'projects', :action => 'list_issues', :id => ((row.is_a?(Project) ? row : @project)),
29 29 :set_filter => 1,
30 30 "#{field_name}" => row.id,
31 31 "status_id" => "*" %></td>
32 32 </tr>
33 33 <% end %>
34 34 </tbody>
35 35 </table>
36 36 <% end
37 37 reset_cycle %> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now