You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

routes.rb 15KB

Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
15 years ago
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
15 years ago
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
15 years ago
Converted routing and urls to follow the Rails REST convention. Patch supplied by commits from Gerrit Kaiser on Github. Existing routes will still work (backwards compatible) but any new urls will be generated using the new routing rules. Changes listed below: * made the URLs for some project tabs and project settings follow the new rails RESTful conventions of /collection/:id/subcollection/:sub_id * prettier URL for project roadmap * more nice project URLs * use GET for filtering form * prettified URLs used on issues tab * custom route for activity atom feeds * prettier repository urls * fixed broken route definition * fixed failing tests for issuecontroller that were hardcoding the url string * more RESTful routes for boards and messages * RESTful routes for wiki pages * RESTful routes for documents * moved old routes that are retained for compatibility to the bottom and grouped them together * added RESTful URIs for issues * RESTfulness for the news section * fixed route order * changed hardcoded URLs in tests * fixed badly written tests * fixed forgotten parameter in routes * changed hardcoded URLS to new scheme * changed project add url to the standard POST to collection * create new issue by POSTing to collection * changed hardcoded URLs in integrations tests * made project add form work again * restful routes for project deletion * prettier routes for project (un)archival * made routes table more readable * fixed note quoting * user routing * fixed bug * always sort by GET * Fixed: cross-project issue list should not show issues of projects for which the issue tracking module was disabled. * prettified URLs used on issues tab * urls for time log * fixed reply routing * eliminate revision query paremeter for diff and entry actions * fixed test failures with hard-coded urls * ensure ajax links always use get * refactored ajax link generation into separate method #1901 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2317 e93f8b46-1217-0410-a6f0-8f06a7374b81
15 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2012 Jean-Philippe Lang
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. RedmineApp::Application.routes.draw do
  18. root :to => 'welcome#index', :as => 'home'
  19. match 'login', :to => 'account#login', :as => 'signin'
  20. match 'logout', :to => 'account#logout', :as => 'signout'
  21. match 'account/register', :to => 'account#register', :via => [:get, :post]
  22. match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post]
  23. match 'account/activate', :to => 'account#activate', :via => :get
  24. match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news'
  25. match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue'
  26. match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue'
  27. match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue'
  28. match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
  29. match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
  30. match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post]
  31. get 'boards/:board_id/topics/:id', :to => 'messages#show'
  32. match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
  33. get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
  34. post 'boards/:board_id/topics/preview', :to => 'messages#preview'
  35. post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
  36. post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
  37. post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
  38. # Misc issue routes. TODO: move into resources
  39. match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
  40. match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu'
  41. match '/issues/changes', :to => 'journals#index', :as => 'issue_changes'
  42. match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
  43. match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
  44. match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
  45. match '/projects/:project_id/issues/gantt', :to => 'gantts#show'
  46. match '/issues/gantt', :to => 'gantts#show'
  47. match '/projects/:project_id/issues/calendar', :to => 'calendars#show'
  48. match '/issues/calendar', :to => 'calendars#show'
  49. match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get
  50. match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get
  51. match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
  52. match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
  53. match 'my/page', :controller => 'my', :action => 'page', :via => :get
  54. match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
  55. match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
  56. match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
  57. match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
  58. match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
  59. match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
  60. match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
  61. match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
  62. resources :users
  63. match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
  64. match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
  65. match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
  66. match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get
  67. match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post
  68. match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post
  69. match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post
  70. match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post
  71. match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post
  72. match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get
  73. match 'projects/:id/settings/:tab', :to => "projects#settings"
  74. resources :projects do
  75. member do
  76. get 'settings'
  77. post 'modules'
  78. post 'archive'
  79. post 'unarchive'
  80. match 'copy', :via => [:get, :post]
  81. end
  82. resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :create, :update, :destroy] do
  83. collection do
  84. get 'autocomplete'
  85. end
  86. end
  87. resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
  88. match 'issues/:copy_from/copy', :to => 'issues#new'
  89. resources :issues, :only => [:index, :new, :create] do
  90. resources :time_entries, :controller => 'timelog' do
  91. collection do
  92. get 'report'
  93. end
  94. end
  95. end
  96. # issue form update
  97. match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form'
  98. resources :files, :only => [:index, :new, :create]
  99. resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
  100. collection do
  101. put 'close_completed'
  102. end
  103. end
  104. match 'versions.:format', :to => 'versions#index'
  105. match 'roadmap', :to => 'versions#index', :format => false
  106. match 'versions', :to => 'versions#index'
  107. resources :news, :except => [:show, :edit, :update, :destroy]
  108. resources :time_entries, :controller => 'timelog' do
  109. get 'report', :on => :collection
  110. end
  111. resources :queries, :only => [:new, :create]
  112. resources :issue_categories, :shallow => true
  113. resources :documents, :except => [:show, :edit, :update, :destroy]
  114. resources :boards
  115. resources :repositories, :shallow => true, :except => [:index, :show] do
  116. member do
  117. match 'committers', :via => [:get, :post]
  118. end
  119. end
  120. match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
  121. match 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
  122. match 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff'
  123. resources :wiki, :except => [:index, :new, :create] do
  124. member do
  125. get 'rename'
  126. post 'rename'
  127. get 'history'
  128. get 'diff'
  129. match 'preview', :via => [:post, :put]
  130. post 'protect'
  131. post 'add_attachment'
  132. end
  133. collection do
  134. get 'export'
  135. get 'date_index'
  136. end
  137. end
  138. match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
  139. match 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
  140. end
  141. resources :issues do
  142. collection do
  143. match 'bulk_edit', :via => [:get, :post]
  144. post 'bulk_update'
  145. end
  146. resources :time_entries, :controller => 'timelog' do
  147. collection do
  148. get 'report'
  149. end
  150. end
  151. resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
  152. end
  153. match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
  154. resources :queries, :except => [:show]
  155. resources :news, :only => [:index, :show, :edit, :update, :destroy]
  156. match '/news/:id/comments', :to => 'comments#create', :via => :post
  157. match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
  158. resources :versions, :only => [:show, :edit, :update, :destroy] do
  159. post 'status_by', :on => :member
  160. end
  161. resources :documents, :only => [:show, :edit, :update, :destroy] do
  162. post 'add_attachment', :on => :member
  163. end
  164. match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu
  165. resources :time_entries, :controller => 'timelog', :except => :destroy do
  166. collection do
  167. get 'report'
  168. get 'bulk_edit'
  169. post 'bulk_update'
  170. end
  171. end
  172. match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
  173. # TODO: delete /time_entries for bulk deletion
  174. match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
  175. # TODO: port to be part of the resources route(s)
  176. match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get
  177. get 'projects/:id/activity', :to => 'activities#index'
  178. get 'projects/:id/activity.:format', :to => 'activities#index'
  179. get 'activity', :to => 'activities#index'
  180. # repositories routes
  181. get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
  182. get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
  183. get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
  184. :to => 'repositories#changes'
  185. get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
  186. get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
  187. post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
  188. delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
  189. get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
  190. get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
  191. :controller => 'repositories',
  192. :constraints => {
  193. :action => /(browse|show|entry|raw|annotate|diff)/,
  194. :rev => /[a-z0-9\.\-_]+/
  195. }
  196. get 'projects/:id/repository/statistics', :to => 'repositories#stats'
  197. get 'projects/:id/repository/graph', :to => 'repositories#graph'
  198. get 'projects/:id/repository/changes(/*path(.:ext))',
  199. :to => 'repositories#changes'
  200. get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
  201. get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
  202. get 'projects/:id/repository/revision', :to => 'repositories#revision'
  203. post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
  204. delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
  205. get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
  206. :controller => 'repositories',
  207. :constraints => {
  208. :action => /(browse|show|entry|raw|annotate|diff)/,
  209. :rev => /[a-z0-9\.\-_]+/
  210. }
  211. get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
  212. :controller => 'repositories',
  213. :action => /(browse|show|entry|raw|changes|annotate|diff)/
  214. get 'projects/:id/repository/:action(/*path(.:ext))',
  215. :controller => 'repositories',
  216. :action => /(browse|show|entry|raw|changes|annotate|diff)/
  217. get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
  218. get 'projects/:id/repository', :to => 'repositories#show', :path => nil
  219. # additional routes for having the file name at the end of url
  220. match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get
  221. match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get
  222. match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get
  223. resources :attachments, :only => [:show, :destroy]
  224. resources :groups do
  225. member do
  226. get 'autocomplete_for_user'
  227. end
  228. end
  229. match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
  230. match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
  231. match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
  232. match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
  233. resources :trackers, :except => :show
  234. resources :issue_statuses, :except => :show do
  235. collection do
  236. post 'update_issue_done_ratio'
  237. end
  238. end
  239. resources :custom_fields, :except => :show
  240. resources :roles, :except => :show do
  241. collection do
  242. match 'permissions', :via => [:get, :post]
  243. end
  244. end
  245. resources :enumerations, :except => :show
  246. get 'projects/:id/search', :controller => 'search', :action => 'index'
  247. get 'search', :controller => 'search', :action => 'index'
  248. match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
  249. match 'admin', :controller => 'admin', :action => 'index', :via => :get
  250. match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
  251. match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
  252. match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
  253. match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
  254. match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
  255. resources :auth_sources do
  256. member do
  257. get 'test_connection'
  258. end
  259. end
  260. match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
  261. match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
  262. match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
  263. match 'settings', :controller => 'settings', :action => 'index', :via => :get
  264. match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
  265. match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
  266. match 'sys/projects', :to => 'sys#projects', :via => :get
  267. match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
  268. match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
  269. match 'uploads', :to => 'attachments#upload', :via => :post
  270. get 'robots.txt', :to => 'welcome#robots'
  271. Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
  272. file = File.join(plugin_dir, "config/routes.rb")
  273. if File.exists?(file)
  274. begin
  275. instance_eval File.read(file)
  276. rescue Exception => e
  277. puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
  278. exit 1
  279. end
  280. end
  281. end
  282. end