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