##// END OF EJS Templates
Time report can be done at issue level (closes #970) + timelog views xhtml validation....
Jean-Philippe Lang -
r1304:467f74510e44
parent child
Show More
@@ -45,7 +45,10 class TimelogController < ApplicationController
45 45 :label => :label_tracker},
46 46 'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
47 47 :klass => Enumeration,
48 :label => :label_activity}
48 :label => :label_activity},
49 'issue' => {:sql => "#{TimeEntry.table_name}.issue_id",
50 :klass => Issue,
51 :label => :label_issue}
49 52 }
50 53
51 54 @criterias = params[:criterias] || []
@@ -196,7 +199,7 private
196 199 render_404
197 200 end
198 201
199 # Retreive the date range based on predefined ranges or specific from/to param dates
202 # Retrieves the date range based on predefined ranges or specific from/to param dates
200 203 def retrieve_date_range
201 204 @free_period = false
202 205 @from, @to = nil, nil
@@ -237,4 +237,8 class Issue < ActiveRecord::Base
237 237 yield
238 238 end
239 239 end
240
241 def to_s
242 "#{tracker} ##{id}: #{subject}"
243 end
240 244 end
@@ -1,5 +1,6
1 1 <table class="list time-entries">
2 2 <thead>
3 <tr>
3 4 <%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
4 5 <%= sort_header_tag('user_id', :caption => l(:label_member)) %>
5 6 <%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
@@ -8,6 +9,7
8 9 <th><%= l(:field_comments) %></th>
9 10 <%= sort_header_tag('hours', :caption => l(:field_hours)) %>
10 11 <th></th>
12 </tr>
11 13 </thead>
12 14 <tbody>
13 15 <% entries.each do |entry| -%>
@@ -35,5 +37,5
35 37 </td>
36 38 </tr>
37 39 <% end -%>
38 </tbdoy>
40 </tbody>
39 41 </table>
@@ -28,3 +28,5
28 28 <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
29 29 </p>
30 30 <% end %>
31
32 <% html_title l(:label_spent_time), l(:label_details) %>
@@ -7,12 +7,11
7 7
8 8 <% form_remote_tag(:url => {}, :update => 'content') do %>
9 9 <% @criterias.each do |criteria| %>
10 <%= hidden_field_tag 'criterias[]', criteria %>
10 <%= hidden_field_tag 'criterias[]', criteria, :id => nil %>
11 11 <% end %>
12 12 <%= hidden_field_tag 'project_id', params[:project_id] %>
13 13 <%= render :partial => 'date_range' %>
14 </p>
15 </fieldset>
14
16 15 <p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
17 16 [l(:label_month), 'month'],
18 17 [l(:label_week), 'week']], @columns),
@@ -21,6 +20,7
21 20 <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}),
22 21 :onchange => "this.form.onsubmit();",
23 22 :style => 'width: 200px',
23 :id => nil,
24 24 :disabled => (@criterias.length >= 3)) %>
25 25 <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :date_from => @date_from, :date_to => @date_to, :period => @columns}, :update => 'content'},
26 26 :class => 'icon icon-reload' %></p>
@@ -36,10 +36,10
36 36 <thead>
37 37 <tr>
38 38 <% @criterias.each do |criteria| %>
39 <th width="15%"><%= l(@available_criterias[criteria][:label]) %></th>
39 <th><%= l(@available_criterias[criteria][:label]) %></th>
40 40 <% end %>
41 41 <% @periods.each do |period| %>
42 <th width="<%= ((100 - @criterias.length * 15 - 15 ) / @periods.length).to_i %>%"><%= period %></th>
42 <th class="period" width="<%= (40 / @periods.length).to_i %>%"><%= period %></th>
43 43 <% end %>
44 44 </tr>
45 45 </thead>
@@ -57,3 +57,6
57 57 </table>
58 58 <% end %>
59 59 <% end %>
60
61 <% html_title l(:label_spent_time), l(:label_report) %>
62
@@ -183,7 +183,7 div#version-summary { float:right; width:380px; margin-left: 16px; margin-bottom
183 183 div#version-summary fieldset { margin-bottom: 1em; }
184 184 div#version-summary .total-hours { text-align: right; }
185 185
186 table#time-report td.hours { text-align: right; padding-right: 0.5em; }
186 table#time-report td.hours, table#time-report th.period { text-align: right; padding-right: 0.5em; }
187 187 table#time-report tbody tr { font-style: italic; color: #777; }
188 188 table#time-report tbody tr.last-level { font-style: normal; color: #555; }
189 189 table#time-report tbody tr.total { font-style: normal; font-weight: bold; color: #555; background-color:#EEEEEE; }
@@ -80,7 +80,7 class TimelogControllerTest < Test::Unit::TestCase
80 80 end
81 81
82 82 def test_report_all_time
83 get :report, :project_id => 1, :criterias => ['project']
83 get :report, :project_id => 1, :criterias => ['project', 'issue']
84 84 assert_response :success
85 85 assert_template 'report'
86 86 assert_not_nil assigns(:total_hours)
General Comments 0
You need to be logged in to leave comments. Login now