annotate config/routes.rb @ 1295:622f24f53b42 redmine-2.3

Update to Redmine SVN revision 11972 on 2.3-stable branch
author Chris Cannam
date Fri, 14 Jun 2013 09:02:21 +0100
parents 433d4f72a19b
children 4f746d8966dd
rev   line source
Chris@1115 1 # Redmine - project management software
Chris@1295 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
Chris@1115 3 #
Chris@1115 4 # This program is free software; you can redistribute it and/or
Chris@1115 5 # modify it under the terms of the GNU General Public License
Chris@1115 6 # as published by the Free Software Foundation; either version 2
Chris@1115 7 # of the License, or (at your option) any later version.
Chris@1115 8 #
Chris@1115 9 # This program is distributed in the hope that it will be useful,
Chris@1115 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1115 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1115 12 # GNU General Public License for more details.
Chris@1115 13 #
Chris@1115 14 # You should have received a copy of the GNU General Public License
Chris@1115 15 # along with this program; if not, write to the Free Software
Chris@1115 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@909 17
Chris@1115 18 RedmineApp::Application.routes.draw do
Chris@1115 19 root :to => 'welcome#index', :as => 'home'
Chris@0 20
Chris@1295 21 match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
Chris@1295 22 match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
Chris@1115 23 match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
Chris@1115 24 match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
Chris@1115 25 match 'account/activate', :to => 'account#activate', :via => :get
Chris@909 26
Chris@1295 27 match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
Chris@1295 28 match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
Chris@1295 29 match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
Chris@1295 30 match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
Chris@909 31
Chris@1115 32 match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
Chris@1115 33 match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
Chris@0 34
Chris@1295 35 match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
Chris@1115 36 get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
Chris@1115 37 match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
Chris@1115 38 get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
Chris@1115 39
Chris@1295 40 post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
Chris@1115 41 post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
Chris@1115 42 post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
Chris@1115 43 post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
Chris@1115 44
Chris@1115 45 # Misc issue routes. TODO: move into resources
Chris@1115 46 match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
Chris@1295 47 match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post]
Chris@1295 48 match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get
Chris@1115 49 match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
Chris@1115 50
Chris@1115 51 match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
Chris@1115 52 match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
Chris@1115 53
Chris@1295 54 get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
Chris@1295 55 get '/issues/gantt', :to => 'gantts#show'
Chris@1115 56
Chris@1295 57 get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar'
Chris@1295 58 get '/issues/calendar', :to => 'calendars#show'
Chris@1115 59
Chris@1295 60 get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
Chris@1295 61 get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
Chris@1115 62
Chris@1115 63 match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
Chris@1115 64 match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
Chris@1115 65 match 'my/page', :controller => 'my', :action => 'page', :via => :get
Chris@1115 66 match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
Chris@1115 67 match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
Chris@1115 68 match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
Chris@1115 69 match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
Chris@1115 70 match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
Chris@1115 71 match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
Chris@1115 72 match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
Chris@1115 73 match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
Chris@1115 74
Chris@1115 75 resources :users
Chris@1115 76 match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
Chris@1115 77 match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
Chris@1115 78 match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
Chris@1115 79
Chris@1295 80 post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
Chris@1295 81 delete 'watchers/watch', :to => 'watchers#unwatch'
Chris@1295 82 get 'watchers/new', :to => 'watchers#new'
Chris@1295 83 post 'watchers', :to => 'watchers#create'
Chris@1295 84 post 'watchers/append', :to => 'watchers#append'
Chris@1295 85 delete 'watchers', :to => 'watchers#destroy'
Chris@1295 86 get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
Chris@1295 87 # Specific routes for issue watchers API
Chris@1295 88 post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
Chris@1295 89 delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
Chris@1115 90
Chris@1115 91 resources :projects do
Chris@1115 92 member do
Chris@1295 93 get 'settings(/:tab)', :action => 'settings', :as => 'settings'
Chris@1115 94 post 'modules'
Chris@1115 95 post 'archive'
Chris@1115 96 post 'unarchive'
Chris@1115 97 post 'close'
Chris@1115 98 post 'reopen'
Chris@1115 99 match 'copy', :via => [:get, :post]
Chris@1115 100 end
Chris@1115 101
Chris@1295 102 shallow do
Chris@1295 103 resources :memberships, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
Chris@1295 104 collection do
Chris@1295 105 get 'autocomplete'
Chris@1295 106 end
Chris@1115 107 end
Chris@1115 108 end
Chris@1115 109
Chris@1115 110 resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
Chris@1115 111
Chris@1295 112 get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue'
Chris@1115 113 resources :issues, :only => [:index, :new, :create] do
Chris@1115 114 resources :time_entries, :controller => 'timelog' do
Chris@1115 115 collection do
Chris@1115 116 get 'report'
Chris@1115 117 end
Chris@1115 118 end
Chris@1115 119 end
Chris@1115 120 # issue form update
Chris@1295 121 match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
Chris@1115 122
Chris@1115 123 resources :files, :only => [:index, :new, :create]
Chris@1115 124
Chris@1115 125 resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
Chris@1115 126 collection do
Chris@1115 127 put 'close_completed'
Chris@1115 128 end
Chris@1115 129 end
Chris@1295 130 get 'versions.:format', :to => 'versions#index'
Chris@1295 131 get 'roadmap', :to => 'versions#index', :format => false
Chris@1295 132 get 'versions', :to => 'versions#index'
Chris@1115 133
Chris@1115 134 resources :news, :except => [:show, :edit, :update, :destroy]
Chris@1115 135 resources :time_entries, :controller => 'timelog' do
Chris@1115 136 get 'report', :on => :collection
Chris@1115 137 end
Chris@1115 138 resources :queries, :only => [:new, :create]
Chris@1295 139 shallow do
Chris@1295 140 resources :issue_categories
Chris@1295 141 end
Chris@1115 142 resources :documents, :except => [:show, :edit, :update, :destroy]
Chris@1115 143 resources :boards
Chris@1295 144 shallow do
Chris@1295 145 resources :repositories, :except => [:index, :show] do
Chris@1295 146 member do
Chris@1295 147 match 'committers', :via => [:get, :post]
Chris@1295 148 end
Chris@1115 149 end
Chris@1115 150 end
Chris@1295 151
Chris@1115 152 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
Chris@1295 153 resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
Chris@1115 154 member do
Chris@1115 155 get 'rename'
Chris@1115 156 post 'rename'
Chris@1115 157 get 'history'
Chris@1115 158 get 'diff'
Chris@1115 159 match 'preview', :via => [:post, :put]
Chris@1115 160 post 'protect'
Chris@1115 161 post 'add_attachment'
Chris@1115 162 end
Chris@1115 163 collection do
Chris@1115 164 get 'export'
Chris@1115 165 get 'date_index'
Chris@1115 166 end
Chris@1115 167 end
Chris@1115 168 match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
Chris@1295 169 get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
Chris@1115 170 delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
Chris@1115 171 get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
Chris@1115 172 get 'wiki/:id/:version/diff', :to => 'wiki#diff'
Chris@0 173 end
chris@37 174
Chris@1115 175 resources :issues do
Chris@1115 176 collection do
Chris@1115 177 match 'bulk_edit', :via => [:get, :post]
Chris@1115 178 post 'bulk_update'
Chris@1115 179 end
Chris@1115 180 resources :time_entries, :controller => 'timelog' do
Chris@1115 181 collection do
Chris@1115 182 get 'report'
Chris@1115 183 end
Chris@1115 184 end
Chris@1295 185 shallow do
Chris@1295 186 resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
Chris@1295 187 end
Chris@1115 188 end
Chris@1115 189 match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
Chris@909 190
Chris@1115 191 resources :queries, :except => [:show]
Chris@909 192
Chris@1115 193 resources :news, :only => [:index, :show, :edit, :update, :destroy]
Chris@1115 194 match '/news/:id/comments', :to => 'comments#create', :via => :post
Chris@1115 195 match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
Chris@1115 196
Chris@1115 197 resources :versions, :only => [:show, :edit, :update, :destroy] do
Chris@1115 198 post 'status_by', :on => :member
Chris@1115 199 end
Chris@1115 200
Chris@1115 201 resources :documents, :only => [:show, :edit, :update, :destroy] do
Chris@1115 202 post 'add_attachment', :on => :member
Chris@1115 203 end
Chris@1115 204
Chris@1295 205 match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
Chris@1115 206
Chris@1115 207 resources :time_entries, :controller => 'timelog', :except => :destroy do
Chris@1115 208 collection do
Chris@1115 209 get 'report'
Chris@1115 210 get 'bulk_edit'
Chris@1115 211 post 'bulk_update'
Chris@0 212 end
Chris@1115 213 end
Chris@1115 214 match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
Chris@1115 215 # TODO: delete /time_entries for bulk deletion
Chris@1115 216 match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
Chris@1115 217
Chris@1115 218 get 'projects/:id/activity', :to => 'activities#index'
Chris@1115 219 get 'projects/:id/activity.:format', :to => 'activities#index'
Chris@1115 220 get 'activity', :to => 'activities#index'
Chris@1115 221
Chris@1115 222 # repositories routes
Chris@1115 223 get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
Chris@1115 224 get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
Chris@1115 225
Chris@1115 226 get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
Chris@1115 227 :to => 'repositories#changes'
Chris@1115 228
Chris@1115 229 get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
Chris@1115 230 get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
Chris@1115 231 post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 232 delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 233 get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
Chris@1115 234 get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 235 :controller => 'repositories',
Chris@1115 236 :format => false,
Chris@1115 237 :constraints => {
Chris@1115 238 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 239 :rev => /[a-z0-9\.\-_]+/
Chris@1115 240 }
Chris@1115 241
Chris@1115 242 get 'projects/:id/repository/statistics', :to => 'repositories#stats'
Chris@1115 243 get 'projects/:id/repository/graph', :to => 'repositories#graph'
Chris@1115 244
Chris@1115 245 get 'projects/:id/repository/changes(/*path(.:ext))',
Chris@1115 246 :to => 'repositories#changes'
Chris@1115 247
Chris@1115 248 get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
Chris@1115 249 get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
Chris@1115 250 get 'projects/:id/repository/revision', :to => 'repositories#revision'
Chris@1115 251 post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 252 delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 253 get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 254 :controller => 'repositories',
Chris@1115 255 :format => false,
Chris@1115 256 :constraints => {
Chris@1115 257 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 258 :rev => /[a-z0-9\.\-_]+/
Chris@1115 259 }
Chris@1115 260 get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
Chris@1115 261 :controller => 'repositories',
Chris@1115 262 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 263 get 'projects/:id/repository/:action(/*path(.:ext))',
Chris@1115 264 :controller => 'repositories',
Chris@1115 265 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 266
Chris@1115 267 get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
Chris@1115 268 get 'projects/:id/repository', :to => 'repositories#show', :path => nil
Chris@1115 269
Chris@1115 270 # additional routes for having the file name at the end of url
Chris@1295 271 get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
Chris@1295 272 get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
Chris@1295 273 get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
Chris@1295 274 get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
Chris@1115 275 resources :attachments, :only => [:show, :destroy]
Chris@1115 276
Chris@1115 277 resources :groups do
Chris@1115 278 member do
Chris@1115 279 get 'autocomplete_for_user'
Chris@0 280 end
Chris@0 281 end
Chris@909 282
Chris@1115 283 match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
Chris@1115 284 match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
Chris@1115 285 match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
Chris@1115 286 match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
Chris@1115 287
Chris@1115 288 resources :trackers, :except => :show do
Chris@1115 289 collection do
Chris@1115 290 match 'fields', :via => [:get, :post]
Chris@0 291 end
Chris@1115 292 end
Chris@1115 293 resources :issue_statuses, :except => :show do
Chris@1115 294 collection do
Chris@1115 295 post 'update_issue_done_ratio'
Chris@1115 296 end
Chris@1115 297 end
Chris@1115 298 resources :custom_fields, :except => :show
Chris@1115 299 resources :roles do
Chris@1115 300 collection do
Chris@1115 301 match 'permissions', :via => [:get, :post]
Chris@1115 302 end
Chris@1115 303 end
Chris@1115 304 resources :enumerations, :except => :show
Chris@1115 305 match 'enumerations/:type', :to => 'enumerations#index', :via => :get
Chris@1115 306
Chris@1115 307 get 'projects/:id/search', :controller => 'search', :action => 'index'
Chris@1115 308 get 'search', :controller => 'search', :action => 'index'
Chris@1115 309
Chris@1115 310 match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
Chris@1115 311
Chris@1115 312 match 'admin', :controller => 'admin', :action => 'index', :via => :get
Chris@1115 313 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
Chris@1115 314 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
Chris@1115 315 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
Chris@1115 316 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
Chris@1115 317 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
Chris@1115 318
Chris@1115 319 resources :auth_sources do
Chris@1115 320 member do
Chris@1295 321 get 'test_connection', :as => 'try_connection'
Chris@1295 322 end
Chris@1295 323 collection do
Chris@1295 324 get 'autocomplete_for_new_user'
Chris@0 325 end
Chris@0 326 end
Chris@909 327
Chris@1115 328 match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
Chris@1115 329 match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
Chris@1115 330 match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
Chris@1115 331 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
Chris@1115 332 match 'settings', :controller => 'settings', :action => 'index', :via => :get
Chris@1115 333 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
Chris@1295 334 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
Chris@1115 335
Chris@1115 336 match 'sys/projects', :to => 'sys#projects', :via => :get
Chris@1115 337 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
Chris@1115 338 match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
Chris@1115 339
Chris@1115 340 match 'uploads', :to => 'attachments#upload', :via => :post
Chris@1115 341
Chris@1115 342 get 'robots.txt', :to => 'welcome#robots'
Chris@1115 343
Chris@1115 344 Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
Chris@1115 345 file = File.join(plugin_dir, "config/routes.rb")
Chris@1115 346 if File.exists?(file)
Chris@1115 347 begin
Chris@1115 348 instance_eval File.read(file)
Chris@1115 349 rescue Exception => e
Chris@1115 350 puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
Chris@1115 351 exit 1
Chris@1115 352 end
Chris@0 353 end
Chris@0 354 end
Chris@0 355 end