mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 23:36:01 +01:00
Issue subject is not updated when you select another issue on time entry form (#24041).
git-svn-id: http://svn.redmine.org/redmine/trunk@15951 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -13,9 +13,9 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<p>
|
<p>
|
||||||
<%= f.text_field :issue_id, :size => 6 %>
|
<%= f.text_field :issue_id, :size => 6 %>
|
||||||
<% if @time_entry.issue.try(:visible?) %>
|
<span id="time_entry_issue">
|
||||||
<span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span>
|
<%= link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>
|
||||||
<% end %>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
||||||
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
|
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
|
||||||
@@ -28,22 +28,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= javascript_tag do %>
|
<%= javascript_tag do %>
|
||||||
<% if @time_entry.new_record? %>
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#time_entry_project_id, #time_entry_issue_id').change(function(){
|
$('#time_entry_project_id, #time_entry_issue_id').change(function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%= escape_javascript new_time_entry_path(:format => 'js') %>',
|
url: '<%= escape_javascript(@time_entry.new_record? ? new_time_entry_path(:format => 'js') : edit_time_entry_path(:format => 'js')) %>',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: $('#new_time_entry').serialize()
|
data: $(this).closest('form').serialize()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
<% end %>
|
|
||||||
|
|
||||||
observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', {
|
observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', {
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
$('#time_entry_issue').text(ui.item.label);
|
$('#time_entry_issue').text('');
|
||||||
$('#time_entry_issue_id').blur();
|
$('#time_entry_issue_id').val(ui.item.value).change();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
1
app/views/timelog/edit.js.erb
Normal file
1
app/views/timelog/edit.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$('#time_entry_issue').html('<%= escape_javascript link_to_issue(@time_entry.issue) if @time_entry.issue.try(:visible?) %>');
|
||||||
@@ -1 +1,2 @@
|
|||||||
$('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>');
|
$('#time_entry_activity_id').html('<%= escape_javascript options_for_select(activity_collection_for_select_options(@time_entry), @time_entry.activity_id) %>');
|
||||||
|
$('#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
|
|||||||
match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
|
match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
|
||||||
|
|
||||||
resources :time_entries, :controller => 'timelog', :except => :destroy do
|
resources :time_entries, :controller => 'timelog', :except => :destroy do
|
||||||
|
member do
|
||||||
|
# Used when updating the edit form of an existing time entry
|
||||||
|
patch 'edit', :to => 'timelog#edit'
|
||||||
|
end
|
||||||
collection do
|
collection do
|
||||||
get 'report'
|
get 'report'
|
||||||
get 'bulk_edit'
|
get 'bulk_edit'
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
|
|
||||||
assert_select 'input[name=?][type=hidden]', 'project_id', 0
|
assert_select 'input[name=?][type=hidden]', 'project_id', 0
|
||||||
assert_select 'input[name=?][type=hidden]', 'issue_id', 0
|
assert_select 'input[name=?][type=hidden]', 'issue_id', 0
|
||||||
|
assert_select 'span[id=?]', 'time_entry_issue'
|
||||||
assert_select 'select[name=?]', 'time_entry[project_id]' do
|
assert_select 'select[name=?]', 'time_entry[project_id]' do
|
||||||
# blank option for project
|
# blank option for project
|
||||||
assert_select 'option[value=""]'
|
assert_select 'option[value=""]'
|
||||||
@@ -58,6 +59,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
|
|
||||||
assert_select 'input[name=?][type=hidden]', 'project_id', 0
|
assert_select 'input[name=?][type=hidden]', 'project_id', 0
|
||||||
assert_select 'input[name=?][type=hidden]', 'issue_id'
|
assert_select 'input[name=?][type=hidden]', 'issue_id'
|
||||||
|
assert_select 'a[href=?]', '/issues/2', :text => /Feature request #2/
|
||||||
assert_select 'select[name=?]', 'time_entry[project_id]', 0
|
assert_select 'select[name=?]', 'time_entry[project_id]', 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -249,7 +251,7 @@ class TimelogControllerTest < Redmine::ControllerTest
|
|||||||
end
|
end
|
||||||
assert_select_error /Issue is invalid/
|
assert_select_error /Issue is invalid/
|
||||||
assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s
|
assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s
|
||||||
assert_select "#time_entry_issue", 0
|
assert_select "#time_entry_issue a", 0
|
||||||
assert !response.body.include?('issue_that_is_not_visible')
|
assert !response.body.include?('issue_that_is_not_visible')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class RoutingTimelogsTest < Redmine::RoutingTest
|
|||||||
should_route 'POST /time_entries' => 'timelog#create'
|
should_route 'POST /time_entries' => 'timelog#create'
|
||||||
|
|
||||||
should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22'
|
should_route 'GET /time_entries/22/edit' => 'timelog#edit', :id => '22'
|
||||||
should_route 'PUT /time_entries/22' => 'timelog#update', :id => '22'
|
should_route 'PATCH /time_entries/22/edit' => 'timelog#edit', :id => '22'
|
||||||
|
should_route 'PATCH /time_entries/22' => 'timelog#update', :id => '22'
|
||||||
should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22'
|
should_route 'DELETE /time_entries/22' => 'timelog#destroy', :id => '22'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user