require 'sidekiq/web'

Diffux::Application.routes.draw do
  mount Sidekiq::Web => '/sidekiq'
  resources :refresh, only: :create

  scope '/:locale' do
    get 'static_pages/about'

    resources :projects do
      resources :sweeps, only: %i[index show new create] do
        collection do
          post :trigger
        end
      end
    end
    resources :urls,      only: %i[destroy show]
    resources :viewports, only: %i[edit update]

    resources :snapshots, only: %i[show create destroy] do
      member do
        post :accept
        post :reject
        post :take_snapshot
        post :compare_snapshot
        get  :view_log
      end
    end

    root to: 'projects#index'
  end

  get '/', to: redirect('/en')
end

require 'sidekiq/web'

Diffux::Application.routes.draw do
  mount Sidekiq::Web => '/sidekiq'

  scope '(:locale)' do
    get 'static_pages/about'

    resources :projects do
      resources :sweeps, only: %i[index show new create] do
        collection do
          post :trigger
        end
      end
    end
    resources :urls,      only: %i[destroy show]
    resources :viewports, only: %i[edit update]

    resources :snapshots, only: %i[show create destroy] do
      member do
        post :accept
        post :reject
        post :take_snapshot
        post :compare_snapshot
        get  :view_log
      end
    end

    resources :refresh, only: :create

    root to: 'projects#index'
  end
end

Allow locale in URL to be optional
Allow locale in URL to be optional

When I first added URL-based locale specification, I made it required
and had `/` redirect to `/en`. However, I realized that it would be
better to just make it optional. This will allow routes like refresh and
sweep triggering to work as they did without any change, but to also
optionally specify a locale.

Change-Id: Ib75ffe8bb4c2396dd41f9e89d788ed368255682c
