Application_Form/config/routes.rb

101 lines
3.6 KiB
Ruby

Rails.application.routes.draw do
locales = Site.first.in_use_locales rescue I18n.available_locales
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
Thread.new do
begin
default_keys = ApplicationFormTicketStatus::DefaultKeys
if ApplicationFormTicketStatus.count < default_keys.count
default_keys.each do |k|
ticket_status = ApplicationFormTicketStatus.where(:is_default=>true,:key=>k).first
if ticket_status.nil?
ApplicationFormTicketStatus.create(:is_default=>true,:key=>k, :title_translations=>locales.map{|l| [l.to_s, I18n.with_locale(l){I18n.t("ask.#{k}")}]}.to_h )
end
end
end
rescue => e
puts [e, e.backtrace]
end
end
end
Thread.new do
ApplicationFormEmailSet.where(:field_name=>nil).destroy
end
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
resource :application_forms, only: [] do
get 'setting'
get ':id/print', to: 'application_forms#print'
post 'update_setting' => "application_forms#update_setting"
get 'print_setting'
get ':application_form_id/print_setting' => "application_forms#print_setting"
post 'print_setting_save'
get 'ticket_status'
post 'get_ticket_status'
post 'update_ticket_status'
delete 'delete_ticket_status'
end
resources :application_forms do
member do
get 'print'
get 'copy'
get 'export'
get 'set_write_off'
get 'application_form_signup'
get 'application_form_item_content'
get 'application_form_signup_field'
get 'application_form_submission_field'
get 'application_form_signup_admin_setting'
post 'update_application_form_signup_admin_setting'
patch 'update_application_form_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_application_form_session'
get 'template_setting'
post 'update_template_setting'
patch 'update_template_setting'
get 'sub_page_setting'
end
end
get 'application_form/enquiry_for_applicants' => "application_forms#enquiry_for_applicants"
post 'application_form/update_application_form_review' => "application_forms#update_application_form_review"
resources :application_form_items do
collection do
post 'delete_items'
end
end
resources :application_form_agreements
resources :application_form_signups, except: [:edit] do
member do
get 'view'
end
end
resources :application_form_submission_values
resources :application_form_review_results
resources :application_form_item_contents
end
resources :application_forms do
collection do
get ':slug_title-:uid', to: 'application_forms#show'
post 'con_login_proc', to: 'application_forms#con_login_proc'
post 'con_logout_proc', to: 'application_forms#con_logout_proc'
post 'add_file_proc', to: 'application_forms#add_file_proc'
post 'edit_file_proc', to: 'application_forms#edit_file_proc'
post 'del_file', to: 'application_forms#del_file'
end
end
get '/xhr/application_forms/check_availability', to: 'application_forms#check_availability'
get '/xhr/application_forms/agree_link' , to: 'application_forms#agree_link'
end
end