2021-02-03 16:09:17 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-10-12 11:08:32 -04:00
|
|
|
resources :snippets, except: [:create, :update, :destroy], concerns: :awardable, constraints: { id: /\d+/ } do
|
2016-10-05 11:43:47 -04:00
|
|
|
member do
|
2017-04-30 13:15:20 -04:00
|
|
|
get :raw
|
2017-02-01 13:15:59 -05:00
|
|
|
post :mark_as_spam
|
2017-05-03 11:26:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
collection do
|
2017-04-20 04:56:41 -04:00
|
|
|
post :preview_markdown
|
2016-10-05 11:43:47 -04:00
|
|
|
end
|
2017-04-27 06:41:26 -04:00
|
|
|
|
|
|
|
scope module: :snippets do
|
|
|
|
resources :notes, only: [:index, :create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do
|
|
|
|
member do
|
|
|
|
delete :delete_attachment
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-10-05 11:43:47 -04:00
|
|
|
end
|
|
|
|
|
2020-07-23 11:09:28 -04:00
|
|
|
get '/snippets/:snippet_id/raw/:ref/*path',
|
|
|
|
to: 'snippets/blobs#raw',
|
|
|
|
as: :snippet_blob_raw,
|
|
|
|
format: false,
|
|
|
|
constraints: { snippet_id: /\d+/ }
|
2020-06-22 08:08:47 -04:00
|
|
|
|
2019-06-25 11:37:47 -04:00
|
|
|
get '/s/:username', to: redirect('users/%{username}/snippets'),
|
2016-10-05 11:43:47 -04:00
|
|
|
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
|