diff config/routes.rb @ 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 d8e15cc24494 622f24f53b42
children
line wrap: on
line diff
--- a/config/routes.rb	Fri Jun 14 09:07:32 2013 +0100
+++ b/config/routes.rb	Fri Jun 14 09:28:30 2013 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2012  Jean-Philippe Lang
+# Copyright (C) 2006-2013  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -18,47 +18,47 @@
 RedmineApp::Application.routes.draw do
   root :to => 'welcome#index', :as => 'home'
 
-  match 'login', :to => 'account#login', :as => 'signin'
-  match 'logout', :to => 'account#logout', :as => 'signout'
+  match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
+  match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
   match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
   match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
   match 'account/activate', :to => 'account#activate', :via => :get
 
-  match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news'
-  match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue'
-  match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue'
-  match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue'
+  match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
+  match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
+  match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
+  match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
 
   match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
   match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
 
-  match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post]
+  match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
   get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
   match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
   get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
 
-  post 'boards/:board_id/topics/preview', :to => 'messages#preview'
+  post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
   post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
   post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
   post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
 
   # Misc issue routes. TODO: move into resources
   match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
-  match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu'
-  match '/issues/changes', :to => 'journals#index', :as => 'issue_changes'
+  match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post]
+  match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get
   match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
 
   match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
   match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
 
-  match '/projects/:project_id/issues/gantt', :to => 'gantts#show'
-  match '/issues/gantt', :to => 'gantts#show'
+  get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
+  get '/issues/gantt', :to => 'gantts#show'
 
-  match '/projects/:project_id/issues/calendar', :to => 'calendars#show'
-  match '/issues/calendar', :to => 'calendars#show'
+  get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar'
+  get '/issues/calendar', :to => 'calendars#show'
 
-  match 'projects/:id/issues/report', :to => 'reports#issue_report', :via => :get
-  match 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :via => :get
+  get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
+  get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
 
   match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
   match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
@@ -77,20 +77,21 @@
   match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
   match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
 
-  match 'watchers/new', :controller=> 'watchers', :action => 'new', :via => :get
-  match 'watchers', :controller=> 'watchers', :action => 'create', :via => :post
-  match 'watchers/append', :controller=> 'watchers', :action => 'append', :via => :post
-  match 'watchers/destroy', :controller=> 'watchers', :action => 'destroy', :via => :post
-  match 'watchers/watch', :controller=> 'watchers', :action => 'watch', :via => :post
-  match 'watchers/unwatch', :controller=> 'watchers', :action => 'unwatch', :via => :post
-  match 'watchers/autocomplete_for_user', :controller=> 'watchers', :action => 'autocomplete_for_user', :via => :get
-
-  match 'projects/:id/settings/:tab', :to => "projects#settings"
+  post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
+  delete 'watchers/watch', :to => 'watchers#unwatch'
+  get 'watchers/new', :to => 'watchers#new'
+  post 'watchers', :to => 'watchers#create'
+  post 'watchers/append', :to => 'watchers#append'
+  delete 'watchers', :to => 'watchers#destroy'
+  get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
+  # Specific routes for issue watchers API
+  post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
+  delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
   match 'projects/:id/overview', :to => "projects#overview"
 
   resources :projects do
     member do
-      get 'settings'
+      get 'settings(/:tab)', :action => 'settings', :as => 'settings'
       post 'modules'
       post 'archive'
       post 'unarchive'
@@ -99,20 +100,22 @@
       match 'copy', :via => [:get, :post]
     end
 
-    resources :members, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
-      collection do
+    shallow do
+      resources :memberships, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
         get 'autocomplete'
       end
     end
-    resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
-      collection do
-        get 'autocomplete'
+    shallow do
+      resources :members, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
+        collection do
+          get 'autocomplete'
+        end
       end
     end
 
     resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
 
-    match 'issues/:copy_from/copy', :to => 'issues#new'
+    get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue'
     resources :issues, :only => [:index, :new, :create] do
       resources :time_entries, :controller => 'timelog' do
         collection do
@@ -121,7 +124,7 @@
       end
     end
     # issue form update
-    match 'issues/new', :controller => 'issues', :action => 'new', :via => [:put, :post], :as => 'issue_form'
+    match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
 
     resources :files, :only => [:index, :new, :create]
 
@@ -130,26 +133,30 @@
         put 'close_completed'
       end
     end
-    match 'versions.:format', :to => 'versions#index'
-    match 'roadmap', :to => 'versions#index', :format => false
-    match 'versions', :to => 'versions#index'
+    get 'versions.:format', :to => 'versions#index'
+    get 'roadmap', :to => 'versions#index', :format => false
+    get 'versions', :to => 'versions#index'
 
     resources :news, :except => [:show, :edit, :update, :destroy]
     resources :time_entries, :controller => 'timelog' do
       get 'report', :on => :collection
     end
     resources :queries, :only => [:new, :create]
-    resources :issue_categories, :shallow => true
+    shallow do
+      resources :issue_categories
+    end
     resources :documents, :except => [:show, :edit, :update, :destroy]
     resources :boards
-    resources :repositories, :shallow => true, :except => [:index, :show] do
-      member do
-        match 'committers', :via => [:get, :post]
+    shallow do
+      resources :repositories, :except => [:index, :show] do
+        member do
+          match 'committers', :via => [:get, :post]
+        end
       end
     end
-
+  
     match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
-    resources :wiki, :except => [:index, :new, :create] do
+    resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
       member do
         get 'rename'
         post 'rename'
@@ -165,7 +172,7 @@
       end
     end
     match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
-    get 'wiki/:id/:version', :to => 'wiki#show'
+    get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
     delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
     get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
     get 'wiki/:id/:version/diff', :to => 'wiki#diff'
@@ -181,7 +188,9 @@
         get 'report'
       end
     end
-    resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
+    shallow do
+      resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
+    end
   end
   match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
 
@@ -202,7 +211,7 @@
     post 'add_attachment', :on => :member
   end
 
-  match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu
+  match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
 
   resources :time_entries, :controller => 'timelog', :except => :destroy do
     collection do
@@ -215,9 +224,6 @@
   # TODO: delete /time_entries for bulk deletion
   match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
 
-  # TODO: port to be part of the resources route(s)
-  match 'projects/:id/settings/:tab', :to => 'projects#settings', :via => :get
-
   get 'projects/:id/activity', :to => 'activities#index'
   get 'projects/:id/activity.:format', :to => 'activities#index'
   get 'activity', :to => 'activities#index'
@@ -271,11 +277,11 @@
   get 'projects/:id/repository', :to => 'repositories#show', :path => nil
 
   # additional routes for having the file name at the end of url
-  match 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/, :via => :get
-  match 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/, :via => :get
-  match 'attachments/download/:id', :controller => 'attachments', :action => 'download', :id => /\d+/, :via => :get
+  get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
+  get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
+  get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
+  get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
   match 'attachments/toggle_active/:id', :controller => 'attachments', :action => 'toggle_active', :id => /\d+/, :via => :get
-  match 'attachments/thumbnail/:id(/:size)', :controller => 'attachments', :action => 'thumbnail', :id => /\d+/, :via => :get, :size => /\d+/
   resources :attachments, :only => [:show, :destroy]
 
   resources :groups do
@@ -322,7 +328,10 @@
 
   resources :auth_sources do
     member do
-      get 'test_connection'
+      get 'test_connection', :as => 'try_connection'
+    end
+    collection do
+      get 'autocomplete_for_new_user'
     end
   end
 
@@ -332,7 +341,7 @@
   match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
   match 'settings', :controller => 'settings', :action => 'index', :via => :get
   match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
-  match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post]
+  match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
 
   match 'sys/projects', :to => 'sys#projects', :via => :get
   match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post