##// 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 :label => :label_tracker},
45 :label => :label_tracker},
46 'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
46 'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
47 :klass => Enumeration,
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 @criterias = params[:criterias] || []
54 @criterias = params[:criterias] || []
@@ -196,7 +199,7 private
196 render_404
199 render_404
197 end
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 def retrieve_date_range
203 def retrieve_date_range
201 @free_period = false
204 @free_period = false
202 @from, @to = nil, nil
205 @from, @to = nil, nil
@@ -237,4 +237,8 class Issue < ActiveRecord::Base
237 yield
237 yield
238 end
238 end
239 end
239 end
240
241 def to_s
242 "#{tracker} ##{id}: #{subject}"
243 end
240 end
244 end
@@ -1,5 +1,6
1 <table class="list time-entries">
1 <table class="list time-entries">
2 <thead>
2 <thead>
3 <tr>
3 <%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
4 <%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
4 <%= sort_header_tag('user_id', :caption => l(:label_member)) %>
5 <%= sort_header_tag('user_id', :caption => l(:label_member)) %>
5 <%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
6 <%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
@@ -8,6 +9,7
8 <th><%= l(:field_comments) %></th>
9 <th><%= l(:field_comments) %></th>
9 <%= sort_header_tag('hours', :caption => l(:field_hours)) %>
10 <%= sort_header_tag('hours', :caption => l(:field_hours)) %>
10 <th></th>
11 <th></th>
12 </tr>
11 </thead>
13 </thead>
12 <tbody>
14 <tbody>
13 <% entries.each do |entry| -%>
15 <% entries.each do |entry| -%>
@@ -35,5 +37,5
35 </td>
37 </td>
36 </tr>
38 </tr>
37 <% end -%>
39 <% end -%>
38 </tbdoy>
40 </tbody>
39 </table>
41 </table>
@@ -28,3 +28,5
28 <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
28 <span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
29 </p>
29 </p>
30 <% end %>
30 <% end %>
31
32 <% html_title l(:label_spent_time), l(:label_details) %>
@@ -7,12 +7,11
7
7
8 <% form_remote_tag(:url => {}, :update => 'content') do %>
8 <% form_remote_tag(:url => {}, :update => 'content') do %>
9 <% @criterias.each do |criteria| %>
9 <% @criterias.each do |criteria| %>
10 <%= hidden_field_tag 'criterias[]', criteria %>
10 <%= hidden_field_tag 'criterias[]', criteria, :id => nil %>
11 <% end %>
11 <% end %>
12 <%= hidden_field_tag 'project_id', params[:project_id] %>
12 <%= hidden_field_tag 'project_id', params[:project_id] %>
13 <%= render :partial => 'date_range' %>
13 <%= render :partial => 'date_range' %>
14 </p>
14
15 </fieldset>
16 <p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
15 <p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
17 [l(:label_month), 'month'],
16 [l(:label_month), 'month'],
18 [l(:label_week), 'week']], @columns),
17 [l(:label_week), 'week']], @columns),
@@ -21,6 +20,7
21 <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}),
20 <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}),
22 :onchange => "this.form.onsubmit();",
21 :onchange => "this.form.onsubmit();",
23 :style => 'width: 200px',
22 :style => 'width: 200px',
23 :id => nil,
24 :disabled => (@criterias.length >= 3)) %>
24 :disabled => (@criterias.length >= 3)) %>
25 <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :date_from => @date_from, :date_to => @date_to, :period => @columns}, :update => 'content'},
25 <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :date_from => @date_from, :date_to => @date_to, :period => @columns}, :update => 'content'},
26 :class => 'icon icon-reload' %></p>
26 :class => 'icon icon-reload' %></p>
@@ -36,10 +36,10
36 <thead>
36 <thead>
37 <tr>
37 <tr>
38 <% @criterias.each do |criteria| %>
38 <% @criterias.each do |criteria| %>
39 <th width="15%"><%= l(@available_criterias[criteria][:label]) %></th>
39 <th><%= l(@available_criterias[criteria][:label]) %></th>
40 <% end %>
40 <% end %>
41 <% @periods.each do |period| %>
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 <% end %>
43 <% end %>
44 </tr>
44 </tr>
45 </thead>
45 </thead>
@@ -57,3 +57,6
57 </table>
57 </table>
58 <% end %>
58 <% end %>
59 <% end %>
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 div#version-summary fieldset { margin-bottom: 1em; }
183 div#version-summary fieldset { margin-bottom: 1em; }
184 div#version-summary .total-hours { text-align: right; }
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 table#time-report tbody tr { font-style: italic; color: #777; }
187 table#time-report tbody tr { font-style: italic; color: #777; }
188 table#time-report tbody tr.last-level { font-style: normal; color: #555; }
188 table#time-report tbody tr.last-level { font-style: normal; color: #555; }
189 table#time-report tbody tr.total { font-style: normal; font-weight: bold; color: #555; background-color:#EEEEEE; }
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 end
80 end
81
81
82 def test_report_all_time
82 def test_report_all_time
83 get :report, :project_id => 1, :criterias => ['project']
83 get :report, :project_id => 1, :criterias => ['project', 'issue']
84 assert_response :success
84 assert_response :success
85 assert_template 'report'
85 assert_template 'report'
86 assert_not_nil assigns(:total_hours)
86 assert_not_nil assigns(:total_hours)
General Comments 0
You need to be logged in to leave comments. Login now