Rails.application.routes.draw do
  namespace :admin do
    resources :sites, param: :slug do
      resources :site_steps, only: [:show, :update, :edit]
    end
    resources :site_steps, only: [:show, :update, :new]
    resources :users
    resources :routes
    resources :site_templates
    resources :page_templates
    resources :site_users
    resources :datasets, only: :index do
      get 'dataset'
    end
    get '/', to: redirect('/admin/sites')
    resources :contexts
  end

  namespace :management do
    resources :sites, param: :slug, only: [:index], defaults: {format: :json} do
      resources :site_pages, shallow: true do
        member do
          put :toggle_enable
        end
      end
      get '/structure', to: 'sites#structure'
      put :update_structure
    end
    get '/', to: 'static_page#dashboard'
  end
  get '/no-permissions', to: 'static_page#no_permissions'

  # Auth
  get 'auth/login', to: 'auth#login'
  post 'auth/logout', to: 'auth#logout'

   DynamicRouter.load
end

Rails.application.routes.draw do
  namespace :admin do
    resources :sites, param: :slug do
      resources :site_steps, only: [:show, :update, :edit]
    end
    resources :site_steps, only: [:show, :update, :new]
    resources :users
    resources :routes
    resources :site_templates
    resources :page_templates
    resources :site_users
    resources :datasets, only: :index do
      get 'dataset'
    end
    get '/', to: redirect('/admin/sites')
    resources :contexts
  end

  namespace :management do
    resources :sites, param: :slug, only: [:index] do
      resources :site_pages, shallow: true do
        member do
          put :toggle_enable
        end
      end
      get '/structure', to: 'sites#structure'
      put :update_structure
    end
    get '/', to: 'static_page#dashboard'
  end
  get '/no-permissions', to: 'static_page#no_permissions'

  # Auth
  get 'auth/login', to: 'auth#login'
  post 'auth/logout', to: 'auth#logout'

   DynamicRouter.load
end

Fix for: Removed old action/view for the sites' listing in management
Fix for: Removed old action/view for the sites' listing in management
