forked from otwcode/otwarchive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.rb
636 lines (585 loc) · 15.5 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
Otwarchive::Application.routes.draw do
devise_scope :admin do
get "admin/logout" => "admin/sessions#confirm_logout"
end
devise_for :admin,
module: "admin",
only: :sessions,
controllers: { sessions: "admin/sessions" },
path_names: {
sign_in: "login",
sign_out: "logout"
}
devise_scope :user do
get "signup(/:invitation_token)" => "users/registrations#new", as: "signup"
get "users/logout" => "users/sessions#confirm_logout"
end
devise_for :users,
module: "users",
controllers: {
sessions: "users/sessions",
registrations: "users/registrations",
passwords: "users/passwords"
},
path_names: {
sign_in: "login",
sign_out: "logout"
}
#### ERRORS ####
get '/403', to: 'errors#403'
get '/404', to: 'errors#404'
get '/422', to: 'errors#422'
get '/500', to: 'errors#500'
get '/auth_error', to: 'errors#auth_error'
#### DOWNLOADS ####
get 'downloads/:id/:download_title.:format' => 'downloads#show', as: 'download'
#### OPEN DOORS ####
namespace :opendoors do
resources :tools, only: [:index] do
collection do
post :url_update
end
end
resources :external_authors do
member do
post :forward
end
end
end
#### INVITATIONS ####
resources :invitations
resources :user_invite_requests
resources :invite_requests do
collection do
get :manage
post :reorder
get :status
end
end
get 'claim/:invitation_token' => 'external_authors#claim', as: 'claim'
post 'complete_claim/:invitation_token' => 'external_authors#complete_claim', as: 'complete_claim'
#### TAGS ####
resources :media do
resources :fandoms
end
resources :fandoms do
collection do
get :unassigned
end
get :show
end
resources :tag_wranglings do
collection do
post :wrangle
get :discuss
end
end
resources :tag_wranglers
resources :unsorted_tags do
collection do
post :mass_update
end
end
resources :tags do
member do
get :feed
post :mass_update
get :remove_association
get :wrangle
end
collection do
get :show_hidden
get :search
end
resources :works
resources :bookmarks
resources :comments
resource :troubleshooting, controller: :troubleshooting, only: [:show, :update]
end
resources :tag_sets, controller: 'owned_tag_sets' do
resources :nominations, controller: 'tag_set_nominations' do
collection do
put :update_multiple
delete :destroy_multiple
get :confirm_destroy_multiple
end
member do
get :confirm_delete
end
end
resources :associations, controller: 'tag_set_associations', only: [:index] do
collection do
put :update_multiple
end
end
member do
get :batch_load
put :do_batch_load
get :confirm_delete
end
collection do
get :show_options
end
end
resources :tag_nominations, only: [:update]
resources :tag_wrangling_requests, only: [:index] do
collection do
patch :update_multiple
end
end
#### ADMIN ####
resources :admin_posts do
resources :comments
end
namespace :admin do
resources :activities, only: [:index, :show]
resources :banners do
member do
get :confirm_delete
end
end
resources :blacklisted_emails, only: [:index, :new, :create, :destroy]
resources :settings
resources :skins do
collection do
get :index_rejected
get :index_approved
end
end
resources :spam, only: [:index] do
collection do
post :bulk_update
end
end
resources :user_creations, only: [:destroy] do
member do
put :hide
put :set_spam
end
end
resources :users, controller: 'admin_users' do
member do
get :confirm_delete_user_creations
post :destroy_user_creations
post :activate
post :send_activation
get :check_user
end
collection do
get :bulk_search
post :bulk_search
post :update
post :update_status
end
end
resources :invitations, controller: 'admin_invitations' do
collection do
post :invite_from_queue
post :grant_invites_to_users
get :find
end
end
resources :api
end
resources :admins, only: [:index]
post '/admin/api/new', to: 'admin/api#create'
#### USERS ####
resources :people, only: [:index] do
collection do
get :search
end
end
# When adding new nested resources, please keep them in alphabetical order
resources :users, except: [:new, :create] do
member do
get :change_email
post :changed_email
get :change_password
post :changed_password
get :change_username
post :changed_username
post :end_first_login
post :end_banner
post :end_tos_prompt
end
resources :assignments, controller: "challenge_assignments", only: [:index]
resources :claims, controller: "challenge_claims", only: [:index]
resources :bookmarks
resources :collection_items, only: [:index, :update, :destroy] do
collection do
patch :update_multiple
end
end
resources :collections, only: [:index]
resources :comments do
member do
put :approve
put :reject
end
end
resource :creatorships, controller: "creatorships", only: [:show, :update]
resources :external_authors do
resources :external_author_names
end
resources :favorite_tags, only: [:create, :destroy]
resources :gifts, only: [:index]
resource :inbox, controller: "inbox" do
member do
get :reply
post :delete
end
end
resources :invitations do
collection do
post :invite_friend
end
collection do
get :manage
end
end
resources :nominations, controller: "tag_set_nominations", only: [:index]
resources :preferences, only: [:index, :update]
resource :profile, only: [:show], controller: "profile"
resources :pseuds do
resources :works
resources :series
resources :bookmarks
end
resources :readings do
collection do
post :clear
end
end
resources :related_works
resources :series do
member do
get :manage
end
resources :serial_works
end
resources :signups, controller: "challenge_signups", only: [:index]
resources :skins, only: [:index]
resources :stats, only: [:index]
resources :subscriptions, only: [:index, :create, :destroy]
resources :tag_sets, controller: "owned_tag_sets", only: [:index]
resources :works do
collection do
get :drafts
get :collected
get :show_multiple
post :edit_multiple
patch :update_multiple
post :delete_multiple
end
end
end
#### WORKS ####
resources :works do
collection do
post :import
get :search
end
member do
get :preview
post :post
put :post_draft
get :navigate
get :edit_tags
get :preview_tags
patch :update_tags
get :mark_for_later
get :mark_as_read
get :confirm_delete
get :share
end
resources :bookmarks
resources :chapters do
collection do
get :manage
post :update_positions
end
member do
get :preview
post :post
get :confirm_delete
end
resources :comments
end
resources :collections
resources :collection_items
resources :comments do
member do
put :approve
put :reject
end
collection do
get :unreviewed
put :review_all
end
end
resource :hit_count, controller: :hit_count, only: [:create]
resources :kudos, only: [:index]
resources :links, controller: "work_links", only: [:index]
resource :troubleshooting, controller: :troubleshooting, only: [:show, :update]
end
resources :chapters do
member do
get :preview
post :post
end
resources :comments
end
resources :external_works do
collection do
get :compare
post :merge
get :fetch
end
resources :bookmarks
resources :related_works
end
resources :related_works
resources :serial_works
resources :series do
member do
get :confirm_delete
get :manage
post :update_positions
end
resources :bookmarks
end
#### COLLECTIONS ####
resources :gifts, only: [:index] do
member do
post :toggle_rejected
end
end
resources :collections do
collection do
get :list_challenges
get :list_ge_challenges
get :list_pm_challenges
end
member do
get :confirm_delete
end
resource :profile, controller: "collection_profile"
resources :collections
resources :works
resources :gifts
resources :bookmarks
resources :media
resources :fandoms
resources :people
resources :prompts
resources :tags do
resources :works
end
resources :participants, controller: "collection_participants", only: [:index, :update, :destroy] do
collection do
get :add
get :join
end
end
resources :items, controller: "collection_items" do
collection do
patch :update_multiple
end
end
resources :signups, controller: "challenge_signups" do
collection do
get :summary
end
member do
get :confirm_delete
end
end
resources :assignments, controller: "challenge_assignments", only: [:index, :show] do
collection do
get :confirm_purge
get :generate
put :set
post :purge
get :send_out
put :update_multiple
get :default_all
end
member do
get :default
end
end
resources :claims, controller: "challenge_claims" do
collection do
patch :set
get :purge
end
end
resources :potential_matches do
collection do
get :generate
get :cancel_generate
get :regenerate_for_signup
end
end
resources :requests, controller: "challenge_requests"
# challenge types
resource :gift_exchange, controller: "challenge/gift_exchange" do
member do
get :confirm_delete
end
end
resource :prompt_meme, controller: "challenge/prompt_meme" do
member do
get :confirm_delete
end
end
end
#### I18N ####
# should stay below the main works mapping
resources :languages do
resources :works
resources :admin_posts
end
resources :locales, except: :destroy
#### API ####
namespace :api do
namespace :v2 do
resources :bookmarks, only: [:create], defaults: { format: :json }
resources :works, only: [:create], defaults: { format: :json }
post 'bookmarks/search', to: 'bookmarks#search'
post 'works/search', to: 'works#search'
end
end
#### MISC ####
resources :comments do
member do
put :approve
put :freeze
put :reject
put :review
put :unfreeze
end
collection do
get :hide_comments
get :show_comments
get :add_comment
get :cancel_comment
get :add_comment_reply
get :cancel_comment_reply
get :cancel_comment_edit
get :delete_comment
get :cancel_comment_delete
end
resources :comments
end
resources :bookmarks do
collection do
get :search
end
member do
get :confirm_delete
get :share
end
resources :collection_items
end
resources :kudos, only: [:create]
resources :skins do
member do
get :preview
get :set
get :confirm_delete
end
collection do
get :unset
end
end
resources :known_issues
resources :archive_faqs, path: "faq" do
member do
get :confirm_delete
end
collection do
get :manage
post :update_positions
end
resources :questions do
collection do
get :manage
post :update_positions
end
end
end
resources :wrangling_guidelines do
member do
get :confirm_delete
end
collection do
get :manage
post :update_positions
end
end
resource :redirect, controller: "redirect", only: [:show] do
member do
get :do_redirect
end
end
resources :abuse_reports, only: [:new, :create]
resources :external_authors do
resources :external_author_names
end
resources :orphans, only: [:index, :new, :create]
get 'search' => 'works#search'
post 'support' => 'feedbacks#create', as: 'feedbacks'
get 'support' => 'feedbacks#new', as: 'new_feedback_report'
get 'tos' => 'home#tos'
get 'tos_faq' => 'home#tos_faq'
get 'unicorn_test' => 'home#unicorn_test'
get 'dmca' => 'home#dmca'
get 'diversity' => 'home#diversity'
get 'site_map' => 'home#site_map'
get 'site_pages' => 'home#site_pages'
get 'first_login_help' => 'home#first_login_help'
get 'token_dispenser' => 'home#token_dispenser'
get 'delete_confirmation' => 'users#delete_confirmation'
get 'activate/:id' => 'users#activate', as: 'activate'
get 'devmode' => 'devmode#index'
get 'donate' => 'home#donate'
get 'lost_cookie' => 'home#lost_cookie'
get 'about' => 'home#about'
get 'menu/browse' => 'menu#browse'
get 'menu/fandoms' => 'menu#fandoms'
get 'menu/search' => 'menu#search'
get 'menu/about' => 'menu#about'
# The priority is based upon order of creation:
# first created -> highest priority.
root to: "home#index"
# See how all your routes lay out with "rake routes"
# These are whitelisted routes that are proven to be used throughout the
# application, which previously relied on a deprecated catch-all route definition
# (`get ':controller(/:action(/:id(.:format)))'`) to work.
#
# They are generally not RESTful and in some cases are *almost* duplicates of
# existing routes defined above, but due to how extensively they are used
# throughout the application must exist until forms, controllers, and tests
# can be refactored to not rely on their existence.
#
# Note written on August 1, 2017 during upgrade to Rails 5.1.
get '/bookmarks/fetch_recent/:id' => 'bookmarks#fetch_recent', as: :fetch_recent_bookmarks
get '/bookmarks/hide_recent/:id' => 'bookmarks#hide_recent', as: :hide_recent_bookmarks
get '/invite_requests/show' => 'invite_requests#show', as: :show_invite_request
get '/user_invite_requests/update' => 'user_invite_requests#update'
patch '/admin/skins/update' => 'admin_skins#update', as: :update_admin_skin
get "/admin/admin_users/troubleshoot/:id" => "admin/admin_users#troubleshoot", as: :troubleshoot_admin_user
# TODO: rewrite the autocomplete controller to deal with the fact that
# there are fifty different actions going on in there
get '/autocomplete/:action' => 'autocomplete#%{action}'
get '/challenges/no_collection' => 'challenges#no_collection'
get '/challenges/no_challenge' => 'challenges#no_challenge'
get '/works/clean_work_search_params' => 'works#clean_work_search_params'
get '/works/collected' => 'works#collected'
get '/works/drafts' => 'works#drafts'
post '/works/edit_multiple/:id' => 'works#edit_multiple'
post '/works/confirm_delete_multiple/:id' => 'works#confirm_delete_multiple'
post '/works/delete_multiple/:id' => 'works#delete_multiple'
put '/works/update_multiple' => 'works#update_multiple'
end