diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index 00feab8b9..f8675608e 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -35,7 +35,7 @@

<%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;", :id => 'attach_files_link' %>

-<% form_tag({ :controller => 'wiki', :action => 'add_attachment', :page => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %> +<% form_tag({ :controller => 'wiki', :action => 'add_attachment', :project_id => @project, :page => @page.title }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>

<%= render :partial => 'attachments/form' %>

diff --git a/config/routes.rb b/config/routes.rb index 5676f4546..511e6dc29 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -41,7 +41,7 @@ ActionController::Routing::Routes.draw do |map| end wiki_routes.connect 'projects/:project_id/wiki/:page/:action', - :action => /rename|destroy|preview|protect/, + :action => /rename|destroy|preview|protect|add_attachment/, :conditions => {:method => :post} wiki_routes.connect 'projects/:project_id/wiki/:page/edit', :action => 'update', :conditions => {:method => :post} diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 084330c1c..ea8c71b0a 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -327,6 +327,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :page => 'ladida' should_route :post, "/projects/22/wiki/ladida/destroy", :controller => 'wiki', :action => 'destroy', :project_id => '22', :page => 'ladida' should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :page => 'ladida' + should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :page => 'ladida' end context "wikis (plural, admin setup)" do