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 @ 1076:b665182d9dd9

History | View | Annotate | Download (15.5 KB)

1
ActionController::Routing::Routes.draw do |map|
2
  # Add your own custom routes here.
3
  # The priority is based upon order of creation: first created -> highest priority.
4

    
5
  # Here's a sample route:
6
  # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7
  # Keep in mind you can assign values other than :controller and :action
8

    
9
  map.home '', :controller => 'welcome'
10

    
11
  map.signin 'login', :controller => 'account', :action => 'login'
12
  map.signout 'logout', :controller => 'account', :action => 'logout'
13

    
14
  map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow'
15
  map.connect 'help/:ctrl/:page', :controller => 'help'
16

    
17
  map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
18
    time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report'
19
    time_report.connect 'projects/:project_id/issues/:issue_id/time_entries/report.:format'
20
    time_report.connect 'projects/:project_id/time_entries/report'
21
    time_report.connect 'projects/:project_id/time_entries/report.:format'
22
    time_report.connect 'time_entries/report'
23
    time_report.connect 'time_entries/report.:format'
24
  end
25

    
26
  map.bulk_edit_time_entry 'time_entries/bulk_edit',
27
                   :controller => 'timelog', :action => 'bulk_edit', :conditions => { :method => :get }
28
  map.bulk_update_time_entry 'time_entries/bulk_edit',
29
                   :controller => 'timelog', :action => 'bulk_update', :conditions => { :method => :post }
30
  map.time_entries_context_menu '/time_entries/context_menu',
31
                   :controller => 'context_menus', :action => 'time_entries'
32
  # TODO: wasteful since this is also nested under issues, projects, and projects/issues
33
  map.resources :time_entries, :controller => 'timelog'
34

    
35
  map.connect 'explore', :controller => 'projects', :action => 'explore'
36

    
37
  map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
38
  map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
39
  map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
40

    
41
  map.with_options :controller => 'messages' do |messages_routes|
42
    messages_routes.with_options :conditions => {:method => :get} do |messages_views|
43
      messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
44
      messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
45
      messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
46
    end
47
    messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
48
      messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
49
      messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
50
      messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
51
    end
52
  end
53

    
54
  map.with_options :controller => 'boards' do |board_routes|
55
    board_routes.with_options :conditions => {:method => :get} do |board_views|
56
      board_views.connect 'projects/:project_id/boards', :action => 'index'
57
      board_views.connect 'projects/:project_id/boards/new', :action => 'new'
58
      board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
59
      board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
60
      board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
61
    end
62
    board_routes.with_options :conditions => {:method => :post} do |board_actions|
63
      board_actions.connect 'projects/:project_id/boards', :action => 'new'
64
      board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
65
    end
66
  end
67

    
68
  map.with_options :controller => 'documents' do |document_routes|
69
    document_routes.with_options :conditions => {:method => :get} do |document_views|
70
      document_views.connect 'projects/:project_id/documents', :action => 'index'
71
      document_views.connect 'projects/:project_id/documents/new', :action => 'new'
72
      document_views.connect 'documents/:id', :action => 'show'
73
      document_views.connect 'documents/:id/edit', :action => 'edit'
74
    end
75
    document_routes.with_options :conditions => {:method => :post} do |document_actions|
76
      document_actions.connect 'projects/:project_id/documents', :action => 'new'
77
      document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
78
    end
79
  end
80

    
81
  map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
82
  map.resources :queries, :except => [:show]
83

    
84
  # Misc issue routes. TODO: move into resources
85
  map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues', :conditions => { :method => :get }
86
  map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
87
  map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
88
  map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
89
  map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
90
  map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
91
  map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
92
  map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
93

    
94
  map.with_options :controller => 'gantts', :action => 'show' do |gantts_routes|
95
    gantts_routes.connect '/projects/:project_id/issues/gantt'
96
    gantts_routes.connect '/projects/:project_id/issues/gantt.:format'
97
    gantts_routes.connect '/issues/gantt.:format'
98
  end
99

    
100
  map.with_options :controller => 'calendars', :action => 'show' do |calendars_routes|
101
    calendars_routes.connect '/projects/:project_id/issues/calendar'
102
    calendars_routes.connect '/issues/calendar'
103
  end
104

    
105
  map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
106
    reports.connect 'projects/:id/issues/report', :action => 'issue_report'
107
    reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
108
  end
109

    
110
  # Following two routes conflict with the resources because #index allows POST
111
  map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
112
  map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
113

    
114
  map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
115
    issues.resources :time_entries, :controller => 'timelog'
116
    issues.resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
117
  end
118

    
119
  map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
120
    issues.resources :time_entries, :controller => 'timelog'
121
  end
122

    
123
  map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
124

    
125
  map.with_options :controller => 'users' do |users|
126
    users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
127

    
128
    users.with_options :conditions => {:method => :post} do |user_actions|
129
      user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
130
      user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
131
      user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
132
    end
133
  end
134

    
135
  map.resources :users, :member => {
136
    :edit_membership => :post,
137
    :destroy_membership => :post
138
  }
139

    
140
  # For nice "roadmap" in the url for the index action
141
  map.connect 'projects/:project_id/roadmap', :controller => 'versions', :action => 'index'
142

    
143
  map.all_news 'news', :controller => 'news', :action => 'index'
144
  map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
145
  map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
146
  map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
147
  map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
148

    
149
  map.resources :projects, :member => {
150
    :copy => [:get, :post],
151
    :settings => :get,
152
    :modules => :post,
153
    :overview => :post,
154
    :archive => :post,
155
    :unarchive => :post
156
  } do |project|
157
    project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
158
    project.resources :files, :only => [:index, :new, :create]
159
    project.resources :versions, :shallow => true, :collection => {:close_completed => :put}, :member => {:status_by => :post}
160
    project.resources :news, :shallow => true
161
    project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
162
    project.resources :queries, :only => [:new, :create]
163
    project.resources :issue_categories, :shallow => true
164

    
165
    project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
166
    project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
167
    project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
168
    project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
169
    project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
170
    project.resources :wiki, :except => [:new, :create], :member => {
171
      :rename => [:get, :post],
172
      :history => :get,
173
      :preview => :any,
174
      :protect => :post,
175
      :add_attachment => :post
176
    }, :collection => {
177
      :export => :get,
178
      :date_index => :get
179
    }
180

    
181
  end
182

    
183
  # Destroy uses a get request to prompt the user before the actual DELETE request
184
  map.project_destroy_confirm 'projects/:id/destroy', :controller => 'projects', :action => 'destroy', :conditions => {:method => :get}
185

    
186
  # TODO: port to be part of the resources route(s)
187
  map.with_options :controller => 'projects' do |project_mapper|
188
    project_mapper.with_options :conditions => {:method => :get} do |project_views|
189
      project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
190
      project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
191
    end
192
  end
193

    
194
  map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
195
    activity.connect 'projects/:id/activity'
196
    activity.connect 'projects/:id/activity.:format'
197
    activity.connect 'activity', :id => nil
198
    activity.connect 'activity.:format', :id => nil
199
  end
200

    
201
  map.with_options :controller => 'repositories' do |repositories|
202
    repositories.with_options :conditions => {:method => :get} do |repository_views|
203
      repository_views.connect 'projects/:id/repository', :action => 'show'
204
      repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
205
      repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
206
      repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
207
      repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
208
      repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
209
      repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
210
      repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
211
      repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
212
      repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
213
      repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
214
      # TODO: why the following route is required?
215
      repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
216
      repository_views.connect 'projects/:id/repository/:action/*path'
217
    end
218

    
219
    repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
220
  end
221
  
222
  map.resources :attachments, :only => [:show, :destroy]
223
  # additional routes for having the file name at the end of url
224
  map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
225
  map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
226

    
227
  map.resources :groups, :member => {:autocomplete_for_user => :get}
228
  map.group_users 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :conditions => {:method => :post}
229
  map.group_user  'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :conditions => {:method => :delete}
230

    
231
  map.resources :trackers, :except => :show
232
  map.resources :issue_statuses, :except => :show, :collection => {:update_issue_done_ratio => :post}
233

    
234
  #left old routes at the bottom for backwards compat
235
  map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
236
  map.connect 'projects/:project_id/members/:action', :controller => 'members'
237
  map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
238
  map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
239
  map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
240
  map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
241
  map.connect 'projects/:project_id/news/:action', :controller => 'news'
242
  map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
243
  map.with_options :controller => 'repositories' do |omap|
244
    omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
245
    omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
246
    omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
247
    omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
248
    omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
249
    omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
250
  end
251

    
252
  map.with_options :controller => 'sys' do |sys|
253
    sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
254
    sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
255
    sys.connect 'sys/projects/:id/external_repository.:format', :action => 'get_external_repo_url', :conditions => {:method => :get}
256
    sys.connect 'sys/projects/:id/embedded.:format', :action => 'set_embedded_active', :conditions => { :method => :post }
257
    sys.connect 'sys/projects/:id/repository_cache.:format', :action => 'clear_repository_cache', :conditions => {:method => :post}
258
  end
259

    
260
  # Install the default route as the lowest priority.
261
  map.connect ':controller/:action/:id'
262
  map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
263
  # Used for OpenID
264
  map.root :controller => 'account', :action => 'login'
265
end