Rails.application.routes.draw do locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do get 'course_setting' => "courses#setting" resources :courses do collection do get 'toggle_hide' => 'courses#toggle_hide' get 'analysis' get 'analysis_report' get "download_excel" get 'course_assignments' post 'create_assignment' get 'new_assignment' delete 'destroy_assignment' scope '(:name-:uid)' do get 'edit_assignment' patch 'update_assignment' put 'update_assignment' get 'show_assignments' end end end resources :members do collection do scope '(:name-:uid)' do resources :courses do collection do get 'frontend_setting' => 'courses#frontend_setting' post 'update_frontend_setting' => 'courses#update_frontend_setting' end end end end end resources :course_semesters resources :course_categories post "course_categories/update_order" => "course_categories#update_order" end end end