Initialize TimeEntry attributes with params when editing an issue (#5441).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4411 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3ba3c540fb
commit
8bb75da1ac
|
@ -269,6 +269,7 @@ private
|
||||||
@priorities = IssuePriority.all
|
@priorities = IssuePriority.all
|
||||||
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||||||
@time_entry = TimeEntry.new
|
@time_entry = TimeEntry.new
|
||||||
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
@notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
|
@notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
|
||||||
@issue.init_journal(User.current, @notes)
|
@issue.init_journal(User.current, @notes)
|
||||||
|
|
|
@ -737,7 +737,8 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_get_edit_with_params
|
def test_get_edit_with_params
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 }
|
get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 },
|
||||||
|
:time_entry => { :hours => '2.5', :comments => 'test_get_edit_with_params', :activity_id => TimeEntryActivity.first.id }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'edit'
|
assert_template 'edit'
|
||||||
|
|
||||||
|
@ -755,6 +756,12 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
:child => { :tag => 'option',
|
:child => { :tag => 'option',
|
||||||
:content => 'Urgent',
|
:content => 'Urgent',
|
||||||
:attributes => { :selected => 'selected' } }
|
:attributes => { :selected => 'selected' } }
|
||||||
|
|
||||||
|
assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => '2.5' }
|
||||||
|
assert_tag :select, :attributes => { :name => 'time_entry[activity_id]' },
|
||||||
|
:child => { :tag => 'option',
|
||||||
|
:attributes => { :selected => 'selected', :value => TimeEntryActivity.first.id } }
|
||||||
|
assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => 'test_get_edit_with_params' }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_edit_form
|
def test_update_edit_form
|
||||||
|
|
Loading…
Reference in New Issue