Rails.application.routes.draw do locales = Site.first.in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do post "space/add_floor", to: 'spaces#add_floor' post "space/update_floor", to: 'spaces#update_floor' post "space/save_floor_layout", to: 'spaces#save_floor_layout' post "space/create_floor_unit", to: 'spaces#create_floor_unit' patch "space/update_floor_unit", to: 'spaces#update_floor_unit' patch "space/update_sub_unit", to: 'spaces#update_sub_unit' post "space/save_unit_layout", to: 'spaces#save_unit_layout' post "space/upload_sub_unit_image", to: 'spaces#upload_sub_unit_image' post "space/create_sub_unit", to: 'spaces#create_sub_unit' get "spaces/:building_id/:floor_id/units", to: 'spaces#units' get "spaces/floor/:floor_id/add_floor_unit", to: 'spaces#add_floor_unit' get "spaces/floor/:floor_id/layout", to: 'spaces#floor_layout' get "spaces/unit/:unit_id/layout", to: 'spaces#unit_layout' get "spaces/unit/:unit_id/edit", to: 'spaces#edit_floor_unit' get "spaces/:floor_id/:unit_id/sub_units", to: 'spaces#sub_units' get "spaces/unit/:unit_id/add_sub_unit", to: 'spaces#add_sub_unit' get "spaces/sub_unit/:sub_unit_id/edit", to: 'spaces#edit_sub_unit' delete "spaces/unit/:unit_id/delete", to: 'spaces#delete_floor_unit' delete "spaces/floor/:floor_id/delete", to: 'spaces#delete_floor' resources :spaces do get "floors" end end get "/xhr/spaces/get_floor_units", to: 'spaces#floor_units' get "/xhr/spaces/get_floor_sub_units", to: 'spaces#floor_sub_units' get "/xhr/spaces/showcase", to: 'spaces#showcase' end end