Routes cleanup.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8019 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-01 19:08:49 +00:00
parent 63b7d7e4ac
commit 1cb7de5b5a
2 changed files with 5 additions and 9 deletions

View File

@ -29,7 +29,7 @@ ActionController::Routing::Routes.draw do |map|
:controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
map.time_entries_context_menu '/time_entries/context_menu',
:controller => 'context_menus', :action => 'time_entries'
# TODO: wasteful since this is also nested under issues, projects, and projects/issues
map.resources :time_entries, :controller => 'timelog'
map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
@ -92,15 +92,11 @@ ActionController::Routing::Routes.draw do |map|
reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
end
map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
map.resources :issues do |issues|
issues.resources :time_entries, :controller => 'timelog'
issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
end
map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
issues.resources :time_entries, :controller => 'timelog'
end
map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
map.with_options :controller => 'users' do |users|
@ -135,6 +131,9 @@ ActionController::Routing::Routes.draw do |map|
:unarchive => :post
} do |project|
project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
project.resources :issues, :only => [:index, :new, :create] do |issues|
issues.resources :time_entries, :controller => 'timelog'
end
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
@ -213,7 +212,6 @@ ActionController::Routing::Routes.draw do |map|
map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
#left old routes at the bottom for backwards compat
map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'

View File

@ -83,8 +83,6 @@ class RoutingTest < ActionController::IntegrationTest
should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
# TODO: Should use PUT
should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
# TODO: Should use DELETE