##// END OF EJS Templates
Test broken, display hours like in other tables (#23996)....
Jean-Philippe Lang -
r15585:8c9f9ba38b29
parent child
Show More
@@ -1,19 +1,19
1 1 <% @report.hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| %>
2 2 <% hours_for_value = select_hours(hours, criterias[level], value) -%>
3 3 <% next if hours_for_value.empty? -%>
4 4 <tr class="<%= cycle('odd', 'even') %> <%= criterias.length > level+1 ? 'subtotal' : 'last-level' %>">
5 5 <%= ("<td></td>" * level).html_safe %>
6 6 <td class="name"><%= format_criteria_value(@report.available_criteria[criterias[level]], value) %></td>
7 7 <%= ("<td></td>" * (criterias.length - level - 1)).html_safe -%>
8 8 <% total = 0 -%>
9 9 <% @report.periods.each do |period| -%>
10 10 <% sum = sum_hours(select_hours(hours_for_value, @report.columns, period.to_s)); total += sum -%>
11 <td class="hours"><%= html_hours(l_hours_short(sum)) if sum > 0 %></td>
11 <td class="hours"><%= html_hours(format_hours(sum)) if sum > 0 %></td>
12 12 <% end -%>
13 <td class="hours"><%= html_hours(l_hours_short(total)) if total > 0 %></td>
13 <td class="hours"><%= html_hours(format_hours(total)) if total > 0 %></td>
14 14 </tr>
15 15 <% if criterias.length > level+1 -%>
16 16 <%= render(:partial => 'report_criteria', :locals => {:criterias => criterias, :hours => hours_for_value, :level => (level + 1)}) %>
17 17 <% end -%>
18 18
19 19 <% end %>
@@ -1,74 +1,74
1 1 <div class="contextual">
2 2 <%= link_to l(:button_log_time),
3 3 _new_time_entry_path(@project, @issue),
4 4 :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project, :global => true) %>
5 5 </div>
6 6
7 7 <h2><%= @query.new_record? ? l(:label_spent_time) : @query.name %></h2>
8 8
9 9 <%= form_tag(_report_time_entries_path(@project, nil), :method => :get, :id => 'query_form') do %>
10 10 <% @report.criteria.each do |criterion| %>
11 11 <%= hidden_field_tag 'criteria[]', criterion, :id => nil %>
12 12 <% end %>
13 13 <%= render :partial => 'timelog/date_range' %>
14 14
15 15 <p><label for='columns'><%= l(:label_details) %></label>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
16 16 [l(:label_month), 'month'],
17 17 [l(:label_week), 'week'],
18 18 [l(:label_day_plural).titleize, 'day']], @report.columns),
19 19 :onchange => "this.form.submit();" %>
20 20
21 21 <label for='criterias'><%= l(:button_add) %></label>: <%= select_tag('criteria[]', options_for_select([[]] + (@report.available_criteria.keys - @report.criteria).collect{|k| [l_or_humanize(@report.available_criteria[k][:label]), k]}),
22 22 :onchange => "this.form.submit();",
23 23 :style => 'width: 200px',
24 24 :disabled => (@report.criteria.length >= 3),
25 25 :id => "criterias") %>
26 26 <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @report.columns}, :class => 'icon icon-reload' %></p>
27 27 <% end %>
28 28
29 29 <% unless @report.criteria.empty? %>
30 30 <% if @report.hours.empty? %>
31 31 <p class="nodata"><%= l(:label_no_data) %></p>
32 32 <% else %>
33 33 <div class="autoscroll">
34 34 <table class="list" id="time-report">
35 35 <thead>
36 36 <tr>
37 37 <% @report.criteria.each do |criteria| %>
38 38 <th><%= l_or_humanize(@report.available_criteria[criteria][:label]) %></th>
39 39 <% end %>
40 40 <% columns_width = (40 / (@report.periods.length+1)).to_i %>
41 41 <% @report.periods.each do |period| %>
42 42 <th class="period" style="width:<%= columns_width %>%;"><%= period %></th>
43 43 <% end %>
44 44 <th class="total" style="width:<%= columns_width %>%;"><%= l(:label_total_time) %></th>
45 45 </tr>
46 46 </thead>
47 47 <tbody>
48 48 <%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %>
49 49 <tr class="total">
50 50 <td><%= l(:label_total_time) %></td>
51 51 <%= ('<td></td>' * (@report.criteria.size - 1)).html_safe %>
52 52 <% total = 0 -%>
53 53 <% @report.periods.each do |period| -%>
54 54 <% sum = sum_hours(select_hours(@report.hours, @report.columns, period.to_s)); total += sum -%>
55 <td class="hours"><%= html_hours(l_hours_short(sum)) if sum > 0 %></td>
55 <td class="hours"><%= html_hours(format_hours(sum)) if sum > 0 %></td>
56 56 <% end -%>
57 <td class="hours"><%= html_hours(l_hours_short(total)) if total > 0 %></td>
57 <td class="hours"><%= html_hours(format_hours(total)) if total > 0 %></td>
58 58 </tr>
59 59 </tbody>
60 60 </table>
61 61 </div>
62 62
63 63 <% other_formats_links do |f| %>
64 64 <%= f.link_to 'CSV', :url => params %>
65 65 <% end %>
66 66 <% end %>
67 67 <% end %>
68 68
69 69 <% content_for :sidebar do %>
70 70 <%= render_sidebar_queries(TimeEntryQuery, @project) %>
71 71 <% end %>
72 72
73 73 <% html_title(@query.new_record? ? l(:label_spent_time) : @query.name, l(:label_report)) %>
74 74
General Comments 0
You need to be logged in to leave comments. Login now