@@ -6,7 +6,7 | |||||
6 |
|
6 | |||
7 | <h2><%= l(:label_spent_time) %></h2> |
|
7 | <h2><%= l(:label_spent_time) %></h2> | |
8 |
|
8 | |||
9 | <% form_remote_tag(:url => {}, :html => {:method => :get, :id => 'query_form'}, :method => :get, :update => 'content') do %> |
|
9 | <% form_tag({:controller => 'time_entry_reports', :action => 'report', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> | |
10 | <% @criterias.each do |criteria| %> |
|
10 | <% @criterias.each do |criteria| %> | |
11 | <%= hidden_field_tag 'criterias[]', criteria, :id => nil %> |
|
11 | <%= hidden_field_tag 'criterias[]', criteria, :id => nil %> | |
12 | <% end %> |
|
12 | <% end %> | |
@@ -22,14 +22,11 | |||||
22 | :onchange => "this.form.onsubmit();" %> |
|
22 | :onchange => "this.form.onsubmit();" %> | |
23 |
|
23 | |||
24 | <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l_or_humanize(@available_criterias[k][:label]), k]}), |
|
24 | <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l_or_humanize(@available_criterias[k][:label]), k]}), | |
25 |
:onchange => "this.form. |
|
25 | :onchange => "this.form.submit();", | |
26 | :style => 'width: 200px', |
|
26 | :style => 'width: 200px', | |
27 | :id => nil, |
|
27 | :id => nil, | |
28 | :disabled => (@criterias.length >= 3)) %> |
|
28 | :disabled => (@criterias.length >= 3)) %> | |
29 |
<%= link_to |
|
29 | <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @columns}, :class => 'icon icon-reload' %></p> | |
30 | :method => :get, |
|
|||
31 | :update => 'content' |
|
|||
32 | }, :class => 'icon icon-reload' %></p> |
|
|||
33 | <% end %> |
|
30 | <% end %> | |
34 |
|
31 | |||
35 | <% unless @criterias.empty? %> |
|
32 | <% unless @criterias.empty? %> |
@@ -4,7 +4,7 | |||||
4 | <p> |
|
4 | <p> | |
5 | <%= radio_button_tag 'period_type', '1', !@free_period %> |
|
5 | <%= radio_button_tag 'period_type', '1', !@free_period %> | |
6 | <%= select_tag 'period', options_for_period_select(params[:period]), |
|
6 | <%= select_tag 'period', options_for_period_select(params[:period]), | |
7 |
:onchange => 'this.form. |
|
7 | :onchange => 'this.form.submit();', | |
8 | :onfocus => '$("period_type_1").checked = true;' %> |
|
8 | :onfocus => '$("period_type_1").checked = true;' %> | |
9 | </p> |
|
9 | </p> | |
10 | <p> |
|
10 | <p> | |
@@ -17,12 +17,8 | |||||
17 | </div> |
|
17 | </div> | |
18 | </fieldset> |
|
18 | </fieldset> | |
19 | <p class="buttons"> |
|
19 | <p class="buttons"> | |
20 | <%= link_to_remote l(:button_apply), |
|
20 | <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> | |
21 | { :url => { }, |
|
21 | <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %> | |
22 | :update => "content", |
|
|||
23 | :with => "Form.serialize('query_form')", |
|
|||
24 | :method => :get |
|
|||
25 | }, :class => 'icon icon-checked' %> |
|
|||
26 | </p> |
|
22 | </p> | |
27 |
|
23 | |||
28 | <div class="tabs"> |
|
24 | <div class="tabs"> |
@@ -6,11 +6,7 | |||||
6 |
|
6 | |||
7 | <h2><%= l(:label_spent_time) %></h2> |
|
7 | <h2><%= l(:label_spent_time) %></h2> | |
8 |
|
8 | |||
9 | <% form_remote_tag( :url => {}, :html => {:method => :get, :id => 'query_form'}, :method => :get, :update => 'content' ) do %> |
|
9 | <% form_tag({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> | |
10 | <%# TOOD: remove the project_id and issue_id hidden fields, that information is |
|
|||
11 | already in the URI %> |
|
|||
12 | <%= hidden_field_tag('project_id', params[:project_id]) if @project %> |
|
|||
13 | <%= hidden_field_tag 'issue_id', params[:issue_id] if @issue %> |
|
|||
14 | <%= render :partial => 'date_range' %> |
|
10 | <%= render :partial => 'date_range' %> | |
15 | <% end %> |
|
11 | <% end %> | |
16 |
|
12 |
@@ -14,14 +14,15 ActionController::Routing::Routes.draw do |map| | |||||
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | |
15 | map.connect 'help/:ctrl/:page', :controller => 'help' |
|
15 | map.connect 'help/:ctrl/:page', :controller => 'help' | |
16 |
|
16 | |||
17 | map.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' |
|
|||
18 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| |
|
17 | map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| | |
|
18 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report' | |||
|
19 | time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format' | |||
|
20 | time_report.connect 'projects/:project_id/time_entries/report' | |||
|
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |||
19 | time_report.connect 'time_entries/report' |
|
22 | time_report.connect 'time_entries/report' | |
20 | time_report.connect 'time_entries/report.:format' |
|
23 | time_report.connect 'time_entries/report.:format' | |
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' |
|
|||
22 | end |
|
24 | end | |
23 |
|
25 | |||
24 | # TODO: wasteful since this is also nested under issues, projects, and projects/issues |
|
|||
25 | map.resources :time_entries, :controller => 'timelog' |
|
26 | map.resources :time_entries, :controller => 'timelog' | |
26 |
|
27 | |||
27 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
|
28 | map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} |
@@ -4,16 +4,20 require File.expand_path('../../test_helper', __FILE__) | |||||
4 | class TimeEntryReportsControllerTest < ActionController::TestCase |
|
4 | class TimeEntryReportsControllerTest < ActionController::TestCase | |
5 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values |
|
5 | fixtures :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :time_entries, :users, :trackers, :enumerations, :issue_statuses, :custom_fields, :custom_values | |
6 |
|
6 | |||
7 |
def test_report_ |
|
7 | def test_report_at_project_level | |
8 |
get :report, :project_id => |
|
8 | get :report, :project_id => 'ecookbook' | |
9 | assert_response :success |
|
9 | assert_response :success | |
10 | assert_template 'report' |
|
10 | assert_template 'report' | |
|
11 | assert_tag :form, | |||
|
12 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} | |||
11 | end |
|
13 | end | |
12 |
|
14 | |||
13 | def test_report_all_projects |
|
15 | def test_report_all_projects | |
14 | get :report |
|
16 | get :report | |
15 | assert_response :success |
|
17 | assert_response :success | |
16 | assert_template 'report' |
|
18 | assert_template 'report' | |
|
19 | assert_tag :form, | |||
|
20 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} | |||
17 | end |
|
21 | end | |
18 |
|
22 | |||
19 | def test_report_all_projects_denied |
|
23 | def test_report_all_projects_denied | |
@@ -80,6 +84,8 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
80 | assert_template 'report' |
|
84 | assert_template 'report' | |
81 | assert_not_nil assigns(:total_hours) |
|
85 | assert_not_nil assigns(:total_hours) | |
82 | assert_equal "154.25", "%.2f" % assigns(:total_hours) |
|
86 | assert_equal "154.25", "%.2f" % assigns(:total_hours) | |
|
87 | assert_tag :form, | |||
|
88 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} | |||
83 | end |
|
89 | end | |
84 |
|
90 | |||
85 | def test_report_custom_field_criteria |
|
91 | def test_report_custom_field_criteria |
@@ -163,10 +163,12 class TimelogControllerTest < ActionController::TestCase | |||||
163 | assert_template 'index' |
|
163 | assert_template 'index' | |
164 | assert_not_nil assigns(:total_hours) |
|
164 | assert_not_nil assigns(:total_hours) | |
165 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
165 | assert_equal "162.90", "%.2f" % assigns(:total_hours) | |
|
166 | assert_tag :form, | |||
|
167 | :attributes => {:action => "/time_entries", :id => 'query_form'} | |||
166 | end |
|
168 | end | |
167 |
|
169 | |||
168 | def test_index_at_project_level |
|
170 | def test_index_at_project_level | |
169 |
get :index, :project_id => |
|
171 | get :index, :project_id => 'ecookbook' | |
170 | assert_response :success |
|
172 | assert_response :success | |
171 | assert_template 'index' |
|
173 | assert_template 'index' | |
172 | assert_not_nil assigns(:entries) |
|
174 | assert_not_nil assigns(:entries) | |
@@ -178,10 +180,12 class TimelogControllerTest < ActionController::TestCase | |||||
178 | # display all time by default |
|
180 | # display all time by default | |
179 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
181 | assert_equal '2007-03-12'.to_date, assigns(:from) | |
180 | assert_equal '2007-04-22'.to_date, assigns(:to) |
|
182 | assert_equal '2007-04-22'.to_date, assigns(:to) | |
|
183 | assert_tag :form, | |||
|
184 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |||
181 | end |
|
185 | end | |
182 |
|
186 | |||
183 | def test_index_at_project_level_with_date_range |
|
187 | def test_index_at_project_level_with_date_range | |
184 |
get :index, :project_id => |
|
188 | get :index, :project_id => 'ecookbook', :from => '2007-03-20', :to => '2007-04-30' | |
185 | assert_response :success |
|
189 | assert_response :success | |
186 | assert_template 'index' |
|
190 | assert_template 'index' | |
187 | assert_not_nil assigns(:entries) |
|
191 | assert_not_nil assigns(:entries) | |
@@ -190,24 +194,30 class TimelogControllerTest < ActionController::TestCase | |||||
190 | assert_equal "12.90", "%.2f" % assigns(:total_hours) |
|
194 | assert_equal "12.90", "%.2f" % assigns(:total_hours) | |
191 | assert_equal '2007-03-20'.to_date, assigns(:from) |
|
195 | assert_equal '2007-03-20'.to_date, assigns(:from) | |
192 | assert_equal '2007-04-30'.to_date, assigns(:to) |
|
196 | assert_equal '2007-04-30'.to_date, assigns(:to) | |
|
197 | assert_tag :form, | |||
|
198 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |||
193 | end |
|
199 | end | |
194 |
|
200 | |||
195 | def test_index_at_project_level_with_period |
|
201 | def test_index_at_project_level_with_period | |
196 |
get :index, :project_id => |
|
202 | get :index, :project_id => 'ecookbook', :period => '7_days' | |
197 | assert_response :success |
|
203 | assert_response :success | |
198 | assert_template 'index' |
|
204 | assert_template 'index' | |
199 | assert_not_nil assigns(:entries) |
|
205 | assert_not_nil assigns(:entries) | |
200 | assert_not_nil assigns(:total_hours) |
|
206 | assert_not_nil assigns(:total_hours) | |
201 | assert_equal Date.today - 7, assigns(:from) |
|
207 | assert_equal Date.today - 7, assigns(:from) | |
202 | assert_equal Date.today, assigns(:to) |
|
208 | assert_equal Date.today, assigns(:to) | |
|
209 | assert_tag :form, | |||
|
210 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |||
203 | end |
|
211 | end | |
204 |
|
212 | |||
205 | def test_index_one_day |
|
213 | def test_index_one_day | |
206 |
get :index, :project_id => |
|
214 | get :index, :project_id => 'ecookbook', :from => "2007-03-23", :to => "2007-03-23" | |
207 | assert_response :success |
|
215 | assert_response :success | |
208 | assert_template 'index' |
|
216 | assert_template 'index' | |
209 | assert_not_nil assigns(:total_hours) |
|
217 | assert_not_nil assigns(:total_hours) | |
210 | assert_equal "4.25", "%.2f" % assigns(:total_hours) |
|
218 | assert_equal "4.25", "%.2f" % assigns(:total_hours) | |
|
219 | assert_tag :form, | |||
|
220 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |||
211 | end |
|
221 | end | |
212 |
|
222 | |||
213 | def test_index_at_issue_level |
|
223 | def test_index_at_issue_level | |
@@ -221,6 +231,10 class TimelogControllerTest < ActionController::TestCase | |||||
221 | # display all time based on what's been logged |
|
231 | # display all time based on what's been logged | |
222 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
232 | assert_equal '2007-03-12'.to_date, assigns(:from) | |
223 | assert_equal '2007-04-22'.to_date, assigns(:to) |
|
233 | assert_equal '2007-04-22'.to_date, assigns(:to) | |
|
234 | # TODO: remove /projects/:project_id/issues/:issue_id/time_entries routes | |||
|
235 | # to use /issues/:issue_id/time_entries | |||
|
236 | assert_tag :form, | |||
|
237 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} | |||
224 | end |
|
238 | end | |
225 |
|
239 | |||
226 | def test_index_atom_feed |
|
240 | def test_index_atom_feed |
General Comments 0
You need to be logged in to leave comments.
Login now