routes.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. Rails.application.routes.draw do
  2. scope '(:locale)', locale: /#{I18n.available_locales.join('|')}/ do
  3. end
  4. # Profile page
  5. get "/:locale/profile", to: "profile#index", defaults: { locale: I18n.locale }, as: "profile"
  6. get "/profile/", to: "profile#index", as: "profile_canonical"
  7. # Project list
  8. get "/projects", to: "projects#index" , as: "projects_canonical"
  9. get "/:locale/projects", to: "projects#index", defaults: { locale: I18n.locale }, as: "project_index"
  10. # Project view
  11. get "/projects/:permalink", to: "projects#show", as: "project_canonical"
  12. get "/:locale/projects/:permalink", to: "projects#show", defaults: { locale: I18n.locale }, as: 'project_show'
  13. # Help page
  14. get "/help", to: "help#index", as: "help_canonical"
  15. get "/:locale/help", to: "help#index", defaults: { locale: I18n.locale }, as: 'help'
  16. # Main page
  17. root "main#index"
  18. get "/:locale", to: "main#index", defaults: { locale: I18n.locale }, as: "main"
  19. # Contact form
  20. post "/contact", to: "contact#create", defaults: { locale: I18n.locale }, as: 'contact_create'
  21. # Error pages
  22. # Redirect to 404, but only for files without extension and content type HTML
  23. get '*unmatched_route', :to => 'error#error_404', format: false, constraints: { format: 'text/html' }
  24. end