annotate config/routes.rb @ 1296:038ba2d95de8 redmine-2.2

Fix redmine-2.2 branch update (add missing svn files)
author Chris Cannam
date Fri, 14 Jun 2013 09:05:06 +0100
parents 433d4f72a19b
children bb32da3bea34 622f24f53b42 261b3d9a4903
rev   line source
Chris@1115 1 # Redmine - project management software
Chris@1115 2 # Copyright (C) 2006-2012 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@1115 21 match 'login', :to => 'account#login', :as => 'signin'
Chris@1115 22 match 'logout', :to => 'account#logout', :as => 'signout'
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@1115 27 match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news'
Chris@1115 28 match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue'
Chris@1115 29 match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue'
Chris@1115 30 match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue'
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@1115 35 match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post]
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@1115 40 post 'boards/:board_id/topics/preview', :to => 'messages#preview'
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@1115 47 match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu'
Chris@1115 48 match '/issues/changes', :to => 'journals#index', :as => 'issue_changes'
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@1115 54 match '/projects/:project_id/issues/gantt', :to => 'gantts#show'
Chris@1115 55 match '/issues/gantt', :to => 'gantts#show'
Chris@1115 56
Chris@1115 57 match '/projects/:project_id/issues/calendar', :to => 'calendars#show'
Chris@1115 58 match '/issues/calendar', :to => 'calendars#show'
Chris@1115 59
Chris@1115 60 match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get
Chris@1115 61 match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get
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@1115 80 match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get
Chris@1115 81 match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post
Chris@1115 82 match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post
Chris@1115 83 match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post
Chris@1115 84 match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post
Chris@1115 85 match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post
Chris@1115 86 match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get
Chris@1115 87
Chris@1115 88 match 'projects/:id/settings/:tab', :to => "projects#settings"
Chris@1115 89
Chris@1115 90 resources :projects do
Chris@1115 91 member do
Chris@1115 92 get 'settings'
Chris@1115 93 post 'modules'
Chris@1115 94 post 'archive'
Chris@1115 95 post 'unarchive'
Chris@1115 96 post 'close'
Chris@1115 97 post 'reopen'
Chris@1115 98 match 'copy', :via => [:get, :post]
Chris@1115 99 end
Chris@1115 100
Chris@1115 101 resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
Chris@1115 102 collection do
Chris@1115 103 get 'autocomplete'
Chris@1115 104 end
Chris@1115 105 end
Chris@1115 106
Chris@1115 107 resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
Chris@1115 108
Chris@1115 109 match 'issues/:copy_from/copy', :to => 'issues#new'
Chris@1115 110 resources :issues, :only => [:index, :new, :create] do
Chris@1115 111 resources :time_entries, :controller => 'timelog' do
Chris@1115 112 collection do
Chris@1115 113 get 'report'
Chris@1115 114 end
Chris@1115 115 end
Chris@1115 116 end
Chris@1115 117 # issue form update
Chris@1115 118 match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form'
Chris@1115 119
Chris@1115 120 resources :files, :only => [:index, :new, :create]
Chris@1115 121
Chris@1115 122 resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
Chris@1115 123 collection do
Chris@1115 124 put 'close_completed'
Chris@1115 125 end
Chris@1115 126 end
Chris@1115 127 match 'versions.:format', :to => 'versions#index'
Chris@1115 128 match 'roadmap', :to => 'versions#index', :format => false
Chris@1115 129 match 'versions', :to => 'versions#index'
Chris@1115 130
Chris@1115 131 resources :news, :except => [:show, :edit, :update, :destroy]
Chris@1115 132 resources :time_entries, :controller => 'timelog' do
Chris@1115 133 get 'report', :on => :collection
Chris@1115 134 end
Chris@1115 135 resources :queries, :only => [:new, :create]
Chris@1115 136 resources :issue_categories, :shallow => true
Chris@1115 137 resources :documents, :except => [:show, :edit, :update, :destroy]
Chris@1115 138 resources :boards
Chris@1115 139 resources :repositories, :shallow => true, :except => [:index, :show] do
Chris@1115 140 member do
Chris@1115 141 match 'committers', :via => [:get, :post]
Chris@1115 142 end
Chris@1115 143 end
Chris@1115 144
Chris@1115 145 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
Chris@1115 146 resources :wiki, :except => [:index, :new, :create] do
Chris@1115 147 member do
Chris@1115 148 get 'rename'
Chris@1115 149 post 'rename'
Chris@1115 150 get 'history'
Chris@1115 151 get 'diff'
Chris@1115 152 match 'preview', :via => [:post, :put]
Chris@1115 153 post 'protect'
Chris@1115 154 post 'add_attachment'
Chris@1115 155 end
Chris@1115 156 collection do
Chris@1115 157 get 'export'
Chris@1115 158 get 'date_index'
Chris@1115 159 end
Chris@1115 160 end
Chris@1115 161 match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
Chris@1115 162 get 'wiki/:id/:version', :to => 'wiki#show'
Chris@1115 163 delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
Chris@1115 164 get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
Chris@1115 165 get 'wiki/:id/:version/diff', :to => 'wiki#diff'
Chris@0 166 end
chris@37 167
Chris@1115 168 resources :issues do
Chris@1115 169 collection do
Chris@1115 170 match 'bulk_edit', :via => [:get, :post]
Chris@1115 171 post 'bulk_update'
Chris@1115 172 end
Chris@1115 173 resources :time_entries, :controller => 'timelog' do
Chris@1115 174 collection do
Chris@1115 175 get 'report'
Chris@1115 176 end
Chris@1115 177 end
Chris@1115 178 resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
Chris@1115 179 end
Chris@1115 180 match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
Chris@909 181
Chris@1115 182 resources :queries, :except => [:show]
Chris@909 183
Chris@1115 184 resources :news, :only => [:index, :show, :edit, :update, :destroy]
Chris@1115 185 match '/news/:id/comments', :to => 'comments#create', :via => :post
Chris@1115 186 match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
Chris@1115 187
Chris@1115 188 resources :versions, :only => [:show, :edit, :update, :destroy] do
Chris@1115 189 post 'status_by', :on => :member
Chris@1115 190 end
Chris@1115 191
Chris@1115 192 resources :documents, :only => [:show, :edit, :update, :destroy] do
Chris@1115 193 post 'add_attachment', :on => :member
Chris@1115 194 end
Chris@1115 195
Chris@1115 196 match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu
Chris@1115 197
Chris@1115 198 resources :time_entries, :controller => 'timelog', :except => :destroy do
Chris@1115 199 collection do
Chris@1115 200 get 'report'
Chris@1115 201 get 'bulk_edit'
Chris@1115 202 post 'bulk_update'
Chris@0 203 end
Chris@1115 204 end
Chris@1115 205 match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
Chris@1115 206 # TODO: delete /time_entries for bulk deletion
Chris@1115 207 match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
Chris@1115 208
Chris@1115 209 # TODO: port to be part of the resources route(s)
Chris@1115 210 match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get
Chris@1115 211
Chris@1115 212 get 'projects/:id/activity', :to => 'activities#index'
Chris@1115 213 get 'projects/:id/activity.:format', :to => 'activities#index'
Chris@1115 214 get 'activity', :to => 'activities#index'
Chris@1115 215
Chris@1115 216 # repositories routes
Chris@1115 217 get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
Chris@1115 218 get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
Chris@1115 219
Chris@1115 220 get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
Chris@1115 221 :to => 'repositories#changes'
Chris@1115 222
Chris@1115 223 get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
Chris@1115 224 get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
Chris@1115 225 post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 226 delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 227 get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
Chris@1115 228 get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 229 :controller => 'repositories',
Chris@1115 230 :format => false,
Chris@1115 231 :constraints => {
Chris@1115 232 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 233 :rev => /[a-z0-9\.\-_]+/
Chris@1115 234 }
Chris@1115 235
Chris@1115 236 get 'projects/:id/repository/statistics', :to => 'repositories#stats'
Chris@1115 237 get 'projects/:id/repository/graph', :to => 'repositories#graph'
Chris@1115 238
Chris@1115 239 get 'projects/:id/repository/changes(/*path(.:ext))',
Chris@1115 240 :to => 'repositories#changes'
Chris@1115 241
Chris@1115 242 get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
Chris@1115 243 get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
Chris@1115 244 get 'projects/:id/repository/revision', :to => 'repositories#revision'
Chris@1115 245 post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 246 delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 247 get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 248 :controller => 'repositories',
Chris@1115 249 :format => false,
Chris@1115 250 :constraints => {
Chris@1115 251 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 252 :rev => /[a-z0-9\.\-_]+/
Chris@1115 253 }
Chris@1115 254 get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
Chris@1115 255 :controller => 'repositories',
Chris@1115 256 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 257 get 'projects/:id/repository/:action(/*path(.:ext))',
Chris@1115 258 :controller => 'repositories',
Chris@1115 259 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 260
Chris@1115 261 get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
Chris@1115 262 get 'projects/:id/repository', :to => 'repositories#show', :path => nil
Chris@1115 263
Chris@1115 264 # additional routes for having the file name at the end of url
Chris@1115 265 match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get
Chris@1115 266 match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get
Chris@1115 267 match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get
Chris@1115 268 match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/
Chris@1115 269 resources :attachments, :only => [:show, :destroy]
Chris@1115 270
Chris@1115 271 resources :groups do
Chris@1115 272 member do
Chris@1115 273 get 'autocomplete_for_user'
Chris@0 274 end
Chris@0 275 end
Chris@909 276
Chris@1115 277 match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
Chris@1115 278 match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
Chris@1115 279 match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
Chris@1115 280 match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
Chris@1115 281
Chris@1115 282 resources :trackers, :except => :show do
Chris@1115 283 collection do
Chris@1115 284 match 'fields', :via => [:get, :post]
Chris@0 285 end
Chris@1115 286 end
Chris@1115 287 resources :issue_statuses, :except => :show do
Chris@1115 288 collection do
Chris@1115 289 post 'update_issue_done_ratio'
Chris@1115 290 end
Chris@1115 291 end
Chris@1115 292 resources :custom_fields, :except => :show
Chris@1115 293 resources :roles do
Chris@1115 294 collection do
Chris@1115 295 match 'permissions', :via => [:get, :post]
Chris@1115 296 end
Chris@1115 297 end
Chris@1115 298 resources :enumerations, :except => :show
Chris@1115 299 match 'enumerations/:type', :to => 'enumerations#index', :via => :get
Chris@1115 300
Chris@1115 301 get 'projects/:id/search', :controller => 'search', :action => 'index'
Chris@1115 302 get 'search', :controller => 'search', :action => 'index'
Chris@1115 303
Chris@1115 304 match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
Chris@1115 305
Chris@1115 306 match 'admin', :controller => 'admin', :action => 'index', :via => :get
Chris@1115 307 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
Chris@1115 308 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
Chris@1115 309 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
Chris@1115 310 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
Chris@1115 311 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
Chris@1115 312
Chris@1115 313 resources :auth_sources do
Chris@1115 314 member do
Chris@1115 315 get 'test_connection'
Chris@0 316 end
Chris@0 317 end
Chris@909 318
Chris@1115 319 match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
Chris@1115 320 match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
Chris@1115 321 match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
Chris@1115 322 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
Chris@1115 323 match 'settings', :controller => 'settings', :action => 'index', :via => :get
Chris@1115 324 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
Chris@1115 325 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
Chris@1115 326
Chris@1115 327 match 'sys/projects', :to => 'sys#projects', :via => :get
Chris@1115 328 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
Chris@1115 329 match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
Chris@1115 330
Chris@1115 331 match 'uploads', :to => 'attachments#upload', :via => :post
Chris@1115 332
Chris@1115 333 get 'robots.txt', :to => 'welcome#robots'
Chris@1115 334
Chris@1115 335 Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
Chris@1115 336 file = File.join(plugin_dir, "config/routes.rb")
Chris@1115 337 if File.exists?(file)
Chris@1115 338 begin
Chris@1115 339 instance_eval File.read(file)
Chris@1115 340 rescue Exception => e
Chris@1115 341 puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
Chris@1115 342 exit 1
Chris@1115 343 end
Chris@0 344 end
Chris@0 345 end
Chris@0 346 end