annotate .svn/pristine/05/0548f38a902595a77747491d864f451fe12f0f47.svn-base @ 1298:4f746d8966dd redmine_2.3_integration

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