complete some change

This commit is contained in:
邱博亞 2022-05-21 21:48:39 +08:00
parent a5bc3285c7
commit 07ee0df929
23 changed files with 668 additions and 222 deletions

View File

@ -4,6 +4,14 @@ class Admin::ApplicationFormsController < OrbitAdminController
require 'axlsx' require 'axlsx'
include Admin::ApplicationFormsHelper include Admin::ApplicationFormsHelper
helper Admin::ApplicationFormsFieldHelper helper Admin::ApplicationFormsFieldHelper
layout :compute_layout
def compute_layout
if action_name=='print'
false
else
'back_end'
end
end
before_action ->(module_app = @app_title) { set_variables module_app } before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_application_form, only: [:edit, :set_write_off, :application_form_signup, :destroy,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block,:update_application_form_review,:update_application_form_session,:reviewer_setting,:update_reviewer_setting,:template_setting,:update_template_setting,:sub_page_setting] before_action :set_application_form, only: [:edit, :set_write_off, :application_form_signup, :destroy,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block,:update_application_form_review,:update_application_form_session,:reviewer_setting,:update_reviewer_setting,:template_setting,:update_template_setting,:sub_page_setting]
before_action :set_application_form_signup_admin_setting, only: [:application_form_signup,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block] before_action :set_application_form_signup_admin_setting, only: [:application_form_signup,:application_form_signup_admin_setting,:update_application_form_signup_admin_setting,:get_reviewer_block,:get_session_block]
@ -144,21 +152,22 @@ class Admin::ApplicationFormsController < OrbitAdminController
@fields_values = @fields_values.collect.with_index{|fields_values,i| [i, fields_values.values.map{|v| v[I18n.locale]} ] }.to_h @fields_values = @fields_values.collect.with_index{|fields_values,i| [i, fields_values.values.map{|v| v[I18n.locale]} ] }.to_h
end end
def update_reviewer_setting def update_reviewer_setting
application_form_params[:application_form_reviews_attributes].keys.each do |i| application_form_main_params = application_form_params
if application_form_params[:application_form_reviews_attributes][i][:default_topics].present? application_form_main_params[:application_form_reviews_attributes].keys.each do |i|
application_form_params[:application_form_reviews_attributes][i][:default_topics] = [] if application_form_params[:application_form_reviews_attributes][i][:default_topics].nil? if application_form_main_params[:application_form_reviews_attributes][i][:default_topics].present?
application_form_main_params[:application_form_reviews_attributes][i][:default_topics] = [] if application_form_main_params[:application_form_reviews_attributes][i][:default_topics].nil?
default_topics_values = [] default_topics_values = []
(0...application_form_params[:application_form_reviews_attributes][i][:default_topics].count).each do |ii| (0...application_form_main_params[:application_form_reviews_attributes][i][:default_topics].count).each do |ii|
default_topics_values << (Array(application_form_params[:application_form_reviews_attributes][i][:default_topics_values][ii.to_s]) rescue []) default_topics_values << (Array(application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values][ii.to_s]) rescue [])
end end
application_form_params[:application_form_reviews_attributes][i][:default_topics_values] = default_topics_values application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values] = default_topics_values
else else
application_form_params[:application_form_reviews_attributes][i][:default_topics] = [] application_form_main_params[:application_form_reviews_attributes][i][:default_topics] = []
application_form_params[:application_form_reviews_attributes][i][:default_topics_values] = [] application_form_main_params[:application_form_reviews_attributes][i][:default_topics_values] = []
end end
end end
#render :html => application_form_params and return #render :html => application_form_params and return
@application_form.update_attributes(application_form_params) @application_form.update_attributes(application_form_main_params)
unassigned_application_form_signup_ids = @application_form.application_form_signup_ids.map{|s| s.to_s} unassigned_application_form_signup_ids = @application_form.application_form_signup_ids.map{|s| s.to_s}
unassigned_mode_1_application_form_signup_ids = unassigned_application_form_signup_ids.dup unassigned_mode_1_application_form_signup_ids = unassigned_application_form_signup_ids.dup
@application_form.application_form_reviews.each do |sr| @application_form.application_form_reviews.each do |sr|
@ -376,12 +385,12 @@ class Admin::ApplicationFormsController < OrbitAdminController
if params[:sort] == 'event_during' if params[:sort] == 'event_during'
sort = {:application_form_start_date.to_sym=>params[:order]} sort = {:application_form_start_date.to_sym=>params[:order]}
elsif params[:sort] == 'signup_during' elsif params[:sort] == 'signup_during'
sort = {:signup_start_date.to_sym=>params[:order]} sort = {:application_form_start_date.to_sym=>params[:order]}
else else
sort = {params[:sort].to_sym=>params[:order]} sort = {params[:sort].to_sym=>params[:order]}
end end
else else
sort = {:signup_start_date=>"desc",:created_at=>"desc"} sort = {:application_form_start_date=>"desc",:created_at=>"desc"}
end end
@application_forms = ApplicationFormMain.all.order_by(sort).with_categories(filters("category")) @application_forms = ApplicationFormMain.all.order_by(sort).with_categories(filters("category"))
@ -428,9 +437,7 @@ class Admin::ApplicationFormsController < OrbitAdminController
end end
def copy def copy
@application_form = ApplicationFormMain.find(params[:id]).clone_new @application_form = ApplicationFormMain.find(params[:id]).clone_new
@member_1st = MemberProfile.where(:id.in=>@application_form.reviewer_1st_ids).to_a rescue [] @members = @application_form.reviewer_ids_list.collect{|r_ids| MemberProfile.where(:id.in=>Array(r_ids)).to_a}
@member_2nd = MemberProfile.where(:id.in=>@application_form.reviewer_2nd_ids).to_a rescue []
@member_3rd = MemberProfile.where(:id.in=>@application_form.reviewer_3rd_ids).to_a rescue []
@email_set = @application_form.application_form_email_sets @email_set = @application_form.application_form_email_sets
@signup_sets = @application_form.application_form_signup_field_sets @signup_sets = @application_form.application_form_signup_field_sets
@ -440,10 +447,10 @@ class Admin::ApplicationFormsController < OrbitAdminController
@review = @application_form.application_form_reviews.first @review = @application_form.application_form_reviews.first
end end
def new def new
@member_1st = nil
@member_2nd = nil
@member_3rd = nil
@application_form = ApplicationFormMain.new @application_form = ApplicationFormMain.new
@application_form_setting = ApplicationFormSetting.get_one
@members = (0...@application_form_setting.reviewer_length).collect{nil}
create_set (false) create_set (false)
@signup_sets = @application_form.application_form_signup_field_sets @signup_sets = @application_form.application_form_signup_field_sets
@submission_set = @application_form.application_form_submission_field_sets @submission_set = @application_form.application_form_submission_field_sets
@ -453,22 +460,19 @@ class Admin::ApplicationFormsController < OrbitAdminController
end end
def create def create
if !application_form_params['application_form_links_attributes'].nil?
application_form_params['application_form_links_attributes'].each do |idx,link|
application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
application_form_main_params = application_form_params application_form_main_params = application_form_params
if !application_form_main_params['application_form_links_attributes'].nil?
application_form_main_params['application_form_links_attributes'].each do |idx,link|
application_form_main_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets'] application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets']
application_form_submission_set_params = application_form_main_params['application_form_submission_field_sets']
application_form_email_sets_params = application_form_main_params['application_form_email_sets'] application_form_email_sets_params = application_form_main_params['application_form_email_sets']
application_form_signup_field_customs_params = application_form_main_params["application_form_signup_field_customs"].to_h rescue {} application_form_signup_field_customs_params = application_form_main_params["application_form_signup_field_customs"].to_h rescue {}
application_form_main_params["application_form_signup_field_customs"].to_h.each do |k,v| application_form_main_params["application_form_signup_field_customs"].to_h.each do |k,v|
v.delete "title" v.delete "title"
end end
application_form_main_params.delete(:application_form_signup_field_sets) application_form_main_params.delete(:application_form_signup_field_sets)
application_form_main_params.delete(:application_form_submission_field_sets)
application_form_main_params.delete(:application_form_email_sets) application_form_main_params.delete(:application_form_email_sets)
application_form = ApplicationFormMain.new(application_form_main_params) application_form = ApplicationFormMain.new(application_form_main_params)
application_form.create_user_id = current_user.id application_form.create_user_id = current_user.id
@ -481,9 +485,6 @@ class Admin::ApplicationFormsController < OrbitAdminController
application_form_signup_set_params.each do |key,value| application_form_signup_set_params.each do |key,value|
application_form.application_form_signup_field_sets[key.to_i].update_attributes(value) rescue nil application_form.application_form_signup_field_sets[key.to_i].update_attributes(value) rescue nil
end end
application_form_submission_set_params.each do |key,value|
application_form.application_form_submission_field_sets[key.to_i].update_attributes(value) rescue nil
end
application_form_email_sets_params.each do |key,value| application_form_email_sets_params.each do |key,value|
application_form.application_form_email_sets[key.to_i].update_attributes(value) rescue nil application_form.application_form_email_sets[key.to_i].update_attributes(value) rescue nil
end end
@ -494,9 +495,6 @@ class Admin::ApplicationFormsController < OrbitAdminController
application_form_signup_set_params.each do |key,value| application_form_signup_set_params.each do |key,value|
application_form.application_form_signup_field_sets.create(value) application_form.application_form_signup_field_sets.create(value)
end end
application_form_submission_set_params.each do |key,value|
application_form.application_form_submission_field_sets.create(value)
end
application_form_email_sets_params.each do |key,value| application_form_email_sets_params.each do |key,value|
application_form.application_form_email_sets.create(value) application_form.application_form_email_sets.create(value)
end end
@ -505,8 +503,20 @@ class Admin::ApplicationFormsController < OrbitAdminController
end end
def setting
@application_form_setting = ApplicationFormSetting.get_one
end
def update_setting
@application_form_setting = ApplicationFormSetting.get_one
tmp = params.require(:application_form_setting).permit!
@application_form_setting.update_attributes(tmp)
redirect_to admin_application_forms_path
end
def edit def edit
@application_form_items = ApplicationFormItem.all @application_form_items = ApplicationFormItem.all
@application_form_setting = ApplicationFormSetting.get_one
@application_form = ApplicationFormMain.where(id: params[:id]).first @application_form = ApplicationFormMain.where(id: params[:id]).first
except_attributes = ApplicationFormSignup::HiddenFields except_attributes = ApplicationFormSignup::HiddenFields
@application_form.application_form_signup_field_sets.each do |signup_field_set| @application_form.application_form_signup_field_sets.each do |signup_field_set|
@ -528,9 +538,7 @@ class Admin::ApplicationFormsController < OrbitAdminController
@signup_sets = @application_form.application_form_signup_field_sets @signup_sets = @application_form.application_form_signup_field_sets
@submission_set = @application_form.application_form_submission_field_sets @submission_set = @application_form.application_form_submission_field_sets
@custom_set = @application_form.application_form_signup_field_customs @custom_set = @application_form.application_form_signup_field_customs
@member_1st = MemberProfile.where(:id.in=>@application_form.reviewer_1st_ids).to_a rescue [] @members = @application_form.reviewer_ids_list.collect{|r_ids| MemberProfile.where(:id.in=>Array(r_ids)).to_a}
@member_2nd = MemberProfile.where(:id.in=>@application_form.reviewer_2nd_ids).to_a rescue []
@member_3rd = MemberProfile.where(:id.in=>@application_form.reviewer_3rd_ids).to_a rescue []
if (@application_form.organizer_id == current_user.member_profile_id rescue false) if (@application_form.organizer_id == current_user.member_profile_id rescue false)
@user_authorized_categories = @module_app.categories.enabled.to_a @user_authorized_categories = @module_app.categories.enabled.to_a
else else
@ -539,13 +547,12 @@ class Admin::ApplicationFormsController < OrbitAdminController
end end
def update def update
@application_form_params = application_form_params rescue {} @application_form_params = application_form_params
if @application_form_params.count != 0 if @application_form_params.count != 0
@application_form_params[:registration_status] = (@application_form_params[:registration_status] ? @application_form_params[:registration_status] : []) @application_form_params[:registration_status] = (@application_form_params[:registration_status] ? @application_form_params[:registration_status] : [])
uid = params[:id].split('-').last uid = params[:id].split('-').last
@application_form = ApplicationFormMain.find_by(:uid=>uid) @application_form = ApplicationFormMain.find_by(:uid=>uid)
if @application_form_params.has_key?("title_translations") if @application_form_params.has_key?("title_translations")
@application_form_params["reviewer_ids"] = [] if @application_form_params["reviewer_ids"].nil?
@application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil? @application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil?
end end
if @application_form_params[:application_form_signup_fields] if @application_form_params[:application_form_signup_fields]
@ -601,14 +608,14 @@ class Admin::ApplicationFormsController < OrbitAdminController
redirect_to admin_application_forms_path and return redirect_to admin_application_forms_path and return
else else
if !application_form_params['application_form_links_attributes'].nil? if !@application_form_params['application_form_links_attributes'].nil?
application_form_params['application_form_links_attributes'].each do |idx,link| @application_form_params['application_form_links_attributes'].each do |idx,link|
application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? @application_form_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank?
end end
end end
@application_form.update_user_id = current_user.id @application_form.update_user_id = current_user.id
if @application_form.update_attributes(application_form_params) if @application_form.update_attributes(@application_form_params)
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true} @application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url'] and return redirect_to params['referer_url'] and return
else else
@ -742,6 +749,121 @@ class Admin::ApplicationFormsController < OrbitAdminController
redirect_to "/admin/application_forms/@application_form_id.to_s/application_form_signup" redirect_to "/admin/application_forms/@application_form_id.to_s/application_form_signup"
end end
def print_setting
@set = nil
@application_form_id = params[:application_form_id]
if @application_form_id.blank?
@set = ApplicationFormPrintSetting.first
else
@set = ApplicationFormCategoryPrintSetting.where(:application_form_id=>@application_form_id).first
@set = ApplicationFormCategoryPrintSetting.new if @set.nil?
end
@set = ApplicationFormPrintSetting.create if @set.nil?
@url = print_setting_save_admin_application_forms_path
end
def print_setting_save
locale = I18n.locale
if params[:application_form_print_setting][:application_form_id].present?
set = ApplicationFormCategoryPrintSetting.where(:application_form_id=>params[:application_form_print_setting][:application_form_id]).first
set = ApplicationFormCategoryPrintSetting.create(:application_form_id=>params[:application_form_print_setting][:application_form_id]) if set.nil?
else
set = ApplicationFormPrintSetting.first
end
set.update_attributes(print_format: params[:application_form_print_setting][:print_format],save_name: params[:application_form_print_setting][:save_name])
redirect_to "/#{locale}/admin/application_forms"
end
def process_format_text(text,custom_fields)
customs = text.scan(/<tr(?:(?!<tr).)+\{custom\}(?:(?!<tr).)+<\/tr>/m).uniq
if customs.length != 0
custom_exist_nums = []
custom_exists = text.scan(/{custom\d+}/)
custom_exists.each do |custom_exist|
k = custom_exist[6...-1].to_i - 1
custom_exist_nums << k
end
customs.each do |custom|
tmp = custom_fields.keys.collect.with_index do |k,i|
if custom_exist_nums.exclude?(i)
tp = custom.gsub(/{custom}/,"{custom#{i+1}}")
tp = tp.gsub(/{custom_title}/,"{custom#{i+1}_title}")
tp
else
nil
end
end.compact.join
text = text.gsub(custom,tmp)
end
end
format_texts = text.scan(/{\w+\|*\w+}/).uniq
format_texts.each do |format_text|
if format_text[-7...-1] == '_title'
case format_text[1...-7]
when /custom\d+/
i = format_text.scan(/\d+/)[0].to_i - 1
k = custom_fields.keys[i] rescue nil
if !k.blank?
text_tp = custom_fields[k][I18n.locale] rescue ''
text = text.gsub(format_text,text_tp)
end
when 'title'
text = text.gsub(format_text,I18n.t('title'))
when 'submission_time'
text = text.gsub(format_text,I18n.t('application_form_signup.submission_time'))
when 'category'
text = text.gsub(format_text,I18n.t('category'))
when 'name','email','phone'
text = text.gsub(format_text,I18n.t("application_form_signup.#{format_text[1...-7]}"))
end
else
case format_text[1...-1]
when 'submission_time'
text = text.gsub(format_text,@application_form_signup.created_at.strftime('%Y/%m/%d %H:%M'))
when 'title'
text = text.gsub(format_text,@application_form_signup.application_form_main.title.to_s)
when 'title','name','email','phone'
text = text.gsub(format_text,@application_form_signup.send(format_text[1...-1]).to_s)
when 'category'
cat = @application_form_signup.application_form_main.category.title rescue ''
text = text.gsub(format_text,cat)
when 'name|mask'
name_tp = @application_form_signup.name.to_s
if name_tp.length>1
name_tp = name_tp[0] + '*'*(name_tp.length-1)
end
text = text.gsub(format_text,name_tp)
when /custom\d+\|format/ #not finish
i = format_text.scan(/\d+/)[0].to_i - 1
k = custom_fields.keys[i] rescue nil
if !k.blank?
text_tp = @application_form_signup.application_form_signup_values.select{|v| v.application_form_signup_field_id==k}[0].get_value_by_locale
text = text.gsub(format_text,text_tp.to_s)
end
when /custom\d+/
i = format_text.scan(/\d+/)[0].to_i - 1
k = custom_fields.keys[i] rescue nil
if !k.blank?
text_tp = @application_form_signup.application_form_signup_values.select{|v| v.application_form_signup_field_id==k}[0].get_value_by_locale
text = text.gsub(format_text,text_tp.to_s)
end
end
end
end
text
end
def print
@application_form_signup = ApplicationFormSignup.find(params[:id])
@application_form = @application_form_signup.application_form_main
@print_setting = ApplicationFormCategoryPrintSetting.where(application_form_id: @application_form_signup.application_form_main_id.to_s).first
@print_setting = ApplicationFormPrintSetting.first if @print_setting.nil?
@save_name = @print_setting.save_name rescue ''
@print_text = @print_setting.print_format rescue ''
custom_fields = @application_form.application_form_signup_fields.order_by({key: :asc}).collect{|v| [v.id,v.title_translations]}.to_h
@print_text = process_format_text(@print_text,custom_fields)
@save_name = process_format_text(@save_name,custom_fields)
end
private private
def set_application_form def set_application_form
@ -757,7 +879,10 @@ class Admin::ApplicationFormsController < OrbitAdminController
params.require(:application_form_template_setting).permit! params.require(:application_form_template_setting).permit!
end end
def application_form_params def application_form_params
params.require(:application_form_main).permit! tmp = params.require(:application_form_main).permit!
tmp['reviewer_ids_list'] = tmp['reviewer_enables'].map{|k,i| Array((tmp['reviewer_ids_list'][k] rescue []))}
tmp['reviewer_enables'] = tmp['reviewer_enables'].map{|k,v| v.to_i != 0 ? true : false}
tmp
end end
def create_set (save_flag) def create_set (save_flag)
except_attributes = ApplicationFormSignup::HiddenFields except_attributes = ApplicationFormSignup::HiddenFields

View File

@ -25,11 +25,11 @@ class ApplicationFormsController < ApplicationController
session = OrbitHelper.request.session session = OrbitHelper.request.session
application_forms = application_forms.map do |application_form| application_forms = application_forms.map do |application_form|
link_url = OrbitHelper.url_to_show(application_form.to_param) link_url = OrbitHelper.url_to_show(application_form.to_param)
if !application_form.registration_status.blank? && (application_form.signup_start_date <= time_now rescue false) && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) if (application_form.application_form_start_date <= time_now rescue false) && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now )
sign_up = ('<a href="'+ link_url + '" target="_blank">' + I18n.t('application_form.signup') + '</a>').html_safe sign_up = ('<a href="'+ link_url + '" target="_blank">' + I18n.t('application_form.signup') + '</a>').html_safe
elsif application_form.registration_status.blank? elsif application_form.registration_status.blank?
sign_up = I18n.t('application_form.sign_up_not_open') sign_up = I18n.t('application_form.sign_up_not_open')
elsif (application_form.signup_start_date > @time_now rescue false) elsif (application_form.application_form_start_date > @time_now rescue false)
sign_up = I18n.t('application_form.sign_up_not_yet') sign_up = I18n.t('application_form.sign_up_not_yet')
else else
sign_up = I18n.t('application_form.sign_up_overdue') sign_up = I18n.t('application_form.sign_up_overdue')
@ -168,11 +168,11 @@ class ApplicationFormsController < ApplicationController
time_now = Time.now time_now = Time.now
params = OrbitHelper.params params = OrbitHelper.params
application_form = ApplicationFormMain.find_by(uid: params[:uid]) application_form = ApplicationFormMain.find_by(uid: params[:uid])
if !application_form.registration_status.blank? && application_form.signup_start_date <= time_now && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) if application_form.application_form_start_date <= time_now && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now )
sign_up = ('<a href="'+ prefix_url + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe sign_up = ('<a href="'+ prefix_url + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe
elsif application_form.registration_status.blank? elsif application_form.registration_status.blank?
sign_up = t('application_form.sign_up_not_open') sign_up = t('application_form.sign_up_not_open')
elsif application_form.signup_start_date > time_now elsif application_form.application_form_start_date > time_now
sign_up = t('application_form.sign_up_not_yet') sign_up = t('application_form.sign_up_not_yet')
else else
sign_up = t('application_form.sign_up_overdue') sign_up = t('application_form.sign_up_overdue')
@ -194,7 +194,7 @@ class ApplicationFormsController < ApplicationController
'contribute_action' => contribute_action, 'contribute_action' => contribute_action,
'time_now' => time_now, 'time_now' => time_now,
'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date), 'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date),
'sign_up_time_range' => ApplicationFormMain.time_range(application_form.signup_start_date, application_form.signup_end_date), 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date),
'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) 'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date)
} }
@_request = OrbitHelper.request @_request = OrbitHelper.request
@ -302,11 +302,11 @@ class ApplicationFormsController < ApplicationController
application_form = ApplicationFormMain.find_by(uid: params[:uid]) application_form = ApplicationFormMain.find_by(uid: params[:uid])
if !application_form.registration_status.blank? && application_form.signup_start_date <= time_now && ( application_form.signup_end_date.nil? || application_form.signup_end_date+1 >= time_now ) if application_form.application_form_start_date <= time_now && ( application_form.application_form_end_date.nil? || application_form.application_form_end_date+1 >= time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe sign_up = ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe
elsif application_form.registration_status.blank? elsif application_form.registration_status.blank?
sign_up = t('application_form.sign_up_not_open') sign_up = t('application_form.sign_up_not_open')
elsif application_form.signup_start_date > time_now elsif application_form.application_form_start_date > time_now
sign_up = t('application_form.sign_up_not_yet') sign_up = t('application_form.sign_up_not_yet')
else else
sign_up = t('application_form.sign_up_overdue') sign_up = t('application_form.sign_up_overdue')
@ -332,7 +332,7 @@ class ApplicationFormsController < ApplicationController
'contribute_action' => contribute_action, 'contribute_action' => contribute_action,
'time_now' => time_now, 'time_now' => time_now,
'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date), 'contribute_time_range' => ApplicationFormMain.time_range(application_form.contribute_start_date, application_form.contribute_end_date),
'sign_up_time_range' => ApplicationFormMain.time_range(application_form.signup_start_date, application_form.signup_end_date), 'sign_up_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date),
'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) 'application_form_time_range' => ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date)
} }
@ -394,8 +394,8 @@ class ApplicationFormsController < ApplicationController
@signup = ApplicationFormSignup.where(email: params[:application_form_signup][:email], application_form_main_id: params[:application_form_signup][:application_form_main_id] ).first @signup = ApplicationFormSignup.where(email: params[:application_form_signup][:email], application_form_main_id: params[:application_form_signup][:application_form_main_id] ).first
@application_form_signup = ApplicationFormSignup.new(application_form_signup_params)
@application_form = ApplicationFormMain.where(id:params[:application_form_signup][:application_form_main_id]).first @application_form = ApplicationFormMain.where(id:params[:application_form_signup][:application_form_main_id]).first
@application_form_signup = ApplicationFormSignup.new(application_form_signup_params)
if @application_form.application_form_signup_field_sets.count!=0 if @application_form.application_form_signup_field_sets.count!=0
flag = @application_form.application_form_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled flag = @application_form.application_form_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled
else else
@ -697,7 +697,9 @@ class ApplicationFormsController < ApplicationController
end end
def application_form_signup_params def application_form_signup_params
params.require(:application_form_signup).permit! tmp = params.require(:application_form_signup).permit!
tmp['reviewer_ids_list'] = (0...@application_form.reviewer_enables.length).map{|k| Array((tmp['reviewer_ids_list'][k.to_s] rescue []))}
tmp
end end
def application_form_signup_contribute_params def application_form_signup_contribute_params

View File

@ -0,0 +1,7 @@
class ApplicationFormCategoryPrintSetting
include Mongoid::Document
include Mongoid::Timestamps
field :print_format, type: String,default: ''
field :save_name, type: String,default: 'ApplicationForm_{title}'
field :application_form_id
end

View File

@ -27,9 +27,6 @@ class ApplicationFormMain
field :application_form_start_date, :type => Date, :default => Time.now field :application_form_start_date, :type => Date, :default => Time.now
field :application_form_end_date, :type => Date, :default => Time.now field :application_form_end_date, :type => Date, :default => Time.now
field :signup_start_date, :type => Date, :default => Time.now
field :signup_end_date, :type => Date, :default => Time.now
field :contribute_start_date, :type => Date field :contribute_start_date, :type => Date
field :contribute_end_date, :type => Date field :contribute_end_date, :type => Date
@ -40,6 +37,10 @@ class ApplicationFormMain
field :create_user_id field :create_user_id
field :update_user_id field :update_user_id
field :reviewer_type_list, default: [], :type=>Array
field :reviewer_ids_list, default: [], :type=>Array
field :reviewer_enables, default: [], :type=> Array
field :reviewer_1st field :reviewer_1st
field :reviewer_1st_type field :reviewer_1st_type
field :reviewer_1st_ids field :reviewer_1st_ids
@ -91,6 +92,7 @@ class ApplicationFormMain
accepts_nested_attributes_for :application_form_template_setting, :allow_destroy => true accepts_nested_attributes_for :application_form_template_setting, :allow_destroy => true
before_save do before_save do
module_app_key = "application_form" module_app_key = "application_form"
"""
add_module_app_member_ids = [] add_module_app_member_ids = []
remove_module_app_member_ids = [] remove_module_app_member_ids = []
if self.reviewer_ids_changed? && (self.copy_id.nil? || !self.new_record?) if self.reviewer_ids_changed? && (self.copy_id.nil? || !self.new_record?)
@ -142,6 +144,7 @@ class ApplicationFormMain
next next
end end
end end
"""
if self.enable_summary_choice if self.enable_summary_choice
(0...self.summary_chioices.count).to_a.each do |i| (0...self.summary_chioices.count).to_a.each do |i|
application_form_session = self.application_form_sessions.where(:key=>i).first application_form_session = self.application_form_sessions.where(:key=>i).first
@ -171,9 +174,10 @@ class ApplicationFormMain
self.application_form_submission_fields.each do |application_form_submission_field| self.application_form_submission_fields.each do |application_form_submission_field|
application_form_submission_field.application_form_submission_values.update_all(:key=>application_form_submission_field.key) application_form_submission_field.application_form_submission_values.update_all(:key=>application_form_submission_field.key)
end end
"""
current_reviewer_ids = self.reviewer_ids.to_a current_reviewer_ids = self.reviewer_ids.to_a
self.application_form_reviews.where(:reviewer_id.nin=>current_reviewer_ids).destroy self.application_form_reviews.where(:reviewer_id.nin=>current_reviewer_ids).destroy
module_app_key = "application_form" module_app_key = 'application_form'
current_reviewer_ids.each do |reviewer_id| current_reviewer_ids.each do |reviewer_id|
application_form_review = self.application_form_reviews.select{|sr| sr.reviewer_id == reviewer_id}.first application_form_review = self.application_form_reviews.select{|sr| sr.reviewer_id == reviewer_id}.first
if application_form_review.nil? if application_form_review.nil?
@ -185,6 +189,7 @@ class ApplicationFormMain
end end
end end
end end
"""
end end
end end
after_initialize do after_initialize do
@ -193,17 +198,19 @@ class ApplicationFormMain
save_flag = false save_flag = false
application_form_reviews = self.application_form_reviews application_form_reviews = self.application_form_reviews
if application_form_reviews.present? if application_form_reviews.present?
if self["reviewer_ids"].nil? """
self["reviewer_ids"] = application_form_reviews.pluck(:reviewer_id).flatten.select{|s| !s.nil?}.to_a if self['reviewer_ids'].nil?
self['reviewer_ids'] = application_form_reviews.pluck(:reviewer_id).flatten.select{|s| !s.nil?}.to_a
save_flag = true save_flag = true
else else
self["reviewer_ids"].each do |reviewer_id| self['reviewer_ids'].each do |reviewer_id|
application_form_review_to_destroy = application_form_reviews.where(:reviewer_id=>reviewer_id)[1] application_form_review_to_destroy = application_form_reviews.where(:reviewer_id=>reviewer_id)[1]
if application_form_review_to_destroy if application_form_review_to_destroy
application_form_review_to_destroy.destroy application_form_review_to_destroy.destroy
end end
end end
end end
"""
if application_form_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil? if application_form_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil?
review_start_date = application_form_reviews.pluck(:review_start_date).select{|t| t.present?}.first.to_datetime rescue nil review_start_date = application_form_reviews.pluck(:review_start_date).select{|t| t.present?}.first.to_datetime rescue nil
review_end_date = application_form_reviews.pluck(:review_end_date).select{|t| t.present?}.first.to_datetime rescue nil review_end_date = application_form_reviews.pluck(:review_end_date).select{|t| t.present?}.first.to_datetime rescue nil

View File

@ -0,0 +1,6 @@
class ApplicationFormPrintSetting
include Mongoid::Document
include Mongoid::Timestamps
field :print_format, type: String,default: ''
field :save_name, type: String,default: 'ApplicationForm_{title}'
end

View File

@ -0,0 +1,11 @@
class ApplicationFormSetting
include Mongoid::Document
include Mongoid::Timestamps
field :reviewer_length, default: 3, :type=> Integer
def self.get_one
s = self.first
s = self.create if s.nil?
s
end
end

View File

@ -3,8 +3,8 @@ class ApplicationFormSignup
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
HiddenFields = ['application_form_signup_id','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type"] HiddenFields = ['application_form_signup_id', 'password', 'status', 'reviewer_ids_list','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type"]
DefaultEnableFields = ['status','name','tel','phone','email','password'] DefaultEnableFields = ['name','tel','phone','email']
field :sort_number , type: Integer, default: 10000 field :sort_number , type: Integer, default: 10000
field :status field :status
@ -21,6 +21,21 @@ class ApplicationFormSignup
field :final_session #only store old data , not used field :final_session #only store old data , not used
field :final_sessions field :final_sessions
field :preferred_sessions, type: Array, default: [] field :preferred_sessions, type: Array, default: []
field :reviewer_ids_list, type: Array, default: []
def reviewer_ids_list
main = self.application_form_main
main.reviewer_enables.each_with_index.collect do |e,k|
if e
if main.reviewer_type_list[k]=='fixed'
main.reviewer_ids_list[k]
else
super()[k]
end
else
nil
end
end
end
belongs_to :application_form_main belongs_to :application_form_main
field :application_form_session_id #only store old data , not used field :application_form_session_id #only store old data , not used
field :application_form_session_ids, type: Array, default: [] field :application_form_session_ids, type: Array, default: []

View File

@ -51,6 +51,7 @@
<ul class=\"nav nav-pills\">" <ul class=\"nav nav-pills\">"
if @can_edit if @can_edit
val += "<li><a href=\"/admin/application_form_signups/#{application_form_signup.id}/edit\">#{t(:edit)}</a></li> val += "<li><a href=\"/admin/application_form_signups/#{application_form_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{print_admin_application_form_path(application_form_signup.id)}\" target=\"_blank\">#{t('application_form.print')}</a></li>
<li><a href=\"#{admin_application_form_signup_path(application_form_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>" <li><a href=\"#{admin_application_form_signup_path(application_form_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end end
val += "</ul> val += "</ul>

View File

@ -81,51 +81,25 @@
<!-- Review Module --> <!-- Review Module -->
<div class="tab-pane fade in " id="review"> <div class="tab-pane fade in " id="review">
<% (0...@application_form_setting.reviewer_length).each do |k| %>
<div class="control-group big-group"> <div class="control-group big-group">
<label class="control-label muted"> <label class="control-label muted">
<%= f.check_box :reviewer_1st %> <%= check_box f.object_name,"reviewer_enables][#{k}",{checked: f.object.reviewer_enables[k]},"1","0" %>
<%= t("application_form.reviewer_1st") %> <%= t("application_form.reviewers.#{k+1}") %>
</label> </label>
<div class="controls"> <div class="controls">
<%= f.select :reviewer_1st_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %> <%= select_tag "#{f.object_name}[reviewer_type_list][]",options_for_select(['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]},f.object.reviewer_type_list[k]) %>
<% if !@member_1st.nil? %> <div class="members">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_1st_ids][]', email_members:@member_1st, index: "2", select_name: 'reviewer_1st_ids'} %> <% if !@members[k].nil? %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members:@members[k], index: "#{k+2}", select_name: "reviewer_ids_list_#{k}"} %>
<% else %> <% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_1st_ids][]', email_members:[], index: "2", select_name: 'reviewer_1st_ids'} %> <%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members:[], index: "#{k+2}", select_name: "reviewer_ids_list_#{k}"} %>
<% end %> <% end %>
</div> </div>
</div> </div>
</div>
<div class="control-group big-group">
<label class="control-label muted">
<%= f.check_box :reviewer_2nd %>
<%= t("application_form.reviewer_2nd") %>
</label>
<div class="controls">
<%= f.select :reviewer_2nd_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %>
<% if !@member_2nd.nil? %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_2nd_ids][]', email_members:@member_2nd, index: "3", select_name: 'reviewer_2nd_ids'} %>
<% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_2nd_ids][]', email_members:[], index: "3", select_name: 'reviewer_2nd_ids'} %>
<% end %> <% end %>
</div> </div>
</div>
<div class="control-group big-group">
<label class="control-label muted">
<%= f.check_box :reviewer_3rd %>
<%= t("application_form.reviewer_3rd") %>
</label>
<div class="controls">
<%= f.select :reviewer_3rd_type,['defined_by_applicant','fixed'].map{|v| [t("application_form.#{v}"),v]} %>
<% if !@member_3rd.nil? %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_3rd_ids][]', email_members:@member_3rd, index: "4", select_name: 'reviewer_3rd_ids'} %>
<% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'application_form_main[reviewer_3rd_ids][]', email_members:[], index: "4", select_name: 'reviewer_3rd_ids'} %>
<% end %>
</div>
</div>
</div>
<!-- Signup Set Module --> <!-- Signup Set Module -->
<div class="tab-pane fade in " id="signup_set" style="padding: 1.2em;"> <div class="tab-pane fade in " id="signup_set" style="padding: 1.2em;">
<table> <table>
@ -382,9 +356,21 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<script> <script>
function check_members_button(){
$('.controls>.members').each(function(){
if ($(this).parent().find('select[name="application_form_main[reviewer_type_list][]"]').val()=='fixed'){
$(this).removeClass('hide');
}else{
$(this).addClass('hide');
}
})
}
$(function() { $(function() {
$("#main-wrap").after(""); $("#main-wrap").after("");
check_members_button();
$('select[name="application_form_main[reviewer_type_list][]"]').change(function(){
check_members_button();
})
$(document).on('click', '#add_link', function(){ $(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value'); var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_application_form_links", "g"); var old_id = new RegExp("new_application_form_links", "g");

View File

@ -49,17 +49,6 @@
show3 = true show3 = true
%> %>
<% end %> <% end %>
<% default_hidden << "application_form_signup_contributes.title" if !show1 %>
<% @field_names << 'application_form_signup_contributes.title' %>
<% @field_name_translations << t('application_form_signup.title') %>
<% default_hidden << "application_form_signup_contributes.file" if !show2 %>
<% @field_names << 'application_form_signup_contributes.file' %>
<% @field_name_translations << t('application_form_signup.file') %>
<% default_hidden << "application_form_signup_contributes.description" if !show3 %>
<% @field_names << 'application_form_signup_contributes.description' %>
<% @field_name_translations << t('application_form_signup.description') %>
<% @application_form.application_form_submission_fields.each do |s| %> <% @application_form.application_form_submission_fields.each do |s| %>
<% @field_names << "application_form_submission_fields.#{s.key}" %> <% @field_names << "application_form_submission_fields.#{s.key}" %>
<% if s.markup != "application_form_preferred_session" <% if s.markup != "application_form_preferred_session"
@ -122,17 +111,6 @@
show2 = true show2 = true
show3 = true show3 = true
%> %>
<% default_show << "application_form_signup_contributes.title" if show1 %>
<% @field_names << 'application_form_signup_contributes.title' %>
<% @field_name_translations << t('application_form_signup.title') %>
<% default_show << "application_form_signup_contributes.file" if show2 %>
<% @field_names << 'application_form_signup_contributes.file' %>
<% @field_name_translations << t('application_form_signup.file') %>
<% default_show << "application_form_signup_contributes.description" if show3 %>
<% @field_names << 'application_form_signup_contributes.description' %>
<% @field_name_translations << t('application_form_signup.description') %>
<% application_form_submission_fields = ApplicationFormSignupField.all.uniq{|s| s.key} %> <% application_form_submission_fields = ApplicationFormSignupField.all.uniq{|s| s.key} %>
<% application_form_submission_fields.each do |s| %> <% application_form_submission_fields.each do |s| %>
<% @field_names << "application_form_submission_fields.#{s.key}" %> <% @field_names << "application_form_submission_fields.#{s.key}" %>

View File

@ -25,7 +25,8 @@
<% if admin_for_application_form(application_form) %> <% if admin_for_application_form(application_form) %>
<li><a href="/admin/application_forms/<%=application_form.id.to_s%>/edit"><%= t(:edit) %></a></li> <li><a href="/admin/application_forms/<%=application_form.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="/admin/application_forms/<%=application_form.id.to_s%>/copy"><%= t("application_form.copy") %></a></li> <li><a href="/admin/application_forms/<%=application_form.id.to_s%>/copy"><%= t("application_form.copy") %></a></li>
<li><a href="<%=reviewer_setting_admin_application_form_path(application_form.id)%>"><%= t('application_form.reviewer_setting') %></a></li> <li><a href="/admin/application_forms/<%=application_form.id.to_s%>/application_form_signup_field"><%= t('application_form.set_application_form_signup_field') %></a></li>
<li><a href="/admin/application_forms/<%=application_form.id.to_s%>/print_setting"><%= t('application_form.print_setting') %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/application_forms/<%=application_form.id.to_s%>"><%= t(:delete_) %></a></li> <li><a href="#" class="delete text-error" rel="/admin/application_forms/<%=application_form.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %> <% end %>
</ul> </ul>
@ -33,12 +34,7 @@
</td> </td>
<td><%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %></td> <td><%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %></td>
<td><a href="/admin/application_forms/<%=application_form.id.to_s%>/application_form_signup"> <td><a href="/admin/application_forms/<%=application_form.id.to_s%>/application_form_signup">
<% @application_form_review = application_form.application_form_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
<% if @application_form_review.present? && !@can_edit %>
<%= @application_form_review.get_all_application_form_signup_ids.count %>
<% else %>
<%= application_form.application_form_signups.count %> <%= application_form.application_form_signups.count %>
<% end %>
</a></td> </a></td>
<td> <td>
<% if can_see_application_form_signup(application_form) %> <% if can_see_application_form_signup(application_form) %>

View File

@ -0,0 +1,119 @@
<% trans = 'application_form_signup' %>
<div style="font-size: 1.5em;">
<%= t('application_form.explanation') %>:
<br>
{submission_time} -> <%= t('application_form_signup.submission_time') %>
<br>
{title} -> <%= t('title') %>
<br>
{category} -> <%= t("category") %>
<br>
{name} -> <%= t("#{trans}.name") %>
<br>
{name|mask} -> <%= t("application_form.name_mask") %>
<br>
{email} -> <%= t("#{trans}.email") %>
<br>
{phone} -> <%= t("#{trans}.phone") %>
<br>
{custom1} -> <%= t("application_form.custom1") %>
<br>
{custom2} -> <%= t("application_form.custom2") %>
<br>
{custom3} -> <%= t("application_form.custom3") %>
<br>
<%= t("application_form.and_so_on") %>
<br>
{custom} -><%= t("application_form.custom_explain") %>
<br>
{custom|format} -><%= t("application_form.custom_format_explain") %>
<br>
{?_title} -> ?<%= t("application_form.can_be_filled_with") %>submission_time、title、category、name、email、phone、custom、custom1、custom2、custom3 ...,<%= t("application_form.show_title_trans") %>, <%= t("application_form.like") %>{email_title}-><%= t("#{trans}.email") %>
<br>
<br>
<%= t("application_form.example") %>:
<br>
<%= t("application_form.example_explain") %>
<br>
<%= t('application_form.print_format') %>:
<br>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px;">
<tbody>
<tr>
<td style="text-align: center;"><%= t("application_form.example") %></td>
</tr>
</tbody>
</table>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px;">
<tbody>
<tr>
<td>{title_title}</td>
<td>{title}</td>
</tr>
<tr>
<td>{category_title}</td>
<td>{category}</td>
</tr>
<tr>
<td>{name_title}</td>
<td>{name}</td>
</tr>
<tr>
<td>{email_title}</td>
<td>{email}</td>
</tr>
<tr>
<td>{custom_title}</td>
<td>{custom}</td>
</tr>
<tr>
<td>{custom1_title}</td>
<td>{custom1}</td>
</tr>
</tbody>
</table>
<br>
<br>
<%= t('application_form.output_result') %>:
<br>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px;">
<tbody>
<tr>
<td style="text-align: center;"><%= t("application_form.example") %></td>
</tr>
</tbody>
</table>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px;">
<tbody>
<tr>
<td><%= t('title') %></td>
<td>example</td>
</tr>
<tr>
<td><%= t("category") %></td>
<td>測試</td>
</tr>
<tr>
<td><%= t("#{trans}.name") %></td>
<td>工程師1號</td>
</tr>
<tr>
<td><%= t("#{trans}.email") %></td>
<td>test@rulingcom.com</td>
</tr>
<tr>
<td>test2</td>
<td>b</td>
</tr>
<tr>
<td>test3</td>
<td>c</td>
</tr>
<tr>
<td>test1</td>
<td>a</td>
</tr>
</tbody>
</table>
</div>

View File

@ -7,27 +7,9 @@
<div id="jquery_form_content"> <div id="jquery_form_content">
</div> </div>
</div> </div>
<% if @can_edit %>
<% if params[:type].blank?%>
<label><input id="copy_mode_on" type="checkbox"><%=t("application_form.copy_mode_on")%></label>
<% end %>
<ul class="pull-right">
<li><a href="?type=" class="btn <%='active' if params[:type].blank? %>"><%= t('application_form.dashboard') %></a></li>
<% if @application_form.enable_summary_choice %>
<li><a href="?type=session" class="btn <%='active' if params[:type] == 'session'%>"><%= t('application_form.session_dashboard') %></a></li>
<% end %>
<li><a href="?type=table" class="btn <%='active' if params[:type] == 'table'%>"><%= t('application_form.table') %></a></li>
</ul>
<% end %>
<% end %>
<% if params[:type] == "table" || (!@can_edit) %>
<div style="clear: both;"></div>
<%= render :partial => 'application_form_signup_table' %>
<% elsif params[:type] == "session" %>
<%=render :partial => 'application_form_signup_session_dashboard' %>
<% else %>
<%= render :partial => 'application_form_signup_dashboard' %>
<% end %> <% end %>
<div style="clear: both;"></div>
<%= render :partial => 'application_form_signup_table' %>
<% unless request.xhr? %> <% unless request.xhr? %>
<style type="text/css"> <style type="text/css">
.pull-right li{ .pull-right li{

View File

@ -4,7 +4,7 @@ wb = xlsx_package.workbook
wb.add_worksheet(name: (@application_form.title.to_s[0..27]+'...')) do |sheet| wb.add_worksheet(name: (@application_form.title.to_s[0..27]+'...')) do |sheet|
row = [t('application_form_signup.signup_time')] row = [t('application_form_signup.submission_time')]
row << t('application_form_signup.serial_number') row << t('application_form_signup.serial_number')

View File

@ -0,0 +1,48 @@
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js">
</script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<%= javascript_include_tag "jspdf.min" %>
<style>
input[type="button"],button,input[type="submit"] {
outline: 0;
border-radius: 1.3em;
background: #d9e4f7;
font-weight: bold;
outline: 0;
}
input[type="button"]:hover,button:hover,input[type="submit"]:hover {
background: #be8a8a;
}
.print_text{
padding: 2em;
width: 650px;
margin: auto;
}
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
</style>
<script type="text/javascript">
function save_data(){
var filename = '<%= @save_name %>.pdf';
$('div.print_text').find('input[type=button]').hide()
html2canvas($('div.print_text')[0]).then(canvas => {
var pdf = new jsPDF('px', 'mm', 'a4');
var width = pdf.internal.pageSize.getWidth()-3;
var height = $('div.print_text').innerHeight()/$('div.print_text').innerWidth()*width;
pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0,width ,height );
pdf.save(filename);
});
$('div.print_text').find('input[type=button]').show()
}
</script>
<div class="no-print" style="text-align: center;">
<input onclick="save_data()" value="<%= I18n.t('application_form.save_data') %>" type="button">
</div>
<div class="print_text">
<%= @print_text.html_safe %>
</div>

View File

@ -0,0 +1,44 @@
<%= form_for @set, as: :application_form_print_setting ,method: 'post',url: @url,html: { class: 'form-horizontal main-forms previewable' } do |f| %>
<%= hidden_field_tag "#{f.object_name}[application_form_id]", @application_form_id %>
<fieldset>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= label_tag t('application_form.save_name') %>
</td>
<td>
<%= f.text_field :save_name %>
</td>
</tr>
<tr>
<td>
<%= label_tag t('application_form.print_format') %>
</td>
<td>
<%= f.text_area :print_format,class: 'ckeditor' %>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<input class="btn btn-primary" type="submit" value="<%= t('submit')%>">
</td>
</tr>
</tbody>
</table>
</fieldset>
<% end %>
<%= render partial: 'print_format_explain' %>
<script>
$(document).ready(function(){
$("#submit_when_change").on("change",function(){
$(this)[0].form.submit();
})
})
</script>

View File

@ -0,0 +1,35 @@
<%= form_for @application_form_setting, url: update_setting_admin_application_forms_path,method: 'post', html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t('application_form.reviewer_length') %></label>
<div class="controls">
<%= f.number_field :reviewer_length, min: 1, class: '' %>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:application_formion] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -16,7 +16,6 @@
<th class="col-md-2"><%= t(:category) %></th> <th class="col-md-2"><%= t(:category) %></th>
<th class="col-md-3"><%= t('application_form.title') %></th> <th class="col-md-3"><%= t('application_form.title') %></th>
<th class="col-md-2"><%= t('application_form_signup.time') %></th> <th class="col-md-2"><%= t('application_form_signup.time') %></th>
<th class="col-md-2"><%= t('application_form_signup.place') %></th>
<th class="col-md-2"><%= t('application_form.signup') %></th> <th class="col-md-2"><%= t('application_form.signup') %></th>
</tr> </tr>
</thead> </thead>
@ -24,11 +23,11 @@
<% <%
@application_forms.each do |application_form| @application_forms.each do |application_form|
if !application_form.registration_status.blank? and (application_form.signup_start_date <= @time_now rescue false) and ( application_form.signup_end_date.nil? or application_form.signup_end_date+1 >= @time_now ) if (application_form.application_form_start_date <= @time_now rescue false) and ( application_form.application_form_end_date.nil? or application_form.application_form_end_date+1 >= @time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe sign_up = ('<a href="'+ OrbitHelper.url_to_show(application_form.to_param) + '" target="_blank">' + t('application_form.signup') + '</a>').html_safe
elsif application_form.registration_status.blank? elsif application_form.registration_status.blank?
sign_up = t('application_form.sign_up_not_open') sign_up = t('application_form.sign_up_not_open')
elsif (application_form.signup_start_date > @time_now rescue false) elsif (application_form.application_form_start_date > @time_now rescue false)
sign_up = t('application_form.sign_up_not_yet') sign_up = t('application_form.sign_up_not_yet')
else else
sign_up = t('application_form.sign_up_overdue') sign_up = t('application_form.sign_up_overdue')
@ -44,7 +43,6 @@
<% end %> <% end %>
</td> </td>
<td><%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %></td> <td><%= ApplicationFormMain.time_range(application_form.application_form_start_date, application_form.application_form_end_date) %></td>
<td><%= application_form.act_place %></td>
<td> <td>
<%= sign_up %> <br /> <%= sign_up %> <br />

View File

@ -10,7 +10,7 @@
prefix_url = OrbitHelper.url_to_show(@application_form.to_param) prefix_url = OrbitHelper.url_to_show(@application_form.to_param)
end end
%> %>
<% if !@application_form.registration_status.blank? and @application_form.signup_start_date < @time_now and ( @application_form.signup_end_date.nil? or @application_form.signup_end_date+1 > @time_now ) %> <% if @application_form.application_form_start_date < @time_now and ( @application_form.application_form_end_date.nil? or @application_form.application_form_end_date+1.days > @time_now ) %>
<%#= stylesheet_link_tag "lib/main-forms" %> <%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %> <%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
@ -105,7 +105,7 @@
</div> </div>
<% elsif signup_field.field_name == 'email' %> <% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@application_form.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a> <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div> </div>
<% elsif signup_field.field_name == 'note' %> <% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10"> <div class="col-sm-10">
@ -171,19 +171,26 @@
<div class="form-group"> <div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label> <label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@application_form.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a> <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
</div> </div>
</div> </div>
<div class="form-group <%= @application_form.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status"> <% end %>
<label for="password" class="col-sm-2 control-label">*<%= t('application_form_signup.password') %></label> <% @application_form.reviewer_enables.each_with_index do |flag,k| %>
<% if flag %>
<div class="form-group">
<label for="status" class="col-sm-2 control-label"><%= t("application_form.reviewers.#{k+1}") %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('application_form_signup.password') %> <% if @application_form.reviewer_type_list[k]=='fixed' %>
<%= t('application_form_signup.password_message') %> <%= MemberProfile.where(:id.in=>Array(@application_form.reviewer_ids_list[k])).collect{|m| m.name}.join(', ') %>
<% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: "#{f.object_name}[reviewer_ids_list][#{k}]", email_members: [], index: "#{k+1}", select_name: "reviewer_ids_list_#{k}"} %>
<% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
<% end %>
<% @application_form.application_form_signup_fields.asc(:_id).each do |rf| %> <% @application_form.application_form_signup_fields.asc(:_id).each do |rf| %>
<div class="form-group"> <div class="form-group">
@ -322,11 +329,7 @@ alert("1ssss2");
})(); })();
</script> </script>
<% elsif @application_form.registration_status.blank? %> <% elsif @application_form.application_form_start_date > @time_now %>
<%= t('application_form.sign_up_not_open') %>
<% elsif @application_form.signup_start_date > @time_now %>
<%= t('application_form.sign_up_not_yet') %> <%= t('application_form.sign_up_not_yet') %>

View File

@ -11,8 +11,8 @@ en:
copy: Copy copy: Copy
act_signup: Sign Up Info #報名資料 act_signup: Sign Up Info #報名資料
application_form_submission_field: Application Forms Submission Field application_form_submission_field: Application Forms Submission Field
application_form_signup_field: Application Forms Signup Field application_form_signup_field: Custom Field
application_form_signup: Signup Analyze application_form_signup: Applications
enquiry_for_applicants: Enquiry for applicants enquiry_for_applicants: Enquiry for applicants
reviewer_setting: Reviewer setting reviewer_setting: Reviewer setting
module_name: module_name:
@ -27,6 +27,27 @@ en:
abstract_number: Abstract number abstract_number: Abstract number
presentation_type: Presentation presentation_type: Presentation
application_form: application_form:
save_name: Save File Name
and_so_on: and so on
custom1: the first custom field
custom2: the second custom field
custom3: the third custom field
custom_explain: custom field which will automatically include all custom field to table but exclude the fields that are added
name_mask: 'Name only show the first word,for example: 蔡**'
custom_format_explain: use checkbox format to show custom-field's value
can_be_filled_with: can be filled with
show_title_trans: which will show the title's label being translated on now local
example: Example
example_explain: 'When custom field is test1、test2、test3, and being filled with a、b、c'
output_result: Output result
like: 'Like '
explanation: Explanation
save_data: Save as pdf
print: Print
print_setting: Print Format Setting
print_format: Print Format
reviewer_length: Reviewer Length
setting: Setting
participant_list: Participant list participant_list: Participant list
back: Back back: Back
please_login_first: "Please login first!" please_login_first: "Please login first!"
@ -85,14 +106,14 @@ en:
dashboard: Dashboard dashboard: Dashboard
display_field: Display field display_field: Display field
note: Note note: Note
email_signup_success: Signup success email_signup_success: Application sent success
email_submission_success: Submission registration success email_submission_success: Process approved success
email_add_file_success: Add file success email_add_file_success: Application Denied
email_edit_file_success: Edit file success email_edit_file_success: Application Approved success
email_signup_content: Signup success email_signup_content: Application sent success
email_submission_content: Submission registration success email_submission_content: Process approved success
email_add_file_content: Add file success email_add_file_content: Application Denied
email_edit_file_content: Edit file success email_edit_file_content: Application Approved success
email_title: Title email_title: Title
email_content: Content email_content: Content
email_signup: Application sent email_signup: Application sent
@ -113,10 +134,18 @@ en:
disable: Disable disable: Disable
hidden: Hidden(admin) hidden: Hidden(admin)
submission_set: Submission Set submission_set: Submission Set
signup_set: Signup Set signup_set: Default fields
reviewer_1st: 1st Reviewer reviewers:
reviewer_2nd: 2nd Reviewer '1': 1st Reviewer
reviewer_3rd: 3rd Reviewer '2': 2nd Reviewer
'3': 3rd Reviewer
'4': 4th Reviewer
'5': 6th Reviewer
'6': 6th Reviewer
'7': 7th Reviewer
'8': 8th Reviewer
'9': 9th Reviewer
'10': 10th Reviewer
defined_by_applicant: Defined by Applicant defined_by_applicant: Defined by Applicant
fixed: Fixed fixed: Fixed
review_end_date: Review End Date #審查結束日期 review_end_date: Review End Date #審查結束日期
@ -137,26 +166,24 @@ en:
registration_status_G: Attendee #Normal sign up #一般報名 registration_status_G: Attendee #Normal sign up #一般報名
application_form_start_date: Applicable Starting Time application_form_start_date: Applicable Starting Time
application_form_end_date: Applicable End Time application_form_end_date: Applicable End Time
signup_start_date: Sign Up Start Date #報名開始時間
signup_end_date: Sign Up End Date #報名結束時間
contribute_start_date: Contribute Start Date #投稿開始時間 contribute_start_date: Contribute Start Date #投稿開始時間
contribute_end_date: Contirbute End Date #投稿結束時間 contribute_end_date: Contirbute End Date #投稿結束時間
event_during: Valid Period event_during: Valid Period
contribute_during: Contribute During #投稿期間 contribute_during: Contribute During #投稿期間
signup_during: Sign Up During #報名期間 signup_during: Sign Up During #報名期間
signup_count: Applications signup_count: Applications
signup: Sign Up #報名 signup: Application
export: Export #匯出 export: Export #匯出
set_application_form_items: Items #項目 set_application_form_items: Items #項目
set_application_form_submission_field: Set Submission Field set_application_form_submission_field: Set Submission Field
set_application_form_signup_field: Default fields set_application_form_signup_field: Custom fields
set_application_form_item_content: Set Item Content #項目設定 set_application_form_item_content: Set Item Content #項目設定
set_application_form_agreements: Personal Data Usage Agreements #個資宣告設定 set_application_form_agreements: Personal Data Usage Agreements #個資宣告設定
application_form_agreements_content: Content of Personal Data Usage Agreements #個資宣告內容 application_form_agreements_content: Content of Personal Data Usage Agreements #個資宣告內容
to_require: Should Be Filled? #是否必填 to_require: Should Be Filled? #是否必填
sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始 sign_up_not_yet: Does Not Yet Allow to Apply #申請時間未開始
sign_up_not_open: Does Not Open Sign Up #未開放報名 sign_up_not_open: Does Not Open to Apply #未開放申請
sign_up_overdue: Sign Up Overdue #報名時間已過 sign_up_overdue: Application Overdue #申請時間已過
contribute_file_count: Count of Contribute Files #投稿檔案數 contribute_file_count: Count of Contribute Files #投稿檔案數
frontend: frontend:
@ -172,12 +199,13 @@ en:
content: Content #內容 content: Content #內容
application_form_signup: application_form_signup:
reviewer_ids_list: Reviewer Stages
serial_number: Sign-up No. serial_number: Sign-up No.
status: Attendee Role status: Attendee Role
title: File Name title: File Name
description: Summary description: Summary
file: Files file: Files
signup_time: Sign Up Time #報名時間 submission_time: Submission Time
name: Name name: Name
unit: Institute #單位 unit: Institute #單位
tel: Tel tel: Tel

View File

@ -12,9 +12,9 @@ zh_tw:
copy: 複製 copy: 複製
act_signup: 報名資料 act_signup: 報名資料
application_form_submission_field: 上傳介面欄位 application_form_submission_field: 上傳介面欄位
application_form_signup_field: 報名欄位 application_form_signup_field: 客製欄位
application_form_signup: 報名統計 application_form_signup: 申請紀錄
enquiry_for_applicants: 查詢報名人 enquiry_for_appflicants: 查詢報名人
reviewer_setting: 審查委員設定 reviewer_setting: 審查委員設定
module_name: module_name:
application_form: 線上申請表單 application_form: 線上申請表單
@ -28,6 +28,27 @@ zh_tw:
abstract_number: 摘要編號 abstract_number: 摘要編號
presentation_type: 發表方式 presentation_type: 發表方式
application_form: application_form:
save_name: 檔案儲存名稱
and_so_on: 以此類推
custom1: 客製化欄位的第一個欄位
custom2: 客製化欄位的第二個欄位
custom3: 客製化欄位的第三個欄位
custom_explain: 客製化欄位(會自動將所有新增的客製欄位帶入表格,但排除已使用數字加入的欄位)
name_mask: 姓名只顯示第一個字,如蔡**
custom_format_explain: 使用checkbox樣式來呈現單選或多選的欄位
can_be_filled_with: 可填入
show_title_trans: 會顯示當前語言的標籤翻譯
example: 範例
example_explain: '當客製化欄位為: test1、test2、test3被填入: a、b、c'
output_result: 輸出結果
like:
explanation: 說明
save_data: 存為pdf
print: 列印
print_setting: 列印格式設定
print_format: 列印格式
reviewer_length: 審查階段上限
setting: 設定
participant_list: 參加者名單 participant_list: 參加者名單
back: 回上一頁 back: 回上一頁
please_login_first: "請先登入!" please_login_first: "請先登入!"
@ -86,14 +107,14 @@ zh_tw:
dashboard: 儀錶板 dashboard: 儀錶板
display_field: 顯示的欄位 display_field: 顯示的欄位
note: 附註 note: 附註
email_signup_success: 報名成功 email_signup_success: 申請已送出成功
email_submission_success: 投稿註冊成功 email_submission_success: 審核階段已通過
email_add_file_success: 新增上傳成功 email_add_file_success: 申請不通過
email_edit_file_success: 編輯上傳成功 email_edit_file_success: 申請已通過
email_signup_content: 報名成功 email_signup_content: 申請已送出成功
email_submission_content: 投稿註冊成功 email_submission_content: 審核階段已通過
email_add_file_content: 新增上傳成功 email_add_file_content: 申請不通過
email_edit_file_content: 編輯上傳成功 email_edit_file_content: 申請已通過
email_title: 主旨 email_title: 主旨
email_content: 內文 email_content: 內文
email_signup: 申請送出 email_signup: 申請送出
@ -114,10 +135,18 @@ zh_tw:
disable: 關閉 disable: 關閉
hidden: 隱藏(後台) hidden: 隱藏(後台)
submission_set: 投稿欄位設定 submission_set: 投稿欄位設定
signup_set: 報名欄位設定 signup_set: 預設填寫欄位
reviewer_1st: 一階審核 reviewers:
reviewer_2nd: 二階審核 '1': 一階審核
reviewer_3rd: 三階審核 '2': 二階審核
'3': 三階審核
'4': 四階審核
'5': 五階審核
'6': 六階審核
'7': 七階審核
'8': 八階審核
'9': 九階審核
'10': 十階審核
defined_by_applicant: 申請人自填 defined_by_applicant: 申請人自填
fixed: 固定人員 fixed: 固定人員
review_end_date: 審查結束日期 review_end_date: 審查結束日期
@ -138,26 +167,24 @@ zh_tw:
registration_status_G: 一般報名 registration_status_G: 一般報名
application_form_start_date: 適用開始時間 application_form_start_date: 適用開始時間
application_form_end_date: 適用結束時間 application_form_end_date: 適用結束時間
signup_start_date: 報名開始時間
signup_end_date: 報名結束時間
contribute_start_date: 投稿開始時間 contribute_start_date: 投稿開始時間
contribute_end_date: 投稿結束時間 contribute_end_date: 投稿結束時間
event_during: 有效期間 event_during: 有效期間
contribute_during: 投稿期間 contribute_during: 投稿期間
signup_during: 報名期間 signup_during: 報名期間
signup_count: 申請紀錄 signup_count: 申請紀錄
signup: 報名 signup: 申請
export: 匯出 export: 匯出
set_application_form_items: 項目 set_application_form_items: 項目
set_application_form_submission_field: 上傳介面欄位設定 set_application_form_submission_field: 上傳介面欄位設定
set_application_form_signup_field: 預設填寫欄位 set_application_form_signup_field: 客製欄位
set_application_form_item_content: 項目設定 set_application_form_item_content: 項目設定
set_application_form_agreements: 個資宣告設定 set_application_form_agreements: 個資宣告設定
application_form_agreements_content: 個資宣告內容 application_form_agreements_content: 個資宣告內容
to_require: 是否必填 to_require: 是否必填
sign_up_not_yet: 報名時間未開始 sign_up_not_yet: 申請時間未開始
sign_up_not_open: 未開放報名 sign_up_not_open: 未開放申請
sign_up_overdue: 報名時間已過 sign_up_overdue: 申請時間已過
contribute_file_count: 投稿檔案數 contribute_file_count: 投稿檔案數
frontend: frontend:
@ -173,12 +200,13 @@ zh_tw:
content: 內容 content: 內容
application_form_signup: application_form_signup:
reviewer_ids_list: 審查階段
serial_number: 註冊編號 serial_number: 註冊編號
status: 報名身分 status: 報名身分
title: 稿件名稱 title: 稿件名稱
description: 摘要 description: 摘要
file: 檔案 file: 檔案
signup_time: 報名時間 submission_time: 提交時間
name: 姓名 name: 姓名
unit: 單位 unit: 單位
tel: 聯絡電話 tel: 聯絡電話

View File

@ -4,8 +4,19 @@ Rails.application.routes.draw do
scope "(:locale)", locale: Regexp.new(locales.join("|")) do scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin 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'
end
resources :application_forms do resources :application_forms do
member do member do
get 'print'
get 'copy' get 'copy'
get 'export' get 'export'
get 'set_write_off' get 'set_write_off'

View File

@ -1,6 +1,12 @@
module ApplicationForm module ApplicationForm
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "application_form" do initializer "application_form" do
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
require File.expand_path('../../../app/models/application_form_setting', __FILE__)
if defined?(ApplicationFormSetting)
s = ApplicationFormSetting.get_one
end
end
OrbitApp.registration "ApplicationForm", :type => "ModuleApp" do OrbitApp.registration "ApplicationForm", :type => "ModuleApp" do
module_label "application_form.application_form" module_label "application_form.application_form"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
@ -35,19 +41,29 @@ module ApplicationForm
:available_for => 'managers' :available_for => 'managers'
context_link 'application_form.set_application_form_items', context_link 'application_form.set_application_form_items',
:link_path=>"admin_application_form_items_path" , :link_path=>"admin_application_form_items_path" ,
:priority=>3, :priority=>4,
:active_for_action=>{'admin/application_forms'=>'application_form_items'}, :active_for_action=>{'admin/application_forms'=>'application_form_items'},
:available_for => 'managers' :available_for => 'managers'
context_link 'application_form.set_application_form_agreements', context_link 'application_form.set_application_form_agreements',
:link_path=>"admin_application_form_agreements_path" , :link_path=>"admin_application_form_agreements_path" ,
:priority=>3, :priority=>5,
:active_for_action=>{'admin/application_forms'=>'application_form_agreements'}, :active_for_action=>{'admin/application_forms'=>'application_form_agreements'},
:available_for => 'managers' :available_for => 'managers'
context_link 'application_form.enquiry_for_applicants', context_link 'application_form.enquiry_for_applicants',
:link_path=>"admin_application_form_enquiry_for_applicants_path" , :link_path=>"admin_application_form_enquiry_for_applicants_path" ,
:priority=>3, :priority=>6,
:active_for_action=>{'admin/application_forms'=>'enquiry_for_applicants'}, :active_for_action=>{'admin/application_forms'=>'enquiry_for_applicants'},
:available_for => 'users' :available_for => 'users'
context_link 'application_form.setting',
:link_path=>"setting_admin_application_forms_path" ,
:priority=>7,
:active_for_action=>{'admin/application_forms'=>'setting'},
:available_for => 'managers'
context_link 'application_form.print_setting',
:link_path=>"print_setting_admin_application_forms_path" ,
:priority=>8,
:active_for_action=>{'admin/application_forms'=>'print_setting'},
:available_for => 'sub_managers'
end end
end end