/
routes.rb
295 lines (232 loc) · 11.2 KB
/
routes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
require 'lib/rest'
ActionController::Routing::Routes.draw do |map|
# rest routes
rest_routes(map)
# LoD routes
if Conf.rdfgen_enable
map.connect '/:contributable_type/:contributable_id/attributions/:attribution_id.:format',
:controller => 'linked_data', :action => 'attributions'
map.connect '/:contributable_type/:contributable_id/citations/:citation_id.:format',
:controller => 'linked_data', :action => 'citations'
map.connect '/:contributable_type/:contributable_id/comments/:comment_id.:format',
:controller => 'linked_data', :action => 'comments'
map.connect '/:contributable_type/:contributable_id/credits/:credit_id.:format',
:controller => 'linked_data', :action => 'credits'
map.connect '/users/:user_id/favourites/:favourite_id.:format',
:controller => 'linked_data', :action => 'favourites'
map.connect '/packs/:contributable_id/local_pack_entries/:local_pack_entry_id.:format',
:controller => 'linked_data', :action => 'local_pack_entries',
:contributable_type => 'packs'
map.connect '/packs/:contributable_id/remote_pack_entries/:remote_pack_entry_id.:format',
:controller => 'linked_data', :action => 'remote_pack_entries',
:contributable_type => 'packs'
map.connect '/:contributable_type/:contributable_id/policies/:policy_id.:format',
:controller => 'linked_data', :action => 'policies'
map.connect '/:contributable_type/:contributable_id/ratings/:rating_id.:format',
:controller => 'linked_data', :action => 'ratings'
map.connect '/tags/:tag_id/taggings/:tagging_id.:format',
:controller => 'linked_data', :action => 'taggings'
end
map.content '/content', :controller => 'content', :action => 'index', :conditions => { :method => :get }
map.formatted_content '/content.:format', :controller => 'content', :action => 'index', :conditions => { :method => :get }
# Runners
map.resources :runners, :member => { :verify => :get }
# Experiments
map.resources :experiments do |e|
# Experiments have nested Jobs
e.resources :jobs,
:member => { :save_inputs => :post,
:submit_job => :post,
:refresh_status => :get,
:refresh_outputs => :get,
:outputs_xml => :get,
:outputs_package => :get,
:rerun => :post,
:render_output => :get }
end
# Ontologies
map.resources :ontologies
# Predicates
map.resources :predicates
# mashup
map.resource :mashup
# search
map.resource :search,
:member => { :live_search => :get, :open_search_beta => :get }
# tags
map.resources :tags
# sessions and RESTful authentication
map.resource :session
# openid authentication
map.resource :openid
# packs
map.resources :packs,
:collection => { :search => :get },
:member => { :statistics => :get,
:favourite => :post,
:favourite_delete => :delete,
:tag => :post,
:new_item => :get,
:create_item => :post,
:edit_item => :get,
:update_item => :put,
:destroy_item => :delete,
:download => :get,
:quick_add => :post,
:resolve_link => :post,
:items => :get } do |pack|
pack.resources :comments, :collection => { :timeline => :get }
pack.resources :relationships, :collection => { :edit_relationships => :get }
end
# workflows (downloadable)
map.resources :workflows,
:collection => { :search => :get },
:member => { :new_version => :get,
:download => :get,
:launch => :get,
:statistics => :get,
:favourite => :post,
:favourite_delete => :delete,
:rate => :post,
:tag => :post,
:create_version => :post,
:destroy_version => :delete,
:edit_version => :get,
:update_version => :put,
:process_tag_suggestions => :post,
:tag_suggestions => :get } do |workflow|
# workflows have nested citations
workflow.resources :citations
workflow.resources :reviews
workflow.resources :previews
workflow.resources :comments, :collection => { :timeline => :get }
end
# workflow redirect for linked data model
map.workflow_version '/workflows/:id/versions/:version', :conditions => { :method => :get }, :controller => 'workflows', :action => 'show'
map.formatted_workflow_version '/workflows/:id/versions/:version.:format', :conditions => { :method => :get }, :controller => 'workflows', :action => 'show'
# versioned preview images
['workflow'].each do |x|
eval("map.#{x}_version_preview '/#{x.pluralize}/:#{x}_id/versions/:version/previews/:id'," +
" :conditions => { :method => :get}, :controller => 'previews', :action => 'show'")
eval("map.formatted_#{x}_version_preview '/#{x.pluralize}/:#{x}_id/versions/:version/previews/:id.:format'," +
" :conditions => { :method => :get}, :controller => 'previews', :action => 'show'")
end
map.galaxy_tool 'workflows/:id/versions/:version/galaxy_tool', :controller => 'workflows', :action => 'galaxy_tool'
map.galaxy_tool_download 'workflows/:id/versions/:version/galaxy_tool_download', :controller => 'workflows', :action => 'galaxy_tool_download'
# curation
['workflows', 'files', 'packs'].each do |contributable_type|
map.curation "#{contributable_type}/:contributable_id/curation",
:contributable_type => contributable_type,
:controller => 'contributions',
:action => 'curation',
:conditions => { :method => :get }
end
# files (downloadable)
map.resources :files,
:controller => :blobs,
:collection => { :search => :get },
:member => { :download => :get,
:statistics => :get,
:favourite => :post,
:favourite_delete => :delete,
:rate => :post,
:tag => :post } do |file|
# Due to restrictions in the version of Rails used (v1.2.3),
# we cannot have reviews as nested resources in more than one top level resource.
# ie: we cannot have polymorphic nested resources.
#file.resources :reviews
file.resources :comments, :collection => { :timeline => :get }
end
# blogs
map.resources :blogs do |blog|
# blogs have nested posts
blog.resources :blog_posts
end
# services
map.resources :services, :collection => { :search => :get }
# content_types
map.resources :content_types
# all downloads and viewings
map.resources :downloads, :viewings
# messages
map.resources :messages, :collection => { :sent => :get, :delete_all_selected => :delete }
# all ***ship's
map.resources :memberships, :friendships
# all oauth
map.oauth '/oauth',:controller=>'oauth',:action=>'index'
map.authorize '/oauth/authorize',:controller=>'oauth',:action=>'authorize'
map.request_token '/oauth/request_token',:controller=>'oauth',:action=>'request_token'
map.access_token '/oauth/access_token',:controller=>'oauth',:action=>'access_token'
map.test_request '/oauth/test_request',:controller=>'oauth',:action=>'test_request'
# User timeline
map.connect 'users/timeline', :controller => 'users', :action => 'timeline'
map.connect 'users/users_for_timeline', :controller => 'users', :action => 'users_for_timeline'
# For email confirmations (user accounts)
map.connect 'users/confirm_email/:hash', :controller => "users", :action => "confirm_email"
# For password resetting (user accounts)
map.connect 'users/forgot_password', :controller => "users", :action => "forgot_password"
map.connect 'users/reset_password/:reset_code', :controller => "users", :action => "reset_password"
[ 'news', 'friends', 'groups', 'workflows', 'files', 'packs', 'forums', 'blogs', 'credits', 'tags', 'favourites' ].each do |tab|
map.connect "users/:id/#{tab}", :controller => 'users', :action => tab
end
# all users
map.resources :users,
:collection => { :all => :get,
:search => :get,
:invite => :get } do |user|
# friendships 'owned by' user (user --> friendship --> friend)
user.resources :friendships, :member => { :accept => :post }
# memberships 'owned by' user (user --> membership --> network)
user.resources :memberships, :member => { :accept => :post }
# user profile
user.resource :profile, :controller => :profiles
# pictures 'owned by' user
user.resources :pictures, :member => { :select => :get }
# user's history
user.resource :userhistory, :controller => :userhistory
# user's reports of inappropriate content
user.resources :reports, :controller => :user_reports
end
map.resources :groups,
:controller => :networks,
:collection => { :all => :get, :search => :get },
:member => { :invite => :get,
:membership_invite => :post,
:membership_invite_external => :post,
:membership_request => :get,
:rate => :post,
:tag => :post } do |group|
group.resources :announcements, :controller => :group_announcements
group.resources :comments, :collection => { :timeline => :get }
end
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
# map.connect '', :controller => 'users'
# Explicit redirections
map.connect 'exercise', :controller => 'redirects', :action => 'exercise'
map.connect 'google', :controller => 'redirects', :action => 'google'
map.connect 'benchmarks', :controller => 'redirects', :action => 'benchmarks'
# alternate download link to work around lack of browser redirects when downloading
map.connect ':controller/:id/download/:name', :action => 'named_download', :requirements => { :name => /.*/ }
map.connect 'files/:id/download/:name', :controller => 'blobs', :action => 'named_download', :requirements => { :name => /.*/ }
# map.connect 'topics', :controller => 'topics', :action => 'index'
map.connect 'topics/tag_feedback', :controller => 'topics', :action => 'tag_feedback'
map.connect 'topics/topic_feedback', :controller => 'topics', :action => 'topic_feedback'
map.resources :topics
# map.connect 'topics/:id', :controller => 'topics', :action => 'show'
# (general) announcements
# NB! this is moved to the bottom of the file for it to be discovered
# before 'announcements' resource within 'groups'
map.resources :announcements
map.resources :licenses
map.resources :license_attributes
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end