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