annotate config/routes.rb @ 1480:75fd8eace091 issue_556

Close obsolete branch issue_556
author Chris Cannam
date Sat, 13 Jul 2013 15:26:30 +0100
parents 9397280c138c
children 3db88d605fa7
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"
luis@1245 89 match 'projects/:id/overview', :to => "projects#overview"
Chris@1115 90
Chris@1115 91 resources :projects do
Chris@1115 92 member do
Chris@1115 93 get '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@1141 102 resources :members, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
chris@1141 103 collection do
chris@1141 104 get 'autocomplete'
chris@1141 105 end
chris@1141 106 end
Chris@1115 107 resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
Chris@1115 108 collection do
Chris@1115 109 get 'autocomplete'
Chris@1115 110 end
Chris@1115 111 end
Chris@1115 112
Chris@1115 113 resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
Chris@1115 114
Chris@1115 115 match 'issues/:copy_from/copy', :to => 'issues#new'
Chris@1115 116 resources :issues, :only => [:index, :new, :create] do
Chris@1115 117 resources :time_entries, :controller => 'timelog' do
Chris@1115 118 collection do
Chris@1115 119 get 'report'
Chris@1115 120 end
Chris@1115 121 end
Chris@1115 122 end
Chris@1115 123 # issue form update
Chris@1115 124 match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form'
Chris@1115 125
Chris@1115 126 resources :files, :only => [:index, :new, :create]
Chris@1115 127
Chris@1115 128 resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
Chris@1115 129 collection do
Chris@1115 130 put 'close_completed'
Chris@1115 131 end
Chris@1115 132 end
Chris@1115 133 match 'versions.:format', :to => 'versions#index'
Chris@1115 134 match 'roadmap', :to => 'versions#index', :format => false
Chris@1115 135 match 'versions', :to => 'versions#index'
Chris@1115 136
Chris@1115 137 resources :news, :except => [:show, :edit, :update, :destroy]
Chris@1115 138 resources :time_entries, :controller => 'timelog' do
Chris@1115 139 get 'report', :on => :collection
Chris@1115 140 end
Chris@1115 141 resources :queries, :only => [:new, :create]
Chris@1115 142 resources :issue_categories, :shallow => true
Chris@1115 143 resources :documents, :except => [:show, :edit, :update, :destroy]
Chris@1115 144 resources :boards
Chris@1115 145 resources :repositories, :shallow => true, :except => [:index, :show] do
Chris@1115 146 member do
Chris@1115 147 match 'committers', :via => [:get, :post]
Chris@1115 148 end
Chris@1115 149 end
Chris@1115 150
Chris@1115 151 match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
Chris@1115 152 resources :wiki, :except => [:index, :new, :create] do
Chris@1115 153 member do
Chris@1115 154 get 'rename'
Chris@1115 155 post 'rename'
Chris@1115 156 get 'history'
Chris@1115 157 get 'diff'
Chris@1115 158 match 'preview', :via => [:post, :put]
Chris@1115 159 post 'protect'
Chris@1115 160 post 'add_attachment'
Chris@1115 161 end
Chris@1115 162 collection do
Chris@1115 163 get 'export'
Chris@1115 164 get 'date_index'
Chris@1115 165 end
Chris@1115 166 end
Chris@1115 167 match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
Chris@1115 168 get 'wiki/:id/:version', :to => 'wiki#show'
Chris@1115 169 delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
Chris@1115 170 get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
Chris@1115 171 get 'wiki/:id/:version/diff', :to => 'wiki#diff'
Chris@0 172 end
chris@37 173
Chris@1115 174 resources :issues do
Chris@1115 175 collection do
Chris@1115 176 match 'bulk_edit', :via => [:get, :post]
Chris@1115 177 post 'bulk_update'
Chris@1115 178 end
Chris@1115 179 resources :time_entries, :controller => 'timelog' do
Chris@1115 180 collection do
Chris@1115 181 get 'report'
Chris@1115 182 end
Chris@1115 183 end
Chris@1115 184 resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
Chris@1115 185 end
Chris@1115 186 match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
Chris@909 187
luis@1129 188 # changed this route to ensure compatibility with Rails 3 --lf.20130109
luis@1129 189 match 'explore' => 'projects#explore'
chris@1007 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@1115 205 match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu
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 # TODO: port to be part of the resources route(s)
Chris@1115 219 match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get
Chris@1115 220
Chris@1115 221 get 'projects/:id/activity', :to => 'activities#index'
Chris@1115 222 get 'projects/:id/activity.:format', :to => 'activities#index'
Chris@1115 223 get 'activity', :to => 'activities#index'
Chris@1115 224
Chris@1115 225 # repositories routes
Chris@1115 226 get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
Chris@1115 227 get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
Chris@1115 228
Chris@1115 229 get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
Chris@1115 230 :to => 'repositories#changes'
Chris@1115 231
Chris@1115 232 get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
Chris@1115 233 get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
Chris@1115 234 post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 235 delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 236 get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
Chris@1115 237 get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 238 :controller => 'repositories',
Chris@1115 239 :format => false,
Chris@1115 240 :constraints => {
Chris@1115 241 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 242 :rev => /[a-z0-9\.\-_]+/
Chris@1115 243 }
Chris@1115 244
Chris@1115 245 get 'projects/:id/repository/statistics', :to => 'repositories#stats'
Chris@1115 246 get 'projects/:id/repository/graph', :to => 'repositories#graph'
Chris@1115 247
Chris@1115 248 get 'projects/:id/repository/changes(/*path(.:ext))',
Chris@1115 249 :to => 'repositories#changes'
Chris@1115 250
Chris@1115 251 get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
Chris@1115 252 get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
Chris@1115 253 get 'projects/:id/repository/revision', :to => 'repositories#revision'
Chris@1115 254 post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
Chris@1115 255 delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
Chris@1115 256 get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
Chris@1115 257 :controller => 'repositories',
Chris@1115 258 :format => false,
Chris@1115 259 :constraints => {
Chris@1115 260 :action => /(browse|show|entry|raw|annotate|diff)/,
Chris@1115 261 :rev => /[a-z0-9\.\-_]+/
Chris@1115 262 }
Chris@1115 263 get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
Chris@1115 264 :controller => 'repositories',
Chris@1115 265 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 266 get 'projects/:id/repository/:action(/*path(.:ext))',
Chris@1115 267 :controller => 'repositories',
Chris@1115 268 :action => /(browse|show|entry|raw|changes|annotate|diff)/
Chris@1115 269
Chris@1115 270 get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
Chris@1115 271 get 'projects/:id/repository', :to => 'repositories#show', :path => nil
Chris@1115 272
Chris@1115 273 # additional routes for having the file name at the end of url
Chris@1115 274 match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get
Chris@1115 275 match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get
Chris@1115 276 match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get
chris@1153 277 match 'attachments/toggle_active/:id', :controller => 'attachments', :action => 'toggle_active', :id => /\d+/, :via => :get
Chris@1115 278 match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/
Chris@1115 279 resources :attachments, :only => [:show, :destroy]
Chris@1115 280
Chris@1115 281 resources :groups do
Chris@1115 282 member do
Chris@1115 283 get 'autocomplete_for_user'
Chris@0 284 end
Chris@0 285 end
Chris@909 286
Chris@1115 287 match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
Chris@1115 288 match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
Chris@1115 289 match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
Chris@1115 290 match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
Chris@1115 291
Chris@1115 292 resources :trackers, :except => :show do
Chris@1115 293 collection do
Chris@1115 294 match 'fields', :via => [:get, :post]
Chris@0 295 end
Chris@1115 296 end
Chris@1115 297 resources :issue_statuses, :except => :show do
Chris@1115 298 collection do
Chris@1115 299 post 'update_issue_done_ratio'
Chris@1115 300 end
Chris@1115 301 end
Chris@1115 302 resources :custom_fields, :except => :show
Chris@1115 303 resources :roles do
Chris@1115 304 collection do
Chris@1115 305 match 'permissions', :via => [:get, :post]
Chris@1115 306 end
Chris@1115 307 end
Chris@1115 308 resources :enumerations, :except => :show
Chris@1115 309 match 'enumerations/:type', :to => 'enumerations#index', :via => :get
Chris@1115 310
Chris@1115 311 get 'projects/:id/search', :controller => 'search', :action => 'index'
Chris@1115 312 get 'search', :controller => 'search', :action => 'index'
Chris@1115 313
Chris@1115 314 match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
Chris@1115 315
Chris@1115 316 match 'admin', :controller => 'admin', :action => 'index', :via => :get
Chris@1115 317 match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
Chris@1115 318 match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
Chris@1115 319 match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
Chris@1115 320 match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
Chris@1115 321 match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
Chris@1115 322
Chris@1115 323 resources :auth_sources do
Chris@1115 324 member do
Chris@1115 325 get 'test_connection'
Chris@0 326 end
Chris@0 327 end
Chris@909 328
Chris@1115 329 match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
Chris@1115 330 match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
Chris@1115 331 match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
Chris@1115 332 match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
Chris@1115 333 match 'settings', :controller => 'settings', :action => 'index', :via => :get
Chris@1115 334 match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
Chris@1115 335 match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
Chris@1115 336
Chris@1115 337 match 'sys/projects', :to => 'sys#projects', :via => :get
Chris@1115 338 match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
Chris@1334 339 match 'sys/projects/:id/embedded.:format', :controller => 'sys', :action => 'set_embedded_active', :conditions => { :method => :post }
Chris@1115 340 match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
Chris@1115 341
Chris@1115 342 match 'uploads', :to => 'attachments#upload', :via => :post
Chris@1115 343
Chris@1115 344 get 'robots.txt', :to => 'welcome#robots'
Chris@1115 345
Chris@1115 346 Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
Chris@1115 347 file = File.join(plugin_dir, "config/routes.rb")
Chris@1115 348 if File.exists?(file)
Chris@1115 349 begin
Chris@1115 350 instance_eval File.read(file)
Chris@1115 351 rescue Exception => e
Chris@1115 352 puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
Chris@1115 353 exit 1
Chris@1115 354 end
Chris@0 355 end
Chris@0 356 end
Chris@0 357 end