From c514dd6885af45ebb38d00ba4a8c61b1ea206d2c Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 28 Oct 2010 21:25:38 +0000 Subject: Refactor: convert WikiController to a REST resource git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4303 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/routes.rb | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'config') diff --git a/config/routes.rb b/config/routes.rb index 0fa76f235..b062aea94 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,27 +27,6 @@ ActionController::Routing::Routes.draw do |map| map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} - map.with_options :controller => 'wiki' do |wiki_routes| - wiki_routes.with_options :conditions => {:method => :get} do |wiki_views| - wiki_views.connect 'projects/:project_id/wiki/export', :action => 'export' - wiki_views.connect 'projects/:project_id/wiki/index', :action => 'index' - wiki_views.connect 'projects/:project_id/wiki/date_index', :action => 'date_index' - wiki_views.connect 'projects/:project_id/wiki/:id', :action => 'show', :id => nil - wiki_views.connect 'projects/:project_id/wiki/:id/edit', :action => 'edit' - wiki_views.connect 'projects/:project_id/wiki/:id/rename', :action => 'rename' - wiki_views.connect 'projects/:project_id/wiki/:id/history', :action => 'history' - wiki_views.connect 'projects/:project_id/wiki/:id/diff/:version/vs/:version_from', :action => 'diff' - wiki_views.connect 'projects/:project_id/wiki/:id/annotate/:version', :action => 'annotate' - end - - wiki_routes.connect 'projects/:project_id/wiki/:id/:action', - :action => /rename|preview|protect|add_attachment/, - :conditions => {:method => :post} - - wiki_routes.connect 'projects/:project_id/wiki/:id/edit', :action => 'update', :conditions => {:method => :post} - - wiki_routes.connect 'projects/:project_id/wiki/:id', :action => 'destroy', :conditions => {:method => :delete} - end map.with_options :controller => 'messages' do |messages_routes| messages_routes.with_options :conditions => {:method => :get} do |messages_views| @@ -168,7 +147,21 @@ ActionController::Routing::Routes.draw do |map| project.resources :news, :shallow => true project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' - + project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get} + project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get} + project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff' + project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate' + project.resources :wiki, :except => [:new, :create], :member => { + :rename => [:get, :post], + :history => :get, + :preview => :any, + :protect => :post, + :add_attachment => :post + }, :collection => { + :export => :get, + :date_index => :get + } + end # Destroy uses a get request to prompt the user before the actual DELETE request -- cgit v1.2.3