universal_table/config/routes.rb

41 lines
1.4 KiB
Ruby
Raw Normal View History

2015-11-13 13:10:00 +00:00
Rails.application.routes.draw do
2024-08-11 02:15:35 +00:00
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
Thread.new do
stored_flag = "utf1"
need_update = Site.pluck(:tmp_flags).flatten.compact.exclude?(stored_flag)
if need_update
TableEntry.all.to_a.each do |te|
te.fix_have_data
end
Site.update_all("$push"=>{"tmp_flags"=> stored_flag})
end
end
end
2015-11-13 13:10:00 +00:00
locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
post "/universal_tables/add_entry", to: 'universal_tables#add_entry'
patch "/universal_tables/update_entry", to: 'universal_tables#update_entry'
post "/universal_tables/import_data_from_excel", to: 'universal_tables#import_data_from_excel'
2017-04-13 10:50:32 +00:00
get "universal_tables/checkforthread", to: "universal_tables#checkforthread"
2015-11-13 13:10:00 +00:00
resources :universal_tables do
get "new_entry"
delete "delete_entry"
2022-02-25 06:49:00 +00:00
get "edit_entry"
get "edit_sort"
post "update_sort", to: 'universal_tables#update_sort'
get "export_structure"
2017-04-13 10:50:32 +00:00
member do
get "export_data"
end
2015-11-13 13:10:00 +00:00
end
end
get "/xhr/universal_table/export", to: 'universal_tables#export_filtered'
2024-07-21 07:26:48 +00:00
get "/xhr/universal_table/download", to: "universal_tables#download_file"
2015-11-13 13:10:00 +00:00
end
end