To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / config / routes.rb @ 1298:4f746d8966dd

History | View | Annotate | Download (16.7 KB)

1 1115:433d4f72a19b Chris
# Redmine - project management software
2 1295:622f24f53b42 Chris
# Copyright (C) 2006-2013  Jean-Philippe Lang
3 1115:433d4f72a19b Chris
#
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 909:cbb26bc654de Chris
18 1115:433d4f72a19b Chris
RedmineApp::Application.routes.draw do
19
  root :to => 'welcome#index', :as => 'home'
20 0:513646585e45 Chris
21 1295:622f24f53b42 Chris
  match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
22
  match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
23 1115:433d4f72a19b Chris
  match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
24
  match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
25
  match 'account/activate', :to => 'account#activate', :via => :get
26 909:cbb26bc654de Chris
27 1295:622f24f53b42 Chris
  match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
28
  match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
29
  match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
30
  match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
31 909:cbb26bc654de Chris
32 1115:433d4f72a19b Chris
  match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
33
  match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
34 0:513646585e45 Chris
35 1295:622f24f53b42 Chris
  match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
36 1115:433d4f72a19b Chris
  get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
37
  match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
38
  get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
39
40 1295:622f24f53b42 Chris
  post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message'
41 1115:433d4f72a19b Chris
  post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
42
  post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
43
  post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
44
45
  # Misc issue routes. TODO: move into resources
46
  match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
47 1295:622f24f53b42 Chris
  match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post]
48
  match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get
49 1115:433d4f72a19b Chris
  match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
50
51
  match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get
52
  match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post]
53
54 1295:622f24f53b42 Chris
  get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
55
  get '/issues/gantt', :to => 'gantts#show'
56 1115:433d4f72a19b Chris
57 1295:622f24f53b42 Chris
  get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar'
58
  get '/issues/calendar', :to => 'calendars#show'
59 1115:433d4f72a19b Chris
60 1295:622f24f53b42 Chris
  get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report'
61
  get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details'
62 1115:433d4f72a19b Chris
63
  match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
64
  match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
65
  match 'my/page', :controller => 'my', :action => 'page', :via => :get
66
  match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
67
  match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
68
  match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
69
  match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
70
  match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
71
  match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
72
  match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
73
  match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
74
75
  resources :users
76
  match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership'
77
  match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
78
  match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
79
80 1295:622f24f53b42 Chris
  post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
81
  delete 'watchers/watch', :to => 'watchers#unwatch'
82
  get 'watchers/new', :to => 'watchers#new'
83
  post 'watchers', :to => 'watchers#create'
84
  post 'watchers/append', :to => 'watchers#append'
85
  delete 'watchers', :to => 'watchers#destroy'
86
  get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user'
87
  # Specific routes for issue watchers API
88
  post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
89
  delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
90 1245:d8e15cc24494 luis
  match 'projects/:id/overview', :to => "projects#overview"
91 1115:433d4f72a19b Chris
92
  resources :projects do
93
    member do
94 1295:622f24f53b42 Chris
      get 'settings(/:tab)', :action => 'settings', :as => 'settings'
95 1115:433d4f72a19b Chris
      post 'modules'
96
      post 'archive'
97
      post 'unarchive'
98
      post 'close'
99
      post 'reopen'
100
      match 'copy', :via => [:get, :post]
101
    end
102
103 1295:622f24f53b42 Chris
    shallow do
104
      resources :memberships, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
105 1141:c852c89f5de1 chris
        get 'autocomplete'
106
      end
107
    end
108 1298:4f746d8966dd Chris
    shallow do
109
      resources :members, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
110 1295:622f24f53b42 Chris
        collection do
111
          get 'autocomplete'
112
        end
113 1115:433d4f72a19b Chris
      end
114
    end
115
116
    resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy]
117
118 1295:622f24f53b42 Chris
    get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue'
119 1115:433d4f72a19b Chris
    resources :issues, :only => [:index, :new, :create] do
120
      resources :time_entries, :controller => 'timelog' do
121
        collection do
122
          get 'report'
123
        end
124
      end
125
    end
126
    # issue form update
127 1295:622f24f53b42 Chris
    match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
128 1115:433d4f72a19b Chris
129
    resources :files, :only => [:index, :new, :create]
130
131
    resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
132
      collection do
133
        put 'close_completed'
134
      end
135
    end
136 1295:622f24f53b42 Chris
    get 'versions.:format', :to => 'versions#index'
137
    get 'roadmap', :to => 'versions#index', :format => false
138
    get 'versions', :to => 'versions#index'
139 1115:433d4f72a19b Chris
140
    resources :news, :except => [:show, :edit, :update, :destroy]
141
    resources :time_entries, :controller => 'timelog' do
142
      get 'report', :on => :collection
143
    end
144
    resources :queries, :only => [:new, :create]
145 1295:622f24f53b42 Chris
    shallow do
146
      resources :issue_categories
147
    end
148 1115:433d4f72a19b Chris
    resources :documents, :except => [:show, :edit, :update, :destroy]
149
    resources :boards
150 1295:622f24f53b42 Chris
    shallow do
151
      resources :repositories, :except => [:index, :show] do
152
        member do
153
          match 'committers', :via => [:get, :post]
154
        end
155 1115:433d4f72a19b Chris
      end
156
    end
157 1295:622f24f53b42 Chris
158 1115:433d4f72a19b Chris
    match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
159 1295:622f24f53b42 Chris
    resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
160 1115:433d4f72a19b Chris
      member do
161
        get 'rename'
162
        post 'rename'
163
        get 'history'
164
        get 'diff'
165
        match 'preview', :via => [:post, :put]
166
        post 'protect'
167
        post 'add_attachment'
168
      end
169
      collection do
170
        get 'export'
171
        get 'date_index'
172
      end
173
    end
174
    match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
175 1295:622f24f53b42 Chris
    get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
176 1115:433d4f72a19b Chris
    delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
177
    get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
178
    get 'wiki/:id/:version/diff', :to => 'wiki#diff'
179 0:513646585e45 Chris
  end
180 37:94944d00e43c chris
181 1115:433d4f72a19b Chris
  resources :issues do
182
    collection do
183
      match 'bulk_edit', :via => [:get, :post]
184
      post 'bulk_update'
185
    end
186
    resources :time_entries, :controller => 'timelog' do
187
      collection do
188
        get 'report'
189
      end
190
    end
191 1295:622f24f53b42 Chris
    shallow do
192
      resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
193
    end
194 1115:433d4f72a19b Chris
  end
195
  match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
196 909:cbb26bc654de Chris
197 1129:77f703281e14 luis
  # changed this route to ensure compatibility with Rails 3 --lf.20130109
198
  match 'explore' => 'projects#explore'
199 1007:3e52bc15dd67 chris
200 1115:433d4f72a19b Chris
  resources :queries, :except => [:show]
201 909:cbb26bc654de Chris
202 1115:433d4f72a19b Chris
  resources :news, :only => [:index, :show, :edit, :update, :destroy]
203
  match '/news/:id/comments', :to => 'comments#create', :via => :post
204
  match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete
205
206
  resources :versions, :only => [:show, :edit, :update, :destroy] do
207
    post 'status_by', :on => :member
208
  end
209
210
  resources :documents, :only => [:show, :edit, :update, :destroy] do
211
    post 'add_attachment', :on => :member
212
  end
213
214 1295:622f24f53b42 Chris
  match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post]
215 1115:433d4f72a19b Chris
216
  resources :time_entries, :controller => 'timelog', :except => :destroy do
217
    collection do
218
      get 'report'
219
      get 'bulk_edit'
220
      post 'bulk_update'
221 0:513646585e45 Chris
    end
222 1115:433d4f72a19b Chris
  end
223
  match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
224
  # TODO: delete /time_entries for bulk deletion
225
  match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete
226
227
  get 'projects/:id/activity', :to => 'activities#index'
228
  get 'projects/:id/activity.:format', :to => 'activities#index'
229
  get 'activity', :to => 'activities#index'
230
231
  # repositories routes
232
  get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
233
  get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
234
235
  get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))',
236
      :to => 'repositories#changes'
237
238
  get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
239
  get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
240
  post   'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue'
241
  delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
242
  get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
243
  get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
244
      :controller => 'repositories',
245
      :format => false,
246
      :constraints => {
247
            :action => /(browse|show|entry|raw|annotate|diff)/,
248
            :rev    => /[a-z0-9\.\-_]+/
249
          }
250
251
  get 'projects/:id/repository/statistics', :to => 'repositories#stats'
252
  get 'projects/:id/repository/graph', :to => 'repositories#graph'
253
254
  get 'projects/:id/repository/changes(/*path(.:ext))',
255
      :to => 'repositories#changes'
256
257
  get 'projects/:id/repository/revisions', :to => 'repositories#revisions'
258
  get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision'
259
  get 'projects/:id/repository/revision', :to => 'repositories#revision'
260
  post   'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue'
261
  delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
262
  get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
263
      :controller => 'repositories',
264
      :format => false,
265
      :constraints => {
266
            :action => /(browse|show|entry|raw|annotate|diff)/,
267
            :rev    => /[a-z0-9\.\-_]+/
268
          }
269
  get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))',
270
      :controller => 'repositories',
271
      :action => /(browse|show|entry|raw|changes|annotate|diff)/
272
  get 'projects/:id/repository/:action(/*path(.:ext))',
273
      :controller => 'repositories',
274
      :action => /(browse|show|entry|raw|changes|annotate|diff)/
275
276
  get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil
277
  get 'projects/:id/repository', :to => 'repositories#show', :path => nil
278
279
  # additional routes for having the file name at the end of url
280 1295:622f24f53b42 Chris
  get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment'
281
  get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
282
  get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
283
  get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
284 1153:e1f00c0ed8ff chris
  match 'attachments/toggle_active/:id', :controller => 'attachments', :action => 'toggle_active', :id => /\d+/, :via => :get
285 1115:433d4f72a19b Chris
  resources :attachments, :only => [:show, :destroy]
286
287
  resources :groups do
288
    member do
289
      get 'autocomplete_for_user'
290 0:513646585e45 Chris
    end
291
  end
292 909:cbb26bc654de Chris
293 1115:433d4f72a19b Chris
  match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
294
  match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
295
  match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
296
  match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
297
298
  resources :trackers, :except => :show do
299
    collection do
300
      match 'fields', :via => [:get, :post]
301 0:513646585e45 Chris
    end
302 1115:433d4f72a19b Chris
  end
303
  resources :issue_statuses, :except => :show do
304
    collection do
305
      post 'update_issue_done_ratio'
306
    end
307
  end
308
  resources :custom_fields, :except => :show
309
  resources :roles do
310
    collection do
311
      match 'permissions', :via => [:get, :post]
312
    end
313
  end
314
  resources :enumerations, :except => :show
315
  match 'enumerations/:type', :to => 'enumerations#index', :via => :get
316
317
  get 'projects/:id/search', :controller => 'search', :action => 'index'
318
  get 'search', :controller => 'search', :action => 'index'
319
320
  match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
321
322
  match 'admin', :controller => 'admin', :action => 'index', :via => :get
323
  match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
324
  match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
325
  match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
326
  match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
327
  match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
328
329
  resources :auth_sources do
330
    member do
331 1295:622f24f53b42 Chris
      get 'test_connection', :as => 'try_connection'
332
    end
333
    collection do
334
      get 'autocomplete_for_new_user'
335 0:513646585e45 Chris
    end
336
  end
337 909:cbb26bc654de Chris
338 1115:433d4f72a19b Chris
  match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
339
  match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
340
  match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
341
  match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
342
  match 'settings', :controller => 'settings', :action => 'index', :via => :get
343
  match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
344 1295:622f24f53b42 Chris
  match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
345 1115:433d4f72a19b Chris
346
  match 'sys/projects', :to => 'sys#projects', :via => :get
347
  match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
348
  match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
349
350
  match 'uploads', :to => 'attachments#upload', :via => :post
351
352
  get 'robots.txt', :to => 'welcome#robots'
353
354
  Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
355
    file = File.join(plugin_dir, "config/routes.rb")
356
    if File.exists?(file)
357
      begin
358
        instance_eval File.read(file)
359
      rescue Exception => e
360
        puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}."
361
        exit 1
362
      end
363 0:513646585e45 Chris
    end
364
  end
365
end