##// END OF EJS Templates
Issue subject is not updated when you select another issue on time entry form (#24041)....
Jean-Philippe Lang -
r15569:2544fe6e15d4
parent child
Show More
@@ -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: $('#new_time_entry').serialize()
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(ui.item.label);
46 $('#time_entry_issue_id').blur();
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
@@ -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 'PUT /time_entries/22' => 'timelog#update', :id => '22'
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