@@ -0,0 +1,1 | |||||
|
1 | $('#time_entry_issue').html('<%= escape_javascript link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>'); |
@@ -13,9 +13,9 | |||||
13 | <% end %> |
|
13 | <% end %> | |
14 | <p> |
|
14 | <p> | |
15 | <%= f.text_field :issue_id, :size => 6 %> |
|
15 | <%= f.text_field :issue_id, :size => 6 %> | |
16 | <% if @time_entry.issue.try(:visible?) %> |
|
16 | <span id="time_entry_issue"> | |
17 | <span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span> |
|
17 | <%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %> | |
18 | <% end %> |
|
18 | </span> | |
19 | </p> |
|
19 | </p> | |
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> |
|
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> | |
21 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> |
|
21 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> | |
@@ -28,22 +28,20 | |||||
28 | </div> |
|
28 | </div> | |
29 |
|
29 | |||
30 | <%= javascript_tag do %> |
|
30 | <%= javascript_tag do %> | |
31 | <% if @time_entry.new_record? %> |
|
|||
32 | $(document).ready(function(){ |
|
31 | $(document).ready(function(){ | |
33 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ |
|
32 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ | |
34 | $.ajax({ |
|
33 | $.ajax({ | |
35 | url: '<%= escape_javascript new_time_entry_path(:format => 'js') %>', |
|
34 | url: '<%= escape_javascript(@time_entry.new_record? ? new_time_entry_path(:format => 'js') : edit_time_entry_path(:format => 'js')) %>', | |
36 | type: 'post', |
|
35 | type: 'post', | |
37 |
data: $( |
|
36 | data: $(this).closest('form').serialize() | |
38 | }); |
|
37 | }); | |
39 | }); |
|
38 | }); | |
40 | }); |
|
39 | }); | |
41 | <% end %> |
|
|||
42 |
|
40 | |||
43 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { |
|
41 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { | |
44 | select: function(event, ui) { |
|
42 | select: function(event, ui) { | |
45 |
$('#time_entry_issue').text( |
|
43 | $('#time_entry_issue').text(''); | |
46 |
$('#time_entry_issue_id'). |
|
44 | $('#time_entry_issue_id').val(ui.item.value).change(); | |
47 | } |
|
45 | } | |
48 | }); |
|
46 | }); | |
49 | <% end %> |
|
47 | <% end %> |
@@ -1,1 +1,2 | |||||
1 | $('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>'); |
|
1 | $('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>'); | |
|
2 | $('#time_entry_issue').html('<%= escape_javascript link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>'); |
@@ -215,6 +215,10 Rails.application.routes.draw do | |||||
215 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] |
|
215 | match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] | |
216 |
|
216 | |||
217 | resources :time_entries, :controller => 'timelog', :except => :destroy do |
|
217 | resources :time_entries, :controller => 'timelog', :except => :destroy do | |
|
218 | member do | |||
|
219 | # Used when updating the edit form of an existing time entry | |||
|
220 | patch 'edit', :to => 'timelog#edit' | |||
|
221 | end | |||
218 | collection do |
|
222 | collection do | |
219 | get 'report' |
|
223 | get 'report' | |
220 | get 'bulk_edit' |
|
224 | get 'bulk_edit' |
@@ -35,6 +35,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
35 |
|
35 | |||
36 | assert_select 'input[name=?][type=hidden]', 'project_id', 0 |
|
36 | assert_select 'input[name=?][type=hidden]', 'project_id', 0 | |
37 | assert_select 'input[name=?][type=hidden]', 'issue_id', 0 |
|
37 | assert_select 'input[name=?][type=hidden]', 'issue_id', 0 | |
|
38 | assert_select 'span[id=?]', 'time_entry_issue' | |||
38 | assert_select 'select[name=?]', 'time_entry[project_id]' do |
|
39 | assert_select 'select[name=?]', 'time_entry[project_id]' do | |
39 | # blank option for project |
|
40 | # blank option for project | |
40 | assert_select 'option[value=""]' |
|
41 | assert_select 'option[value=""]' | |
@@ -58,6 +59,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
58 |
|
59 | |||
59 | assert_select 'input[name=?][type=hidden]', 'project_id', 0 |
|
60 | assert_select 'input[name=?][type=hidden]', 'project_id', 0 | |
60 | assert_select 'input[name=?][type=hidden]', 'issue_id' |
|
61 | assert_select 'input[name=?][type=hidden]', 'issue_id' | |
|
62 | assert_select 'a[href=?]', '/issues/2', :text => /Feature request #2/ | |||
61 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 |
|
63 | assert_select 'select[name=?]', 'time_entry[project_id]', 0 | |
62 | end |
|
64 | end | |
63 |
|
65 | |||
@@ -249,7 +251,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
249 | end |
|
251 | end | |
250 | assert_select_error /Issue is invalid/ |
|
252 | assert_select_error /Issue is invalid/ | |
251 | assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s |
|
253 | assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s | |
252 | assert_select "#time_entry_issue", 0 |
|
254 | assert_select "#time_entry_issue a", 0 | |
253 | assert !response.body.include?('issue_that_is_not_visible') |
|
255 | assert !response.body.include?('issue_that_is_not_visible') | |
254 | end |
|
256 | end | |
255 |
|
257 | |||
@@ -501,7 +503,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
501 | assert_select 'form#bulk_edit_form[action=?]', '/time_entries/bulk_update' do |
|
503 | assert_select 'form#bulk_edit_form[action=?]', '/time_entries/bulk_update' do | |
502 | # System wide custom field |
|
504 | # System wide custom field | |
503 | assert_select 'select[name=?]', 'time_entry[custom_field_values][10]' |
|
505 | assert_select 'select[name=?]', 'time_entry[custom_field_values][10]' | |
504 |
|
506 | |||
505 | # Activities |
|
507 | # Activities | |
506 | assert_select 'select[name=?]', 'time_entry[activity_id]' do |
|
508 | assert_select 'select[name=?]', 'time_entry[activity_id]' do | |
507 | assert_select 'option[value=""]', :text => '(No change)' |
|
509 | assert_select 'option[value=""]', :text => '(No change)' | |
@@ -549,7 +551,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
549 | @request.session[:user_id] = 2 |
|
551 | @request.session[:user_id] = 2 | |
550 | # makes user a manager on the other project |
|
552 | # makes user a manager on the other project | |
551 | Member.create!(:user_id => 2, :project_id => 3, :role_ids => [1]) |
|
553 | Member.create!(:user_id => 2, :project_id => 3, :role_ids => [1]) | |
552 |
|
554 | |||
553 | # update time entry activity |
|
555 | # update time entry activity | |
554 | post :bulk_update, :params => {:ids => [1, 2, 4], :time_entry => { :activity_id => 9 }} |
|
556 | post :bulk_update, :params => {:ids => [1, 2, 4], :time_entry => { :activity_id => 9 }} | |
555 |
|
557 | |||
@@ -677,9 +679,9 class TimelogControllerTest < Redmine::ControllerTest | |||||
677 | def test_index_at_project_level |
|
679 | def test_index_at_project_level | |
678 | get :index, :params => {:project_id => 'ecookbook', :c => ['project']} |
|
680 | get :index, :params => {:project_id => 'ecookbook', :c => ['project']} | |
679 | assert_response :success |
|
681 | assert_response :success | |
680 |
|
682 | |||
681 | assert_select 'tr.time-entry', 4 |
|
683 | assert_select 'tr.time-entry', 4 | |
682 |
|
684 | |||
683 | # project and subproject |
|
685 | # project and subproject | |
684 | projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort |
|
686 | projects = css_select('table.time-entries tbody td.project').map(&:text).uniq.sort | |
685 | assert_equal ["eCookbook", "eCookbook Subproject 1"], projects |
|
687 | assert_equal ["eCookbook", "eCookbook Subproject 1"], projects | |
@@ -959,7 +961,7 class TimelogControllerTest < Redmine::ControllerTest | |||||
959 |
|
961 | |||
960 | def test_index_at_project_level_should_include_csv_export_dialog |
|
962 | def test_index_at_project_level_should_include_csv_export_dialog | |
961 | get :index, :params => { |
|
963 | get :index, :params => { | |
962 |
:project_id => 'ecookbook', |
|
964 | :project_id => 'ecookbook', | |
963 | :f => ['spent_on'], |
|
965 | :f => ['spent_on'], | |
964 | :op => {'spent_on' => '>='}, |
|
966 | :op => {'spent_on' => '>='}, | |
965 | :v => {'spent_on' => ['2007-04-01']}, |
|
967 | :v => {'spent_on' => ['2007-04-01']}, |
@@ -27,7 +27,8 class RoutingTimelogsTest < Redmine::RoutingTest | |||||
27 | should_route 'POST /time_entries' => 'timelog#create' |
|
27 | should_route 'POST /time_entries' => 'timelog#create' | |
28 |
|
28 | |||
29 | should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22' |
|
29 | should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22' | |
30 |
should_route 'P |
|
30 | should_route 'PATCH /time_entries/22/edit' => 'timelog#edit', :id => '22' | |
|
31 | should_route 'PATCH /time_entries/22' => 'timelog#update', :id => '22' | |||
31 | should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22' |
|
32 | should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22' | |
32 | end |
|
33 | end | |
33 |
|
34 |
General Comments 0
You need to be logged in to leave comments.
Login now