Mercurial > hg > soundsoftware-site
diff config/routes.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | bb32da3bea34 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/config/routes.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/config/routes.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,258 +1,346 @@ -ActionController::Routing::Routes.draw do |map| - # Add your own custom routes here. - # The priority is based upon order of creation: first created -> highest priority. +# Redmine - project management software +# Copyright (C) 2006-2012 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - # 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 +RedmineApp::Application.routes.draw do + root :to => 'welcome#index', :as => 'home' - map.home '', :controller => 'welcome' + match 'login', :to => 'account#login', :as => 'signin' + match 'logout', :to => 'account#logout', :as => 'signout' + match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' + match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' + match 'account/activate', :to => 'account#activate', :via => :get - map.signin 'login', :controller => 'account', :action => 'login' - map.signout 'logout', :controller => 'account', :action => 'logout' + match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news' + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue' + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue' + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue' - map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' - map.connect 'help/:ctrl/:page', :controller => 'help' + match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post + match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] - map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report| - time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report' - time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format' - time_report.connect 'projects/:project_id/time_entries/report' - time_report.connect 'projects/:project_id/time_entries/report.:format' - time_report.connect 'time_entries/report' - time_report.connect 'time_entries/report.:format' + match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post] + get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' + match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] + get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + + post 'boards/:board_id/topics/preview', :to => 'messages#preview' + post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' + post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' + + # Misc issue routes. TODO: move into resources + match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' + match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu' + match '/issues/changes', :to => 'journals#index', :as => 'issue_changes' + match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' + + match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get + match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] + + match '/projects/:project_id/issues/gantt', :to => 'gantts#show' + match '/issues/gantt', :to => 'gantts#show' + + match '/projects/:project_id/issues/calendar', :to => 'calendars#show' + match '/issues/calendar', :to => 'calendars#show' + + match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get + match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get + + match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] + match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] + match 'my/page', :controller => 'my', :action => 'page', :via => :get + match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page + match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post + match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post + match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] + match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get + match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post + match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post + match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post + + resources :users + match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' + match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete + match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' + + match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get + match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post + match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post + match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post + match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post + match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post + match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get + + match 'projects/:id/settings/:tab', :to => "projects#settings" + + resources :projects do + member do + get 'settings' + post 'modules' + post 'archive' + post 'unarchive' + post 'close' + post 'reopen' + match 'copy', :via => [:get, :post] + end + + resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do + collection do + get 'autocomplete' + end + end + + resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] + + match 'issues/:copy_from/copy', :to => 'issues#new' + resources :issues, :only => [:index, :new, :create] do + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + end + # issue form update + match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form' + + resources :files, :only => [:index, :new, :create] + + resources :versions, :except => [:index, :show, :edit, :update, :destroy] do + collection do + put 'close_completed' + end + end + match 'versions.:format', :to => 'versions#index' + match 'roadmap', :to => 'versions#index', :format => false + match 'versions', :to => 'versions#index' + + resources :news, :except => [:show, :edit, :update, :destroy] + resources :time_entries, :controller => 'timelog' do + get 'report', :on => :collection + end + resources :queries, :only => [:new, :create] + resources :issue_categories, :shallow => true + resources :documents, :except => [:show, :edit, :update, :destroy] + resources :boards + resources :repositories, :shallow => true, :except => [:index, :show] do + member do + match 'committers', :via => [:get, :post] + end + end + + match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get + resources :wiki, :except => [:index, :new, :create] do + member do + get 'rename' + post 'rename' + get 'history' + get 'diff' + match 'preview', :via => [:post, :put] + post 'protect' + post 'add_attachment' + end + collection do + get 'export' + get 'date_index' + end + end + match 'wiki', :controller => 'wiki', :action => 'show', :via => :get + get 'wiki/:id/:version', :to => 'wiki#show' + delete 'wiki/:id/:version', :to => 'wiki#destroy_version' + get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' + get 'wiki/:id/:version/diff', :to => 'wiki#diff' end - map.bulk_edit_time_entry 'time_entries/bulk_edit', - :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get } - map.bulk_update_time_entry 'time_entries/bulk_edit', - :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' + resources :issues do + collection do + match 'bulk_edit', :via => [:get, :post] + post 'bulk_update' + end + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] + end + match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete - 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} + resources :queries, :except => [:show] - 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' + resources :news, :only => [:index, :show, :edit, :update, :destroy] + match '/news/:id/comments', :to => 'comments#create', :via => :post + match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete + + resources :versions, :only => [:show, :edit, :update, :destroy] do + post 'status_by', :on => :member + end + + resources :documents, :only => [:show, :edit, :update, :destroy] do + post 'add_attachment', :on => :member + end + + match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu + + resources :time_entries, :controller => 'timelog', :except => :destroy do + collection do + get 'report' + get 'bulk_edit' + post 'bulk_update' 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 + match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ + # TODO: delete /time_entries for bulk deletion + match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete + + # TODO: port to be part of the resources route(s) + match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get + + get 'projects/:id/activity', :to => 'activities#index' + get 'projects/:id/activity.:format', :to => 'activities#index' + get 'activity', :to => 'activities#index' + + # repositories routes + get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', + :to => 'repositories#changes' + + get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' + post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + + get 'projects/:id/repository/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/changes(/*path(.:ext))', + :to => 'repositories#changes' + + get 'projects/:id/repository/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/revision', :to => 'repositories#revision' + post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff)/ + get 'projects/:id/repository/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff)/ + + get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil + get 'projects/:id/repository', :to => 'repositories#show', :path => nil + + # additional routes for having the file name at the end of url + match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get + match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get + match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get + match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/ + resources :attachments, :only => [:show, :destroy] + + resources :groups do + member do + get 'autocomplete_for_user' 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' - board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' - board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' + match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' + match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' + match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post + match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post + + resources :trackers, :except => :show do + collection do + match 'fields', :via => [:get, :post] 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 + resources :issue_statuses, :except => :show do + collection do + post 'update_issue_done_ratio' + end + end + resources :custom_fields, :except => :show + resources :roles do + collection do + match 'permissions', :via => [:get, :post] + end + end + resources :enumerations, :except => :show + match 'enumerations/:type', :to => 'enumerations#index', :via => :get + + get 'projects/:id/search', :controller => 'search', :action => 'index' + get 'search', :controller => 'search', :action => 'index' + + match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post + + match 'admin', :controller => 'admin', :action => 'index', :via => :get + match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get + match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get + match 'admin/info', :controller => 'admin', :action => 'info', :via => :get + match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get + match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post + + resources :auth_sources do + member do + get 'test_connection' 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/ + match 'workflows', :controller => 'workflows', :action => 'index', :via => :get + match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] + match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] + match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] + match 'settings', :controller => 'settings', :action => 'index', :via => :get + match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] + match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post] + + match 'sys/projects', :to => 'sys#projects', :via => :get + match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post + match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get + + match 'uploads', :to => 'attachments#upload', :via => :post + + get 'robots.txt', :to => 'welcome#robots' + + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| + file = File.join(plugin_dir, "config/routes.rb") + if File.exists?(file) + begin + instance_eval File.read(file) + rescue Exception => e + puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." + exit 1 + end end end - - map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move' - map.resources :queries, :except => [:show] - - # Misc issue routes. TODO: move into resources - map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get } - map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview - map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' - map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' - 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.with_options :controller => 'gantts', :action => 'show' do |gantts_routes| - gantts_routes.connect '/projects/:project_id/issues/gantt' - gantts_routes.connect '/projects/:project_id/issues/gantt.:format' - gantts_routes.connect '/issues/gantt.:format' - end - - map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes| - calendars_routes.connect '/projects/:project_id/issues/calendar' - calendars_routes.connect '/issues/calendar' - end - - 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' - end - - # 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 } - - map.resources :issues, :member => { :edit => :post }, :collection => {} 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| - users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} - - 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 - - map.resources :users, :member => { - :edit_membership => :post, - :destroy_membership => :post - } - - # For nice "roadmap" in the url for the index action - map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index' - - 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} - - map.resources :projects, :member => { - :copy => [:get, :post], - :settings => :get, - :modules => :post, - :archive => :post, - :unarchive => :post - } do |project| - project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy] - 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 - project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id' - project.resources :queries, :only => [:new, :create] - project.resources :issue_categories, :shallow => true - - 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', :controller => 'wiki', :action => 'diff', :version => nil - 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 - 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' - project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' - end - end - - 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 - - map.with_options :controller => 'repositories' do |repositories| - repositories.with_options :conditions => {:method => :get} do |repository_views| - 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' - repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ } - repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ } - 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' - repository_views.connect 'projects/:id/repository/:action/*path' - end - - repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} - end - - map.resources :attachments, :only => [:show, :destroy] - # additional routes for having the file name at the end of url - 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 => /.*/ - - map.resources :groups, :member => {:autocomplete_for_user => :get} - map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post} - map.group_user 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete} - - map.resources :trackers, :except => :show - 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/documents/:action', :controller => 'documents' - 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' - map.connect 'projects/:project_id/news/:action', :controller => 'news' - map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ - 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' - omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' - omap.connect 'repositories/revision/:id/:rev', :action => 'revision' - end - - 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 - - # Install the default route as the lowest priority. - map.connect ':controller/:action/:id' - map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' - # Used for OpenID - map.root :controller => 'account', :action => 'login' end