@@ -6,7 +6,7 | |||
|
6 | 6 | |
|
7 | 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 | 10 | <% @criterias.each do |criteria| %> |
|
11 | 11 | <%= hidden_field_tag 'criterias[]', criteria, :id => nil %> |
|
12 | 12 | <% end %> |
@@ -22,14 +22,11 | |||
|
22 | 22 | :onchange => "this.form.onsubmit();" %> |
|
23 | 23 | |
|
24 | 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 | 26 | :style => 'width: 200px', |
|
27 | 27 | :id => nil, |
|
28 | 28 | :disabled => (@criterias.length >= 3)) %> |
|
29 |
<%= link_to |
|
|
30 | :method => :get, | |
|
31 | :update => 'content' | |
|
32 | }, :class => 'icon icon-reload' %></p> | |
|
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> | |
|
33 | 30 | <% end %> |
|
34 | 31 | |
|
35 | 32 | <% unless @criterias.empty? %> |
@@ -4,7 +4,7 | |||
|
4 | 4 | <p> |
|
5 | 5 | <%= radio_button_tag 'period_type', '1', !@free_period %> |
|
6 | 6 | <%= select_tag 'period', options_for_period_select(params[:period]), |
|
7 |
:onchange => 'this.form. |
|
|
7 | :onchange => 'this.form.submit();', | |
|
8 | 8 | :onfocus => '$("period_type_1").checked = true;' %> |
|
9 | 9 | </p> |
|
10 | 10 | <p> |
@@ -17,12 +17,8 | |||
|
17 | 17 | </div> |
|
18 | 18 | </fieldset> |
|
19 | 19 | <p class="buttons"> |
|
20 | <%= link_to_remote l(:button_apply), | |
|
21 | { :url => { }, | |
|
22 | :update => "content", | |
|
23 | :with => "Form.serialize('query_form')", | |
|
24 | :method => :get | |
|
25 | }, :class => 'icon icon-checked' %> | |
|
20 | <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %> | |
|
21 | <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %> | |
|
26 | 22 | </p> |
|
27 | 23 | |
|
28 | 24 | <div class="tabs"> |
@@ -6,11 +6,7 | |||
|
6 | 6 | |
|
7 | 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 %> | |
|
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 %> | |
|
9 | <% form_tag({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}, :method => :get, :id => 'query_form') do %> | |
|
14 | 10 | <%= render :partial => 'date_range' %> |
|
15 | 11 | <% end %> |
|
16 | 12 |
@@ -14,14 +14,15 ActionController::Routing::Routes.draw do |map| | |||
|
14 | 14 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' |
|
15 | 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 | 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 | 22 | time_report.connect 'time_entries/report' |
|
20 | 23 | time_report.connect 'time_entries/report.:format' |
|
21 | time_report.connect 'projects/:project_id/time_entries/report.:format' | |
|
22 | 24 | end |
|
23 | 25 | |
|
24 | # TODO: wasteful since this is also nested under issues, projects, and projects/issues | |
|
25 | 26 | map.resources :time_entries, :controller => 'timelog' |
|
26 | 27 | |
|
27 | 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 | 4 | class TimeEntryReportsControllerTest < ActionController::TestCase |
|
5 | 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_ |
|
|
8 |
get :report, :project_id => |
|
|
7 | def test_report_at_project_level | |
|
8 | get :report, :project_id => 'ecookbook' | |
|
9 | 9 | assert_response :success |
|
10 | 10 | assert_template 'report' |
|
11 | assert_tag :form, | |
|
12 | :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} | |
|
11 | 13 | end |
|
12 | 14 | |
|
13 | 15 | def test_report_all_projects |
|
14 | 16 | get :report |
|
15 | 17 | assert_response :success |
|
16 | 18 | assert_template 'report' |
|
19 | assert_tag :form, | |
|
20 | :attributes => {:action => "/time_entries/report", :id => 'query_form'} | |
|
17 | 21 | end |
|
18 | 22 | |
|
19 | 23 | def test_report_all_projects_denied |
@@ -80,6 +84,8 class TimeEntryReportsControllerTest < ActionController::TestCase | |||
|
80 | 84 | assert_template 'report' |
|
81 | 85 | assert_not_nil assigns(:total_hours) |
|
82 | 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 | 89 | end |
|
84 | 90 | |
|
85 | 91 | def test_report_custom_field_criteria |
@@ -163,10 +163,12 class TimelogControllerTest < ActionController::TestCase | |||
|
163 | 163 | assert_template 'index' |
|
164 | 164 | assert_not_nil assigns(:total_hours) |
|
165 | 165 | assert_equal "162.90", "%.2f" % assigns(:total_hours) |
|
166 | assert_tag :form, | |
|
167 | :attributes => {:action => "/time_entries", :id => 'query_form'} | |
|
166 | 168 | end |
|
167 | 169 | |
|
168 | 170 | def test_index_at_project_level |
|
169 |
get :index, :project_id => |
|
|
171 | get :index, :project_id => 'ecookbook' | |
|
170 | 172 | assert_response :success |
|
171 | 173 | assert_template 'index' |
|
172 | 174 | assert_not_nil assigns(:entries) |
@@ -178,10 +180,12 class TimelogControllerTest < ActionController::TestCase | |||
|
178 | 180 | # display all time by default |
|
179 | 181 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
180 | 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 | 185 | end |
|
182 | 186 | |
|
183 | 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 | 189 | assert_response :success |
|
186 | 190 | assert_template 'index' |
|
187 | 191 | assert_not_nil assigns(:entries) |
@@ -190,24 +194,30 class TimelogControllerTest < ActionController::TestCase | |||
|
190 | 194 | assert_equal "12.90", "%.2f" % assigns(:total_hours) |
|
191 | 195 | assert_equal '2007-03-20'.to_date, assigns(:from) |
|
192 | 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 | 199 | end |
|
194 | 200 | |
|
195 | 201 | def test_index_at_project_level_with_period |
|
196 |
get :index, :project_id => |
|
|
202 | get :index, :project_id => 'ecookbook', :period => '7_days' | |
|
197 | 203 | assert_response :success |
|
198 | 204 | assert_template 'index' |
|
199 | 205 | assert_not_nil assigns(:entries) |
|
200 | 206 | assert_not_nil assigns(:total_hours) |
|
201 | 207 | assert_equal Date.today - 7, assigns(:from) |
|
202 | 208 | assert_equal Date.today, assigns(:to) |
|
209 | assert_tag :form, | |
|
210 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
|
203 | 211 | end |
|
204 | 212 | |
|
205 | 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 | 215 | assert_response :success |
|
208 | 216 | assert_template 'index' |
|
209 | 217 | assert_not_nil assigns(:total_hours) |
|
210 | 218 | assert_equal "4.25", "%.2f" % assigns(:total_hours) |
|
219 | assert_tag :form, | |
|
220 | :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} | |
|
211 | 221 | end |
|
212 | 222 | |
|
213 | 223 | def test_index_at_issue_level |
@@ -221,6 +231,10 class TimelogControllerTest < ActionController::TestCase | |||
|
221 | 231 | # display all time based on what's been logged |
|
222 | 232 | assert_equal '2007-03-12'.to_date, assigns(:from) |
|
223 | 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 | 238 | end |
|
225 | 239 | |
|
226 | 240 | def test_index_atom_feed |
General Comments 0
You need to be logged in to leave comments.
Login now