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 @ 394:7ba3ba2a0f63

History | View | Annotate | Download (14.4 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.connect 'projects/:project_id/time_entries/report', :controller => 'time_entry_reports', :action => 'report'
18
  map.with_options :controller => 'time_entry_reports', :action => 'report',:conditions => {:method => :get} do |time_report|
19
    time_report.connect 'time_entries/report'
20
    time_report.connect 'time_entries/report.:format'
21
    time_report.connect 'projects/:project_id/time_entries/report.:format'
22
  end
23

    
24
  # TODO: wasteful since this is also nested under issues, projects, and projects/issues
25
  map.resources :time_entries, :controller => 'timelog'
26
  
27
  map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post}
28
  map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get}
29
  map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post}
30
  
31
  map.with_options :controller => 'messages' do |messages_routes|
32
    messages_routes.with_options :conditions => {:method => :get} do |messages_views|
33
      messages_views.connect 'boards/:board_id/topics/new', :action => 'new'
34
      messages_views.connect 'boards/:board_id/topics/:id', :action => 'show'
35
      messages_views.connect 'boards/:board_id/topics/:id/edit', :action => 'edit'
36
    end
37
    messages_routes.with_options :conditions => {:method => :post} do |messages_actions|
38
      messages_actions.connect 'boards/:board_id/topics/new', :action => 'new'
39
      messages_actions.connect 'boards/:board_id/topics/:id/replies', :action => 'reply'
40
      messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/
41
    end
42
  end
43
  
44
  map.with_options :controller => 'boards' do |board_routes|
45
    board_routes.with_options :conditions => {:method => :get} do |board_views|
46
      board_views.connect 'projects/:project_id/boards', :action => 'index'
47
      board_views.connect 'projects/:project_id/boards/new', :action => 'new'
48
      board_views.connect 'projects/:project_id/boards/:id', :action => 'show'
49
      board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show'
50
      board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit'
51
    end
52
    board_routes.with_options :conditions => {:method => :post} do |board_actions|
53
      board_actions.connect 'projects/:project_id/boards', :action => 'new'
54
      board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/
55
    end
56
  end
57
  
58
  map.with_options :controller => 'documents' do |document_routes|
59
    document_routes.with_options :conditions => {:method => :get} do |document_views|
60
      document_views.connect 'projects/:project_id/documents', :action => 'index'
61
      document_views.connect 'projects/:project_id/documents/new', :action => 'new'
62
      document_views.connect 'documents/:id', :action => 'show'
63
      document_views.connect 'documents/:id/edit', :action => 'edit'
64
    end
65
    document_routes.with_options :conditions => {:method => :post} do |document_actions|
66
      document_actions.connect 'projects/:project_id/documents', :action => 'new'
67
      document_actions.connect 'documents/:id/:action', :action => /destroy|edit/
68
    end
69
  end
70

    
71
  map.resources :issue_moves, :only => [:new, :create], :path_prefix => '/issues', :as => 'move'
72

    
73
  # Misc issue routes. TODO: move into resources
74
  map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes', :action => 'issues'
75
  map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' # TODO: would look nicer as /issues/:id/preview
76
  map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
77
  map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
78
  map.bulk_edit_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_edit', :conditions => { :method => :get }
79
  map.bulk_update_issue 'issues/bulk_edit', :controller => 'issues', :action => 'bulk_update', :conditions => { :method => :post }
80
  map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
81
  map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
82

    
83
  map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
84
  map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
85
  map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
86
  map.resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update]
87

    
88
  map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
89
    reports.connect 'projects/:id/issues/report', :action => 'issue_report'
90
    reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
91
  end
92

    
93
  # Following two routes conflict with the resources because #index allows POST
94
  map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
95
  map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post }
96
  
97
  map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues|
98
    issues.resources :time_entries, :controller => 'timelog'
99
  end
100
  
101
  map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues|
102
    issues.resources :time_entries, :controller => 'timelog'
103
  end
104

    
105
  map.with_options  :controller => 'issue_relations', :conditions => {:method => :post} do |relations|
106
    relations.connect 'issues/:issue_id/relations/:id', :action => 'new'
107
    relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
108
  end
109

    
110
  map.connect 'projects/:id/members/new', :controller => 'members', :action => 'new'
111

    
112
  map.with_options :controller => 'users' do |users|
113
    users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get}
114
    
115
    users.with_options :conditions => {:method => :post} do |user_actions|
116
      user_actions.connect 'users/:id/memberships', :action => 'edit_membership'
117
      user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership'
118
      user_actions.connect 'users/:id/memberships/:membership_id/destroy', :action => 'destroy_membership'
119
    end
120
  end
121

    
122
  map.resources :users, :member => {
123
    :edit_membership => :post,
124
    :destroy_membership => :post
125
  },
126
  :except => [:destroy]
127

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

    
131
  map.all_news 'news', :controller => 'news', :action => 'index'
132
  map.formatted_all_news 'news.:format', :controller => 'news', :action => 'index'
133
  map.preview_news '/news/preview', :controller => 'previews', :action => 'news'
134
  map.connect 'news/:id/comments', :controller => 'comments', :action => 'create', :conditions => {:method => :post}
135
  map.connect 'news/:id/comments/:comment_id', :controller => 'comments', :action => 'destroy', :conditions => {:method => :delete}
136

    
137
  map.resources :projects, :member => {
138
    :copy => [:get, :post],
139
    :settings => :get,
140
    :modules => :post,
141
    :overview => :post,
142
    :archive => :post,
143
    :unarchive => :post
144
  } do |project|
145
    project.resource :project_enumerations, :as => 'enumerations', :only => [:update, :destroy]
146
    project.resources :files, :only => [:index, :new, :create]
147
    project.resources :versions, :collection => {:close_completed => :put}, :member => {:status_by => :post}
148
    project.resources :news, :shallow => true
149
    project.resources :time_entries, :controller => 'timelog', :path_prefix => 'projects/:project_id'
150

    
151
    project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
152
    project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
153
    project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
154
    project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
155
    project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
156
    project.resources :wiki, :except => [:new, :create], :member => {
157
      :rename => [:get, :post],
158
      :history => :get,
159
      :preview => :any,
160
      :protect => :post,
161
      :add_attachment => :post
162
    }, :collection => {
163
      :export => :get,
164
      :date_index => :get
165
    }
166

    
167
  end
168

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

    
172
  # TODO: port to be part of the resources route(s)
173
  map.with_options :controller => 'projects' do |project_mapper|
174
    project_mapper.with_options :conditions => {:method => :get} do |project_views|
175
      project_views.connect 'projects/:id/settings/:tab', :controller => 'projects', :action => 'settings'
176
      project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new'
177
    end
178
  end
179
  
180
  map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity|
181
    activity.connect 'projects/:id/activity'
182
    activity.connect 'projects/:id/activity.:format'
183
    activity.connect 'activity', :id => nil
184
    activity.connect 'activity.:format', :id => nil
185
  end
186

    
187
    
188
  map.with_options :controller => 'issue_categories' do |categories|
189
    categories.connect 'projects/:project_id/issue_categories/new', :action => 'new'
190
  end
191
  
192
  map.with_options :controller => 'repositories' do |repositories|
193
    repositories.with_options :conditions => {:method => :get} do |repository_views|
194
      repository_views.connect 'projects/:id/repository', :action => 'show'
195
      repository_views.connect 'projects/:id/repository/edit', :action => 'edit'
196
      repository_views.connect 'projects/:id/repository/statistics', :action => 'stats'
197
      repository_views.connect 'projects/:id/repository/revisions', :action => 'revisions'
198
      repository_views.connect 'projects/:id/repository/revisions.:format', :action => 'revisions'
199
      repository_views.connect 'projects/:id/repository/revisions/:rev', :action => 'revision'
200
      repository_views.connect 'projects/:id/repository/revisions/:rev/diff', :action => 'diff'
201
      repository_views.connect 'projects/:id/repository/revisions/:rev/diff.:format', :action => 'diff'
202
      repository_views.connect 'projects/:id/repository/revisions/:rev/raw/*path', :action => 'entry', :format => 'raw', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
203
      repository_views.connect 'projects/:id/repository/revisions/:rev/:action/*path', :requirements => { :rev => /[a-z0-9\.\-_]+/ }
204
      repository_views.connect 'projects/:id/repository/raw/*path', :action => 'entry', :format => 'raw'
205
      # TODO: why the following route is required?
206
      repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry'
207
      repository_views.connect 'projects/:id/repository/:action/*path'
208
    end
209
    
210
    repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post}
211
  end
212
  
213
  map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/
214
  map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/
215
  map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/
216
   
217
  map.resources :groups
218
  
219
  #left old routes at the bottom for backwards compat
220
  map.connect 'projects/:project_id/issues/:action', :controller => 'issues'
221
  map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
222
  map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
223
  map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
224
  map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki'
225
  map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations'
226
  map.connect 'projects/:project_id/news/:action', :controller => 'news'  
227
  map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
228
  map.with_options :controller => 'repositories' do |omap|
229
    omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
230
    omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
231
    omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
232
    omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
233
    omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
234
    omap.connect 'repositories/revision/:id/:rev', :action => 'revision'
235
  end
236
  
237
  map.with_options :controller => 'sys' do |sys|
238
    sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get}
239
    sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post}
240
    sys.connect 'sys/projects/:id/external-repository.:format', :action => 'get_external_repo_url', :conditions => {:method => :get}
241
    sys.connect 'sys/projects/:id/embedded.:format', :action => 'set_embedded_active', :conditions => { :method => :post }
242
  end
243
 
244
  # Install the default route as the lowest priority.
245
  map.connect ':controller/:action/:id'
246
  map.connect 'robots.txt', :controller => 'welcome', :action => 'robots'
247
  # Used for OpenID
248
  map.root :controller => 'account', :action => 'login'
249
end