95 lines
3.2 KiB
Ruby
95 lines
3.2 KiB
Ruby
Rails.application.routes.draw do
|
|
OrbitHelper::SharedMutex.synchronize do
|
|
OrbitHelper::SharedHash['seminar'][:counter] = SeminarMain.where(:signup_limit.ne => nil).map{|v| [v.id, v.seminar_signups.count]}.to_h
|
|
OrbitHelper::SharedHash['seminar'][:limit] = SeminarMain.where(:signup_limit.ne => nil).map{|v| [v.id, v.signup_limit]}.to_h
|
|
end
|
|
Thread.new do
|
|
if Page.fields.include?('all_pageids')
|
|
s = Site.first
|
|
update_flag = s.respond_to?(:tmp_flags)
|
|
need_update1 = update_flag && !(s.tmp_flags.include?('fix_sr'))
|
|
need_update2 = !update_flag || !(s.tmp_flags.include?('smer1'))
|
|
need_update3 = !update_flag || !(s.tmp_flags.include?('smer2'))
|
|
if need_update1
|
|
Page.where(:bind_model=>"SeminarMain",:all_pageids=>nil).each do |p|
|
|
p.save
|
|
end
|
|
Site.update_all("$push"=>{"tmp_flags"=>'fix_sr'})
|
|
end
|
|
if need_update2
|
|
SeminarMain.where(:enable_recaptcha=>nil).each do |seminar_main|
|
|
seminar_main.update_enable_recaptcha
|
|
end
|
|
if update_flag
|
|
Site.update_all("$push"=>{"tmp_flags"=>'smer1'})
|
|
end
|
|
end
|
|
if need_update3
|
|
SeminarMain.all.to_a.each do |seminar_main|
|
|
seminar_main.migrate_old
|
|
end
|
|
if update_flag
|
|
Site.update_all("$push"=>{"tmp_flags"=>'smer2'})
|
|
end
|
|
end
|
|
end
|
|
end
|
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
|
|
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
|
namespace :admin do
|
|
resources :seminars do
|
|
member do
|
|
get 'copy'
|
|
get 'export'
|
|
get 'set_write_off'
|
|
get 'seminar_signup'
|
|
get 'seminar_item_content'
|
|
get 'seminar_signup_field'
|
|
get 'seminar_submission_field'
|
|
get 'seminar_signup_admin_setting'
|
|
post 'update_seminar_signup_admin_setting'
|
|
patch 'update_seminar_signup_admin_setting'
|
|
get 'get_hide_reviewer'
|
|
get 'get_hide_session'
|
|
get 'get_reviewer_block'
|
|
get 'get_session_block'
|
|
get 'reviewer_setting'
|
|
post 'update_reviewer_setting'
|
|
patch 'update_reviewer_setting'
|
|
post 'update_seminar_session'
|
|
get 'template_setting'
|
|
post 'update_template_setting'
|
|
patch 'update_template_setting'
|
|
get 'sub_page_setting'
|
|
end
|
|
end
|
|
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
|
|
post 'seminar/update_seminar_review' => "seminars#update_seminar_review"
|
|
resources :seminar_items do
|
|
collection do
|
|
post 'delete_items'
|
|
end
|
|
end
|
|
resources :seminar_agreements
|
|
resources :seminar_signups
|
|
resources :seminar_submission_values
|
|
resources :seminar_review_results
|
|
resources :seminar_item_contents
|
|
end
|
|
|
|
resources :seminars do
|
|
collection do
|
|
get ':slug_title-:uid', to: 'seminars#show'
|
|
post 'con_login_proc', to: 'seminars#con_login_proc'
|
|
post 'con_logout_proc', to: 'seminars#con_logout_proc'
|
|
post 'add_file_proc', to: 'seminars#add_file_proc'
|
|
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
|
post 'del_file', to: 'seminars#del_file'
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end
|