routes.rb
248 lines
| 14.3 KiB
| text/x-ruby
|
RubyLexer
/ config / routes.rb
|
r2 | ActionController::Routing::Routes.draw do |map| | ||
# Add your own custom routes here. | ||||
# The priority is based upon order of creation: first created -> highest priority. | ||||
# Here's a sample route: | ||||
# map.connect 'products/:id', :controller => 'catalog', :action => 'view' | ||||
# Keep in mind you can assign values other than :controller and :action | ||||
|
r749 | map.home '', :controller => 'welcome' | ||
|
r2315 | |||
|
r1123 | map.signin 'login', :controller => 'account', :action => 'login' | ||
map.signout 'logout', :controller => 'account', :action => 'logout' | ||||
|
r761 | map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' | ||
map.connect 'help/:ctrl/:page', :controller => 'help' | ||||
|
r4130 | |||
|
r4136 | map.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report' | ||
map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| | ||||
time_report.connect 'time_entries/report' | ||||
time_report.connect 'time_entries/report.:format' | ||||
time_report.connect 'projects/:project_id/time_entries/report.:format' | ||||
|
r2315 | end | ||
|
r4136 | |||
# TODO: wasteful since this is also nested under issues, projects, and projects/issues | ||||
map.resources :time_entries, :controller => 'timelog' | ||||
|
r2315 | |||
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| | ||||
|
r4137 | wiki_views.connect 'projects/:id/wiki/export', :action => 'export' | ||
|
r4139 | wiki_views.connect 'projects/:id/wiki/page_index', :action => 'page_index' | ||
|
r4147 | wiki_views.connect 'projects/:id/wiki/date_index', :action => 'date_index' | ||
|
r2315 | wiki_views.connect 'projects/:id/wiki/:page', :action => 'index', :page => nil | ||
wiki_views.connect 'projects/:id/wiki/:page/edit', :action => 'edit' | ||||
wiki_views.connect 'projects/:id/wiki/:page/rename', :action => 'rename' | ||||
wiki_views.connect 'projects/:id/wiki/:page/history', :action => 'history' | ||||
wiki_views.connect 'projects/:id/wiki/:page/diff/:version/vs/:version_from', :action => 'diff' | ||||
wiki_views.connect 'projects/:id/wiki/:page/annotate/:version', :action => 'annotate' | ||||
end | ||||
wiki_routes.connect 'projects/:id/wiki/:page/:action', | ||||
:action => /edit|rename|destroy|preview|protect/, | ||||
:conditions => {:method => :post} | ||||
end | ||||
map.with_options :controller => 'messages' do |messages_routes| | ||||
messages_routes.with_options :conditions => {:method => :get} do |messages_views| | ||||
messages_views.connect 'boards/:board_id/topics/new', :action => 'new' | ||||
messages_views.connect 'boards/:board_id/topics/:id', :action => 'show' | ||||
messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit' | ||||
end | ||||
messages_routes.with_options :conditions => {:method => :post} do |messages_actions| | ||||
messages_actions.connect 'boards/:board_id/topics/new', :action => 'new' | ||||
messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply' | ||||
messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ | ||||
end | ||||
end | ||||
map.with_options :controller => 'boards' do |board_routes| | ||||
board_routes.with_options :conditions => {:method => :get} do |board_views| | ||||
board_views.connect 'projects/:project_id/boards', :action => 'index' | ||||
board_views.connect 'projects/:project_id/boards/new', :action => 'new' | ||||
board_views.connect 'projects/:project_id/boards/:id', :action => 'show' | ||||
|
r2590 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | ||
|
r2315 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' | ||
end | ||||
board_routes.with_options :conditions => {:method => :post} do |board_actions| | ||||
board_actions.connect 'projects/:project_id/boards', :action => 'new' | ||||
board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ | ||||
end | ||||
end | ||||
map.with_options :controller => 'documents' do |document_routes| | ||||
document_routes.with_options :conditions => {:method => :get} do |document_views| | ||||
document_views.connect 'projects/:project_id/documents', :action => 'index' | ||||
document_views.connect 'projects/:project_id/documents/new', :action => 'new' | ||||
document_views.connect 'documents/:id', :action => 'show' | ||||
document_views.connect 'documents/:id/edit', :action => 'edit' | ||||
end | ||||
document_routes.with_options :conditions => {:method => :post} do |document_actions| | ||||
document_actions.connect 'projects/:project_id/documents', :action => 'new' | ||||
document_actions.connect 'documents/:id/:action', :action => /destroy|edit/ | ||||
end | ||||
end | ||||
|
r3822 | |||
map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' | ||||
|
r3927 | |||
# Misc issue routes. TODO: move into resources | ||||
|
r3831 | map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues' | ||
|
r3927 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview | ||
|
r3892 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' | ||
|
r3920 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | ||
|
r3927 | map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get } | ||
map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post } | ||||
map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post } | ||||
map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy | ||||
map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update] | ||||
map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update] | ||||
map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update] | ||||
map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update] | ||||
map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports| | ||||
reports.connect 'projects/:id/issues/report', :action => 'issue_report' | ||||
reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details' | ||||
|
r2315 | end | ||
|
r3822 | |||
|
r3927 | # Following two routes conflict with the resources because #index allows POST | ||
map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | ||||
map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } | ||||
|
r4136 | map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues| | ||
issues.resources :time_entries, :controller => 'timelog' | ||||
end | ||||
map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues| | ||||
issues.resources :time_entries, :controller => 'timelog' | ||||
end | ||||
|
r3927 | |||
|
r2315 | map.with_options :controller => 'issue_relations', :conditions => {:method => :post} do |relations| | ||
relations.connect 'issues/:issue_id/relations/:id', :action => 'new' | ||||
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy' | ||||
end | ||||
|
r4056 | |||
|
r2315 | map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new' | ||
|
r4117 | |||
|
r2315 | map.with_options :controller => 'users' do |users| | ||
|
r4117 | users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} | ||
|
r2315 | users.with_options :conditions => {:method => :post} do |user_actions| | ||
user_actions.connect 'users/:id/memberships', :action => 'edit_membership' | ||||
user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' | ||||
user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership' | ||||
end | ||||
end | ||||
|
r3957 | |||
|
r4117 | map.resources :users, :member => { | ||
:edit_membership => :post, | ||||
:destroy_membership => :post | ||||
}, | ||||
:except => [:destroy] | ||||
|
r3983 | # For nice "roadmap" in the url for the index action | ||
map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' | ||||
|
r4100 | map.all_news 'news', :controller => 'news', :action => 'index' | ||
map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index' | ||||
map.preview_news '/news/preview', :controller => 'previews', :action => 'news' | ||||
map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post} | ||||
map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete} | ||||
|
r3957 | map.resources :projects, :member => { | ||
:copy => [:get, :post], | ||||
:settings => :get, | ||||
:modules => :post, | ||||
:archive => :post, | ||||
:unarchive => :post | ||||
|
r3961 | } do |project| | ||
project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] | ||||
|
r3971 | project.resources :files, :only => [:index, :new, :create] | ||
|
r3984 | project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post} | ||
|
r4100 | project.resources :news, :shallow => true | ||
|
r4136 | project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' | ||
|
r3961 | end | ||
|
r3957 | |||
# Destroy uses a get request to prompt the user before the actual DELETE request | ||||
map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get} | ||||
# TODO: port to be part of the resources route(s) | ||||
map.with_options :controller => 'projects' do |project_mapper| | ||||
project_mapper.with_options :conditions => {:method => :get} do |project_views| | ||||
project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings' | ||||
|
r3927 | project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' | ||
|
r2315 | end | ||
end | ||||
|
r3957 | map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| | ||
activity.connect 'projects/:id/activity' | ||||
activity.connect 'projects/:id/activity.:format' | ||||
activity.connect 'activity', :id => nil | ||||
activity.connect 'activity.:format', :id => nil | ||||
end | ||||
|
r3983 | |||
|
r3957 | |||
|
r3435 | map.with_options :controller => 'issue_categories' do |categories| | ||
categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' | ||||
end | ||||
|
r2315 | map.with_options :controller => 'repositories' do |repositories| | ||
repositories.with_options :conditions => {:method => :get} do |repository_views| | ||||
|
r2513 | repository_views.connect 'projects/:id/repository', :action => 'show' | ||
repository_views.connect 'projects/:id/repository/edit', :action => 'edit' | ||||
repository_views.connect 'projects/:id/repository/statistics', :action => 'stats' | ||||
repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions' | ||||
repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions' | ||||
repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision' | ||||
repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff' | ||||
repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff' | ||||
|
r2960 | repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | ||
|
r2735 | repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } | ||
|
r2960 | repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw' | ||
# TODO: why the following route is required? | ||||
repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' | ||||
|
r2513 | repository_views.connect 'projects/:id/repository/:action/*path' | ||
|
r2315 | end | ||
|
r2522 | repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} | ||
|
r2315 | end | ||
map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ | ||||
map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ | ||||
map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ | ||||
|
r2755 | map.resources :groups | ||
|
r2315 | #left old routes at the bottom for backwards compat | ||
|
r874 | map.connect 'projects/:project_id/issues/:action', :controller => 'issues' | ||
|
r998 | map.connect 'projects/:project_id/documents/:action', :controller => 'documents' | ||
|
r526 | map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards' | ||
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' | ||||
|
r2315 | map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' | ||
map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' | ||||
map.connect 'projects/:project_id/news/:action', :controller => 'news' | ||||
map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ | ||||
|
r867 | map.with_options :controller => 'repositories' do |omap| | ||
omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' | ||||
omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes' | ||||
omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff' | ||||
omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry' | ||||
|
r934 | omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' | ||
|
r2315 | omap.connect 'repositories/revision/:id/:rev', :action => 'revision' | ||
|
r867 | end | ||
|
r2374 | |||
map.with_options :controller => 'sys' do |sys| | ||||
sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} | ||||
sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} | ||||
end | ||||
|
r2 | |||
# Install the default route as the lowest priority. | ||||
map.connect ':controller/:action/:id' | ||||
|
r2317 | map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' | ||
|
r2381 | # Used for OpenID | ||
map.root :controller => 'account', :action => 'login' | ||||
|
r2 | end | ||