tinyforms/config/routes.rb
2020-04-15 14:53:33 +02:00

33 lines
1.3 KiB
Ruby

Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources :forms do
member { get :form }
resources :submissions
end
# short link for submission file uploads
# we add the filename as part of the URL which allows e.g. Airtable to identify and name the file properly
# the constraint makes sure that a . (dot) can be in the filename. e.g. cat.jpg
get '/s/:form_id/:submission_id/:id(/:filename)' => 'file_uploads#show', as: :file_upload, constraints: { filename: /[^\/]+/ }
# form post url to save new submissions
post '/s/:form_id' => 'submissions#create', as: :submission
# short URL for form page
get '/s/:id/form' => 'forms#form', as: :form_submitter
get 'oauth/callback', to: 'oauths#callback'
get 'oauth/:provider', to: 'oauths#oauth', as: :auth_at_provider
get '/signup' => 'sessions#new', as: :signup # TODO: add proper signup page
get '/login' => 'sessions#new', as: :login
get '/logout' => 'sessions#destroy', as: :logout
get '/auth' => 'sessions#auth', as: :auth
get '/demo(/:backend)' => 'home#demo', as: :demo
get '/contact' => 'home#contact', as: :contact
get '/help', to: redirect('https://www.notion.so/Tinyforms-Help-Center-04f13b5908bc46cfb4283079a3cb1149')
root 'home#index'
end