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