Fixed broken issue form update when changing tracker.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8195 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-12 20:43:51 +00:00
parent e13a763ab4
commit ed5f487cf5
4 changed files with 15 additions and 1 deletions

View File

@ -6,7 +6,7 @@
</p>
<% end %>
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
<%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
<%= observe_field :issue_tracker_id, :url => project_issue_form_path(@project, :id => @issue),
:update => :attributes,
:with => "Form.serialize('issue-form')" %>

View File

@ -127,6 +127,9 @@ ActionController::Routing::Routes.draw do |map|
project.resources :issues, :only => [:index, :new, :create] do |issues|
issues.resources :time_entries, :controller => 'timelog', :collection => {:report => :get}
end
# issue form update
project.issue_form 'issues/new', :controller => 'issues', :action => 'new', :conditions => {:method => :post}
project.resources :files, :only => [:index, :new, :create]
project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
project.resources :news, :shallow => true

View File

@ -64,6 +64,15 @@ class IssuesTest < ActionController::IntegrationTest
assert_equal 1, issue.status.id
end
def test_update_issue_form
log_user('jsmith', 'jsmith')
post 'projects/ecookbook/issues/new', :issue => { :tracker_id => "2"}
assert_response :success
assert_tag 'select',
:attributes => {:name => 'issue[tracker_id]'},
:child => {:tag => 'option', :attributes => {:value => '2', :selected => 'selected'}}
end
# add then remove 2 attachments to an issue
def test_issue_attachments
log_user('jsmith', 'jsmith')

View File

@ -97,6 +97,8 @@ class RoutingTest < ActionController::IntegrationTest
should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
# issue form update
should_route :post, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'