Compare commits

..

19 Commits

Author SHA1 Message Date
chiu 8addfd0631 Merge pull request 'Hide empty time field.' (#21) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/21
2024-04-15 16:26:46 +00:00
邱博亞 496dc1181f Hide empty time field. 2024-04-16 00:25:55 +08:00
chiu d62248c9e0 Merge pull request 'Add hidden class when sign_up_not_yet.' (#20) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/20
2024-04-15 16:13:37 +00:00
邱博亞 5a31d2c709 Add hidden class when sign_up_not_yet. 2024-04-16 00:10:12 +08:00
邱博亞 aadc929ae0 Merge pull request 'Add hidden class when sign_up_overdue.' (#19) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/19
2024-04-15 23:58:58 +08:00
邱博亞 f05280d97d Add hidden class when sign_up_overdue. 2024-04-15 23:57:48 +08:00
chiu be3af16a12 Merge pull request 'master' (#18) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/18
2024-04-09 13:06:06 +00:00
邱博亞 382df44068 fix error after update carrierwave 2024-04-09 12:57:03 +08:00
邱博亞 e4790f8490 Fix bug. 2024-03-21 22:26:05 +08:00
邱博亞 cb7cad9c74 Fix bug. 2024-03-21 22:24:39 +08:00
邱博亞 8b9bfaab8d Fix bug. 2024-03-21 22:20:27 +08:00
邱博亞 52755f9afe sync codes from 123/seminar. 2024-03-21 21:57:22 +08:00
chiu 397046e9b4 Merge pull request 'Add instructions field.' (#17) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/17
2024-02-28 08:38:54 +00:00
邱博亞 ca4a2f86f2 Add instructions field. 2024-02-28 16:31:31 +08:00
chiu a934972e72 Merge pull request 'master' (#16) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/16
2024-02-28 07:00:37 +00:00
邱博亞 1e52c3bf91 Fix bug. 2024-02-28 14:17:06 +08:00
邱博亞 d6b2d23462 Add instructions field. 2024-02-28 14:17:06 +08:00
邱博亞 40831d3b8c Fix indent. 2024-02-28 14:17:06 +08:00
邱博亞 1ae15033a8 Prepare to support ruby 3.3. 2024-02-24 21:22:45 +08:00
31 changed files with 199 additions and 1754 deletions

View File

@ -24,12 +24,12 @@ class Admin::SeminarSignupsController < OrbitAdminController
@seminar_signup = SeminarSignup.find(params[:id])
@seminar = SeminarMain.find(@seminar_signup.seminar_main_id)
@form_index = 0
@form_index = 0
end
def update
@seminar_signup = SeminarSignup.find(params[:id])
@seminar_signup.update_attributes(seminar_signup_params)
@ -60,7 +60,7 @@ class Admin::SeminarSignupsController < OrbitAdminController
@seminar_signup.destroy
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup?type=table"
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
end
private

View File

@ -90,7 +90,7 @@ class Admin::SeminarsController < OrbitAdminController
# exceptions = ["personal_book","personal_conference","personal_diploma","personal_experience","personal_journal","personal_lab","personal_patent","personal_project","personal_research"]
exceptions = []
@modules = ModuleApp.where(:key.nin => exceptions).frontend_enabled.order_by(:key=>'asc')
@searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]}
@searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]}
end
def reviewer_setting
@seminar_reviews = @seminar.seminar_reviews
@ -296,7 +296,7 @@ class Admin::SeminarsController < OrbitAdminController
end
elsif params[:mode] == "hide"
if seminar_main.session_show_ids.nil?
seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1]
seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1]
end
seminar_main.session_show_ids.delete(session_id)
elsif params[:mode] == "show"
@ -356,13 +356,13 @@ class Admin::SeminarsController < OrbitAdminController
@filter_fields = filter_fields(@categories)
@table_fields = [:category, 'seminar.title', 'seminar.event_during', 'seminar.signup_during', 'seminar.signup_count', 'seminar.export']
if !params[:sort].blank?
if !params[:sort].blank?
if params[:sort] == 'event_during'
sort = {:seminar_start_date.to_sym=>params[:order]}
sort = {:seminar_start_date.to_sym=>params[:order]}
elsif params[:sort] == 'signup_during'
sort = {:signup_start_date.to_sym=>params[:order]}
sort = {:signup_start_date.to_sym=>params[:order]}
else
sort = {params[:sort].to_sym=>params[:order]}
sort = {params[:sort].to_sym=>params[:order]}
end
else
sort = {:signup_start_date=>"desc",:created_at=>"desc"}
@ -432,7 +432,7 @@ class Admin::SeminarsController < OrbitAdminController
end
def create
if !seminar_params['seminar_links_attributes'].nil?
seminar_params['seminar_links_attributes'].each do |idx,link|
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
@ -494,7 +494,7 @@ class Admin::SeminarsController < OrbitAdminController
def update
@seminar_params = seminar_params rescue {}
if @seminar_params.count != 0
@seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : [])
@seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : [])
uid = params[:id].split('-').last
@seminar = SeminarMain.find_by(:uid=>uid)
if @seminar_params.has_key?("title_translations")
@ -545,7 +545,7 @@ class Admin::SeminarsController < OrbitAdminController
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
@seminar.update_user_id = current_user.id
if @seminar.update_attributes(seminar_params)
@seminar.update_enable_recaptcha
@ -559,7 +559,7 @@ class Admin::SeminarsController < OrbitAdminController
end
redirect_to admin_seminars_path
end
def set_write_off
@seminar.donation_write_off_status = true
@ -578,14 +578,14 @@ class Admin::SeminarsController < OrbitAdminController
def seminar_signup_field
@field_name = 'seminar_main'
@attribute = SeminarMain.find(params[:id])
@attribute = SeminarMain.find(params[:id])
@attribute_type = 'seminar'
@class = 'seminars'
end
def seminar_submission_field
@field_name = 'seminar_main'
@attribute = SeminarMain.find(params[:id])
@attribute = SeminarMain.find(params[:id])
@attribute_type = 'seminar'
@class = 'seminars'
end
@ -672,7 +672,7 @@ class Admin::SeminarsController < OrbitAdminController
end
def delete_seminar_signup
@seminar_signup = SeminarSignup.find(params[:id])
@seminar_id = @seminar_signup.seminar_main_id
@ -682,55 +682,6 @@ class Admin::SeminarsController < OrbitAdminController
redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup"
end
def create_email_set
SeminarEmailSet.create_new_fields(params[:id])
redirect_to "/admin/seminars/#{params[:id]}/edit"
end
def seminar_signup_success
@seminar = SeminarMain.find(params[:id])
end
def seminar_signup_success_save
@seminar = SeminarMain.find(params[:id])
params.require(:seminar_main).permit!
@seminar.update_attributes(params[:seminar_main])
@seminar.save
redirect_to admin_seminars_path
end
def send_notifying_email
sent_time = DateTime.now
@seminar = SeminarMain.find_by(:id => params[:seminar_id])
seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first
if !seminar_signup.blank?
extra_text = "<p> #{nl2br(params[:text])} </p>"
if params[:type] == "reset_password"
seminar_signup.status = 'C'
token = seminar_signup.generate_token
extra_text += "<br><a href='#{request.protocol + request.host_with_port + "/" + I18n.locale.to_s + "/seminar/" + @seminar.to_param}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar.click_here_to_confirm")}</a>"
end
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
seminar_signup.emails_sent << params[:type]
seminar_signup.emails_sent_time << sent_time
seminar_signup.save
end
render :json => {
"type" => t("seminar.#{params[:type]}"),
"sent_time" => sent_time.strftime("%Y/%m/%d %H:%M"),
"success" => true
}.to_json
end
def get_predefined_text
seminar = SeminarMain.find(params[:seminar_id])
text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
render :json => {
"success" => true,
"html" => text
}
end
private
def set_seminar
@ -807,7 +758,7 @@ class Admin::SeminarsController < OrbitAdminController
end
end
@email_set = []
['signup','submission','add_file','edit_file', 'reset_password', "special_reminder"].each do |field_name|
['signup','submission','add_file','edit_file'].each do |field_name|
email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name}
if email_set.length==0
title = Hash.new

View File

@ -3,18 +3,18 @@ class SeminarsController < ApplicationController
include MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view)
include Admin::SeminarsHelper
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_name", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page","edit_login_seminar_signup"]
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout"]
# include SimpleCaptcha::ControllerHelpers
def index
time_now = Time.now
seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories
{
"seminars" => seminars,
'time_now' => time_now,
"total_pages" => seminars.total_pages
}
}
end
def widget
@ -85,7 +85,7 @@ class SeminarsController < ApplicationController
prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}"
@prefix_url = prefix_url
@registration_postfix = "/home/registration"
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
"<a href=\"/\">Main Site</a>"
content_style = seminar_template_setting.content_style
background_style = seminar_template_setting.background_style
@ -295,7 +295,7 @@ class SeminarsController < ApplicationController
if last_path.include?("?")
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
uri_query = last_path.split("?")[1..-1].join('?')
uri_query = uri_query.gsub(/notice=[^&]*/,'').gsub(/&+$/,'')
uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'')
if uri_query.blank?
referer_url = referer_url + "?notice=#{notice_words}"
else
@ -334,6 +334,7 @@ class SeminarsController < ApplicationController
seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
sign_up_not_yet = true
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue
@ -360,6 +361,7 @@ class SeminarsController < ApplicationController
'sign_up' => sign_up,
'contribute_action' => contribute_action,
'time_now' => time_now,
'sign_up_not_yet' => sign_up_not_yet,
'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date),
'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date),
'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date)
@ -379,20 +381,7 @@ class SeminarsController < ApplicationController
seminar_signup = SeminarSignup.new
time_now = Time.now
referer_url = OrbitHelper.request.referer
if (referer_url.nil? || referer_url.match(/(\?|&)method=show_privacy/).nil?) && !OrbitHelper.request.params[:notice]
return {
"seminar" => seminar,
"seminar_signup" => seminar_signup,
"time_now" => time_now,
"redirect_to" => "#{OrbitHelper.url_to_show(seminar.to_param)}?method=show_privacy"
}
end
time_now = Time.now
{
"seminar" => seminar,
"seminar_signup" => seminar_signup,
@ -404,36 +393,18 @@ class SeminarsController < ApplicationController
def check_email
params = OrbitHelper.params
success = true
if !params[:email].blank?
if !params[:email].blank?
count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count
result = count > 0 ? t('seminar.already_used') : t('seminar.available')
success = count > 0 ? false : true
else
result = t('seminar.please_enter_email')
end
render :json => {
"result" => result,
"success" => success
}.to_json
end
def check_name
params = OrbitHelper.params
success = true
if !params[:name].blank?
count = SeminarSignup.where(:name => params[:name], :seminar_main_id => params[:no]).count
result = count > 0 ? t('seminar.already_used') : t('seminar.available')
success = count > 0 ? false : true
end
render :json => {
"result" => result,
"success" => success
}.to_json
{
"result" => result
}
end
@ -451,18 +422,12 @@ class SeminarsController < ApplicationController
end
def create
OrbitHelper.set_page(nil)
referer_url = request.referer
if referer_url
params[:url] = URI.parse(referer_url).path.sub(/\/[^\/]*$/, '').sub(/^\/#{I18n.locale}/, '')
end
OrbitHelper.set_params(params, current_user)
seminar_id = params[:seminar_signup][:seminar_main_id]
@seminar = SeminarMain.where(id: seminar_id).first
if @seminar.enable_recaptcha && (!gotcha_valid?)
notice_words = t('recaptcha.errors.verification_failed')
referer_url = get_referer_url_for_notice(notice_words)
show_alert(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
signup_limit = @seminar.signup_limit
@ -481,7 +446,7 @@ class SeminarsController < ApplicationController
else
notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words)
show_alert(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
end
@ -490,15 +455,12 @@ class SeminarsController < ApplicationController
if signup_limit <= signup_count
notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words)
show_alert(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
end
end
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first
if @signup.blank?
@signup = SeminarSignup.where(name: params[:seminar_signup][:name], seminar_main_id: seminar_id ).first
end
@seminar_signup = SeminarSignup.new(seminar_signup_params)
not_signup_yet = @signup.blank?
@ -526,23 +488,16 @@ class SeminarsController < ApplicationController
@seminar.save
end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
# extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, :seminar_signup=>@seminar_signup},:layout=>false)
extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar,
:seminar_signup=>@seminar_signup},:layout=>false)
if params['seminar_signup']['status']=='C'
status_param = '&status='
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
else
status_param = ''
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}")
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
else
if has_counter
OrbitHelper::SharedMutex.synchronize do
@ -550,68 +505,21 @@ class SeminarsController < ApplicationController
end
end
if !not_signup_yet
notice_words = t('seminar.email_or_name_exist')
notice_words = t('seminar.email_exist')
referer_url = get_referer_url_for_notice(notice_words)
show_alert(notice_words)
redirect_to referer_url, :notice => notice_words
else
notice_words = t('seminar.sign_up_failed')
referer_url = get_referer_url_for_notice(notice_words)
show_alert(notice_words)
redirect_to referer_url, :notice => notice_words
end
end
end
def update_signup_form
OrbitHelper.set_page(nil)
referer_url = request.referer
if referer_url
params[:url] = URI.parse(referer_url).path.sub(/\/[^\/]*$/, '').sub(/^\/#{I18n.locale}/, '')
end
params = OrbitHelper.params
tmp_seminar_signup_params = seminar_signup_params
@seminar_signup = SeminarSignup.find(params[:signup_id])
@seminar_signup.update_attributes(tmp_seminar_signup_params)
@seminar_signup.generate_token
if !params[:seminar_signup_values].nil?
params[:seminar_signup_values].each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:id], field_value)
end
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar_signup.seminar_main_id).to_a
seminar_reviews.each{|sr| sr.save}
@seminar = @seminar_signup.seminar_main
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
@seminar.seminar_reviews.each do |sr|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
end
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
@seminar.save
end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
if tmp_seminar_signup_params['status']=='C'
status_param = '&status='
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
else
status_param = ''
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
end
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}")
end
def signup_ok
params = OrbitHelper.params
msg = SeminarMain.where(:uid => params[:seminar]).first.signup_success
{
"serial_number"=> params[:serial_number],
"message" => msg
}
{"serial_number"=> params[:serial_number]}
end
def add_file_proc
@ -799,16 +707,6 @@ class SeminarsController < ApplicationController
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil
show = true
seminar.seminar_submission_field_sets.each do |ssf|
if ssf.disabled && ssf.hidden
show = false
else
show = true
break
end
end
else
seminar = {}
@ -819,32 +717,11 @@ class SeminarsController < ApplicationController
{
'time_now' => time_now,
'seminar' => seminar,
'seminar_signup' => seminar_signup,
"show" => show
'seminar_signup' => seminar_signup
}
end
def edit_login_seminar_signup #copy from show
if !@@session[:seminar_main_id].blank?
seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil
else
seminar = {}
seminar_signup = {}
end
module_app = ModuleApp.where(:key => "seminar").first
categories = module_app.categories
time_now = Time.now
{
"seminar" => seminar,
"seminar_signup" => seminar_signup,
"time_now" => time_now
}
end
def con_logout
# redirect_to page_for_seminar_url
@ -866,55 +743,6 @@ class SeminarsController < ApplicationController
end
def reset_email
end
def reset_password_page
params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid])
seminar_signup = seminar.seminar_signups.where(:status=>'C', :id=> params[:cid], :token => params[:token]).first
password_pattern = ""
if(seminar.seminar_signup_field_sets.count != 0)
password_pattern = seminar.seminar_signup_field_sets.where(:field_name => "password").first.validator rescue ""
end
status = false
if(!seminar_signup.nil?)
status = true
end
{
"status" => status,
"seminar" => seminar,
"pattern" => password_pattern,
"cid" => params[:cid],
"token" => params[:token]
}
end
def confirm_email_page
confirm = false
params = OrbitHelper.params
uid = params[:uid]
if uid.nil?
uid = params[:page].split('-').last
end
seminar = SeminarMain.where(:uid => uid).first
if(!seminar.nil?)
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token]).first
if(!signup.nil?)
signup.token = nil
signup.is_confirmed = true
signup.is_confirmed_date = DateTime.now
signup.signup_confirmed_counter = signup.signup_confirmed_counter + 1
signup.save
confirm = true
end
end
{
"confirm" => confirm,
"url" => OrbitHelper.url_to_show(seminar.to_param)
}
end
def con_login_proc
seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
@ -933,35 +761,6 @@ class SeminarsController < ApplicationController
end
def reset_confirm_password_proc
params = OrbitHelper.params
seminar = SeminarMain.find(params[:seminar_id])
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page" if seminar.nil?
seminar_signup = seminar.seminar_signups.where(:status =>'C', :token => params[:reset_token], :id => params[:cid]).first
if !seminar_signup.blank?
seminar_signup.password = params[:password]
seminar_signup.token = nil
seminar_signup.save
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed')
else
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed_not_ok')
end
end
def reset_password_proc
@seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first
if !seminar_signup.blank?
token = seminar_signup.generate_token
extra_text = "<br><a href='#{request.protocol + request.host_with_port + params[:referer_url].to_s.chomp('/')}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar.click_here_to_confirm")}</a>"
send_mail('reset_password', seminar_signup.email, @seminar.id.to_s, extra_text)
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.reset_email_sent')
else
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.email_not_found')
end
end
def seminar_signup_params
params.require(:seminar_signup).permit!
end
@ -973,20 +772,22 @@ class SeminarsController < ApplicationController
def seminar_signup_values_params
params.require(:seminar_signup_values).permit!
end
private
def show_alert(notice_words)
respond_to do |format|
format.js{
render :js => "$('.rucaptcha-image').click();alert('#{notice_words}');"
}
end
end
def redirect_with_js(url)
respond_to do |format|
format.js{
render :js => "window.location.href = '#{url}';"
}
end
def send_mail(field_name,email,seminar_id,extra_text="")
email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name}
if email_set.length==0
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: t("seminar.email_#{field_name}_success"),
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
elsif !(email_set[0].disabled)
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: email_set[0].title[I18n.locale],
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
end
end
end

View File

@ -7,7 +7,6 @@ module Admin::SeminarsFieldHelper
include ActionView::Helpers::RenderingHelper
include ActionView::Context
include OrbitBasis::RenderAnywhere
include ::MemberHelper
include OrbitFormHelper
@ -65,14 +64,14 @@ module Admin::SeminarsFieldHelper
def render_checkbox
@prefiled_value ||=[]
control_group_wrapper_for_sm do
control_group_wrapper_for_sm do
a = self.typeE[:option_list].collect do |key,value|
label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
end.join.html_safe rescue ""
end
end
def render_date
def render_date
d = DateTime.now()
if date_is_range?
@ -96,13 +95,13 @@ module Admin::SeminarsFieldHelper
when 'format3'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM')
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM')
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM')
when 'format4'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy')
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy')
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy')
end
@ -122,13 +121,13 @@ module Admin::SeminarsFieldHelper
when 'format2'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
when 'format3'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
when 'format4'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
end
control_group_wrapper_for_sm{tmp}
# control_group_wrapper_for_sm{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
control_group_wrapper_for_sm{tmp}
# control_group_wrapper_for_sm{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
end
end
@ -146,7 +145,7 @@ module Admin::SeminarsFieldHelper
end
def render_date_durnation #Need re-write low priority
end
def render_radio_button
@ -183,7 +182,7 @@ module Admin::SeminarsFieldHelper
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue ''
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', :maxlength=> 300, :style => "width:500px;height:200px"))
text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control'))
end
end
@ -194,7 +193,7 @@ module Admin::SeminarsFieldHelper
place_holder= typeA["placeholder"][key_field] rescue ''
name1 = can_muti_lang_input_for_sm? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join)
text_field_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control'))
end
end
end
def render_file_field
@ -202,39 +201,21 @@ module Admin::SeminarsFieldHelper
add_more_blank = can_add_more ? "[]" : ""
key_field = can_muti_lang_input? ? "[#{key}]" : ""
field_name = [get_field_name_base,add_more_blank,key_field].join
file_required =@require && !value ? 'required="required"' : ''
file_required =@require ? 'required="required"' : ''
"<div class=\"file-selector\"><label class=\"ui-button\">
<input style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" accept=\".pdf,.png,.jpg,.odf\" onchange=\"if(this.files[0].size > 1048576*20){alert('#{I18n.t("seminar.file_limit_hint")}');this.value = '';}else{var ext = this.value.match(/\.([^\.]+)$/)[1];if (!['pdf','png','jpg','odf'].includes(ext)){alert('#{I18n.t("seminar.file_format_hint")}');this.value='';}}\" />
<input style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" />
<i class=\"fa fa-file\"></i> #{I18n.t('file.upload')}
</label><div class=\"filename\"></div></div>#{value}".html_safe
end
end
def render_email
a = control_group_wrapper_for_sm do |key,value|
place_holder= typeA["placeholder"][I18n.locale] rescue ''
email_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', title: I18n.t("seminar.email_hint"))) +
(content_tag :div,:class=>"loader" do
end)
end
end
def render_phone
a = control_group_wrapper_for_sm do |key,value|
place_holder= typeA["placeholder"][I18n.locale] rescue ''
text_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: I18n.t("seminar.phone_hint"))) + (content_tag :p do
"(#{I18n.t("seminar.phone_hint")})"
end)
end
end
end
def date_is_range?
is_range = "false"
data = get_data
if !data.nil?
is_range = data['is_range'] if data.has_key? "is_range"
is_range = data['is_range'] if data.has_key? "is_range"
end
is_range == "true"
is_range == "true"
end
protected
@ -272,7 +253,7 @@ protected
div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
buff2 = valid_locales.each.collect do |key|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
if @show_set_field_for_sm && @markup=='text_area'
@ -295,7 +276,7 @@ protected
else
# tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do
tmp1 =
tmp1 =
content_tag :div,:class=> "tab-content" do
buff = valid_locales.collect do |key|
@ -322,7 +303,7 @@ protected
end
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
buff2 = valid_locales.each.collect do |key|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
@ -337,7 +318,7 @@ protected
end # of content ul
tmp = content_tag :div,:class=> "input-append" do
tmp1 << tmp2
end
@ -352,8 +333,8 @@ protected
add_more_counter = ""
if can_add_more
add_more_counter = add_more_params[0][:counter]
add_more_value = add_more_params[0][:value]
add_more_counter = add_more_params[0][:counter]
add_more_value = add_more_params[0][:value]
end
if can_muti_lang_input_for_sm?
@ -363,7 +344,7 @@ protected
else #cross lang field
case can_add_more
when true
value = add_more_params[0][:value]
value = add_more_params[0][:value]
result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") }
# result << add_more_unt
else
@ -379,7 +360,7 @@ protected
end # of def controls_wrapper_for_sm(&block)
def control_group_wrapper_for_sm(&block)
def control_group_wrapper_for_sm(&block)
div_class = can_muti_lang_input_for_sm? ? "col-sm-10 controls" : "col-sm-10 controls"
# div_class = can_muti_lang_input_for_sm? ? "control-group language-swich" : "control-group"
result = ""
@ -390,7 +371,7 @@ protected
if can_add_more
multipleInputs =
multipleInputs =
content_tag(:div,:class=>"add-target") do
@attribute_value.add_more_counter.times.collect do |t|
controls_wrapper_for_sm(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
@ -399,8 +380,8 @@ protected
temp = content_tag(:div, multipleInputs + add_more_unt, :class=>'add-input')
result = form_label + content_tag(:div,temp,:class=>div_class)
result = form_label + content_tag(:div,temp,:class=>div_class)
# result = label + multipleInputs + add_more_unt
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
@ -426,7 +407,7 @@ protected
end
def add_more_unt
def add_more_unt
temp_field_name = get_basic_field_name_base + '[temp]'
add_more = content_tag :p,:class=> 'add-btn' do
content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input_for_sm? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary"
@ -465,7 +446,7 @@ protected
prefix = opts[:prefix]
suffix = opts[:suffix]
str = get_basic_field_name_base.gsub("[","_").gsub("]",'')
str = prefix.nil? ? str : prefix+ str
str = prefix.nil? ? str : prefix+ str
suffix.nil? ? str : str + suffix
end
@ -487,8 +468,7 @@ protected
def form_label
if self.markup == "text_area"
# plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
plc = nil
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
label_tag(key, '' , :class=>"col-sm-2 control-label muted") do
concat (!@require.blank? ? '*'+title : title)
if plc
@ -505,7 +485,7 @@ protected
if self.markup == "address"
return true
else
$seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
$seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
end
end
@ -572,7 +552,7 @@ protected
if markup=='text_field'
if key_field == 'seminar_email_sets'
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value,:class=>'input-medium form-control')
else
else
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value)
end
else
@ -586,4 +566,4 @@ protected
@show_set_field_for_sm = nil
return a.html_safe
end
end
end

View File

@ -50,24 +50,6 @@ module Admin::SeminarsHelper
end
# return "/#{I18n.locale}#{page.url}/#{seminar.to_param}"
end
def send_mail(field_name,email,seminar_id,extra_text="")
email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name}
if email_set.length==0
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: t("seminar.email_#{field_name}_success"),
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
elsif !(email_set[0].disabled)
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: email_set[0].title[I18n.locale],
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
end
end
module MultiLang
extend self
extend ActionView::Helpers::FormTagHelper

View File

@ -6,6 +6,5 @@ class SeminarEmailSet
field :title
field :content
field :disabled, type: Boolean, default: false
field :is_confirmation, type: Boolean, default: false
belongs_to :seminar_main
end

View File

@ -18,7 +18,6 @@ class SeminarMain
field :title, as: :slug_title, type: String, localize: true
field :speaker, localize: true
field :content, localize: true
field :signup_success, localize: true
field :act_place, localize: true
field :enable_summary_choice, :type => Boolean, :default => false
field :summary_chioice_type, :type => String, :default => "checkbox"
@ -35,7 +34,7 @@ class SeminarMain
field :contribute_start_date, :type => Date
field :contribute_end_date, :type => Date
field :contribute_file_count, type: String
field :registration_status , :type => Array #C: 投稿者 G:一般
@ -312,7 +311,7 @@ class SeminarMain
r = "#{date1.strftime('%Y-%m-%d')}"
if date2
r += " - #{date2.strftime('%Y-%m-%d')}"
r += " - #{date2.strftime('%Y-%m-%d')}"
else
r += " - #{I18n.t(:no_deadline)}"
end
@ -402,7 +401,7 @@ class SeminarMain
def get_attribute_values(attribute_type=nil)
@attribute_values = attribute_type.seminar_signup_values rescue nil
end
def get_value_from_field_id(field_id,attribute_type=nil)
values = get_attribute_values(attribute_type)
value = values.detect {|value| value.seminar_signup_field_id == field_id} rescue nil
@ -437,7 +436,7 @@ class SeminarMain
seminar_signup = need_change_seminar_signups[i]
if seminar_signup.seminar_session_ids.present?
seminar_signup.seminar_session_ids = seminar_signup.seminar_session_ids.map{|id| @records_all["seminar_session_ids"][id]} rescue []
end
end
end
count_array = (0...self.seminar_reviews.to_a.count).to_a
change_fields = [:seminar_signup_ids, :remove_seminar_signup_ids, :default_seminar_signup_ids]
@ -516,7 +515,7 @@ class SeminarMain
tmp_relations_fields << k
else
org_k = k.to_s
result = other_has_many_class.map do |k|
result = other_has_many_class.map do |k|
belongs_to_class = k.classify.constantize.relations.select{|kk,v| v.macro == :belongs_to}.keys
has_many_class = k.classify.constantize.relations.select{|kk,v| v.macro.to_s.start_with?('has') }.keys
if (belongs_to_class - tmp_singularize_relations_fields - [org_k]).count == 0
@ -694,8 +693,4 @@ class SeminarMain
def enable_review_result
self.assign_mode == 2
end
def to_param
tmp = super()
URI.encode(tmp)
end
end
end

View File

@ -3,19 +3,11 @@ class SeminarSignup
include Mongoid::Document
include Mongoid::Timestamps
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename", "token", "reset_token", "emails_sent"]
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename"]
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
field :sort_number , type: Integer, default: 10000
field :status
field :token
field :is_confirmed, type: Boolean, default: false # for email confirmation
field :signup_confirmed, type: Boolean, default: false
field :is_confirmed_date, type: DateTime
field :signup_confirmed_date, type: DateTime
field :signup_confirmed_counter, type: Integer, default: 0
field :emails_sent, type: Array, default: []
field :emails_sent_time, type: Array, default: []
field :name # become Last Name for TICC
field :tel, type: String # become First Name for TICC
field :unit, localize: true #Only localize for preserving old record
@ -34,7 +26,7 @@ class SeminarSignup
field :seminar_session_ids, type: Array, default: []
has_many :seminar_signup_values, :autosave => true, :dependent => :destroy
has_many :seminar_signup_contributes, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true
accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true
scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) }
@ -59,12 +51,10 @@ class SeminarSignup
[l, (tmp ? tmp : unit)]
end.to_h
if self.serial_number.nil?
# last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).to_i
# self.serial_number = last_serial_number + 1
# SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
self.serial_number = DateTime.now.to_i
last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).to_i
self.serial_number = last_serial_number + 1
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
end
self.token = SecureRandom.hex(5)
end
after_destroy do
seminar_main = self.seminar_main
@ -79,7 +69,7 @@ class SeminarSignup
sr.save
end
end
seminar_main.seminar_signups.delete(self) #avoid resave
seminar_main.seminar_signups.delete(self) #avoid resave
if seminar_main.unassigned_seminar_signup_ids.delete(id)
seminar_main.save
end
@ -90,13 +80,6 @@ class SeminarSignup
seminar_session.save
end
end
def generate_token
token = SecureRandom.hex(5)
self.token = token
self.save
return token
end
def display_serial_number
display_format_string(self.serial_number,4)
end
@ -192,8 +175,4 @@ class SeminarSignup
return all_fields
end
end
def emails_sent_groups
emails_sent.zip([nil]*(emails_sent.length-emails_sent_time.length) + emails_sent_time.collect{|v| v.in_time_zone})
end
end

View File

@ -15,9 +15,9 @@ class SeminarSignupField
field :built_in, type: Boolean, default: false
field :disabled, type: Boolean, default: false
# field :to_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true
field :typeA, type: Hash, default: {cross_lang: false}
field :typeB, type: Hash, default: {}
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
@ -58,8 +58,8 @@ class SeminarSignupField
def option_list
if self_defined_markup_options?
#Class need to have corresponding field and value agent
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
#Class need to have corresponding field and value agent
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
method = self.seminar.method(self[:key].pluralize+"_for_"+markup)
return (method.call rescue {})
elsif self[:option_list].nil? || (self[:option_list].empty?)
@ -104,7 +104,7 @@ class SeminarSignupField
def is_built_in?
self.built_in
end
def is_disabled?
self.disabled
end
@ -132,7 +132,7 @@ class SeminarSignupField
if self[field]["cross_lang"] != var["cross_lang"]
case var["cross_lang"]
when "true" #from no-add_more to add_more
cross_lang_convert(:to_cross_lang)
cross_lang_convert(:to_cross_lang)
else #from add_more to no-add_more
cross_lang_convert(:to_no_cross_lang)
end # of case
@ -143,23 +143,23 @@ class SeminarSignupField
if self["typeA"]["add_more"] != var["add_more"]
case var["add_more"]
when "true" #from no-add_more to add_more
add_more_convert(:to_add_more)
add_more_convert(:to_add_more)
else #from add_more to no-add_more
add_more_convert(:to_no_add_more)
end # of case
end # of if
end
def cross_lang_convert(opt)
def cross_lang_convert(opt)
end
def check_option_list
self[:option_list] = self[panel]["option_list"] rescue nil
end
def add_more_convert(opt)
def add_more_convert(opt)
end
end
end

View File

@ -5,7 +5,6 @@ class SeminarSignupFieldSet
field :field_name, type: String
field :placeholder
field :name
field :validator
field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false
belongs_to :seminar_main

View File

@ -1,4 +1,4 @@
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms", multipart: true} do |f| %>
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<% content_for :page_specific_css do %>
@ -14,15 +14,7 @@
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<style type="text/css">
.emails_sent_groups{
display: inline-block;
}
.emails_sent_time{
min-height: 1em;
display: inline-block;
}
</style>
<!-- Input Area -->
<div class="input-area">
@ -100,63 +92,6 @@
<div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div>
<div class="controls">
<label class="radio-inline">
<%= f.check_box :is_confirmed, :checked => (@seminar_signup.is_confirmed)%>
<%= f.hidden_field :is_confirmed_date %>
<%= t('seminar_signup.is_confirmed') %>
</label>
</div>
<br />
<div class="controls">
<label for="send_email" class="control-label muted"><%= t("seminar_signup.send_email") %></label>
<div class="controls">
<select name="send_email" id="send_email">
<option value=""><%= t("seminar.select_email_type") %></option>
<option value="reset_password"><%= t("seminar.reset_password") %></option>
<option value="special_reminder"><%= t("seminar.special_reminder") %></option>
</select>
</div>
</div>
<br />
<div class="controls">
<label class="control-label muted"><%= t("seminar_signup.predefined_text") %></label>
<div class="controls">
<p id="predefined_text">&nbsp;</p>
</div>
</div>
<br />
<div class="controls">
<label for="send_email_text" class="control-label muted"><%= t("seminar_signup.send_email_text") %></label>
<div class="controls">
<textarea class="" name="send_email_text" id="send_email_text" row="20" col="30"></textarea>
</div>
</div>
<br />
<div class="controls">
<div class="controls">
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
</div>
</div>
<br />
<div class="controls">
<label for="" class="control-label muted"><%= t("seminar_signup.emails_already_sent") %></label>
<div class="controls" id="emails_sent">
<% @seminar_signup.emails_sent_groups.each do |em, em_date| %>
<span class="emails_sent_groups">
<span class="label label-success">
<%= t("seminar.#{em}") %>
</span>
<br />
<span class="emails_sent_time">
<% if em_date %>
<%= em_date.strftime("%Y/%m/%d %H:%M") %>
<% end %>
</span>
</span>
<% end %>
</div>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="controls">
<div class="input-append">
@ -235,7 +170,7 @@
<div class="control-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.markup == "file_field" ? false : rf.to_require) %>
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div>
@ -243,13 +178,7 @@
<% end %>
<div class="controls">
<label class="radio-inline">
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
<%= f.hidden_field :signup_confirmed_date %>
<%= t('seminar_signup.registration_complete') %>
</label>
</div>
</div>
@ -264,78 +193,4 @@
</fieldset>
<% end %>
<script>
$(document).ready(function(){
$("#send_email").on("change", function(){
if($(this).val() != ""){
let type = $(this).val();
$.ajax({
url : "/admin/seminars/get_predefined_text",
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
dataType : "json",
type : "get",
success : function(data){
if (type === 'reset_password'){
$('#seminar_signup_status_c').click();
}
if( data.success == true ){
$("#predefined_text").html(data.html);
}
}
})
}
})
$("#send_email_button").on("click",function(){
if($("#seminar_signup_email").val() == ""){
alert("No email");
return false;
}
if($("#send_email").val() != ""){
$.ajax({
url : "/admin/seminars/send_notifying_email",
data : {
"type" : $("#send_email").val(),
"email" : $("#seminar_signup_email").val(),
"text" : $("#send_email_text").val(),
"seminar_id": "<%= @seminar.id %>"
},
dataType : "json",
type : "post",
success : function(data){
if( data.success == true ){
alert("Email Sent");
$("#emails_sent").append('<span class="emails_sent_groups"><span class="label label-success">'+ data.type +'</span><br/><span class="emails_sent_time">' +data.sent_time +'</span></span>');
}
}
})
}
return false;
})
})
$(".upload").on("change",function(){
filenamedom = $(this).parent().parent().find(".filename");
filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
})
$("#seminar_signup_signup_confirmed").on("change",function () {
if(this.checked){
dt = new Date();
format = dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
$("#seminar_signup_signup_confirmed_date").val(format);
}else{
$("#seminar_signup_signup_confirmed_date").val("");
}
})
$("#seminar_signup_is_confirmed").on("change",function () {
if(this.checked){
dt = new Date();
format = dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
$("#seminar_signup_is_confirmed_date").val(format);
}else{
$("#seminar_signup_is_confirmed_date").val("");
}
})
</script>
<% end %>

View File

@ -184,7 +184,6 @@
<th><%= t('seminar.placeholder') %></th>
<th><%= t('seminar.disable') %></th>
<th><%= t('seminar.hidden') %></th>
<th><%= t('seminar.validator') %> <br /> (Use regex pattern)</th>
</thead>
<tbody>
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
@ -209,13 +208,6 @@
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
<% end %>
</td>
<% if attr_signup.field_name == "password" %>
<td>
<%= text_field_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][validator]", attr_signup.validator) %>
</td>
<% else %>
<td>&nbsp;</td>
<% end %>
</tr>
<% end %>
</tbody>
@ -333,19 +325,9 @@
<%= t('seminar.email_edit_file') %>
</a>
</li>
<li class="">
<a href="#email_set4" data-toggle="tab">
<%= t('seminar.email_forgot_password') %>
</a>
</li>
<li class="">
<a href="#email_set5" data-toggle="tab">
<%= t('seminar.email_special_reminder') %>
</a>
</li>
</ul>
<div class="tab-content">
<% (0..5).each do |index1| %>
<% (0..3).each do |index1| %>
<% active_email_set = index1==0 ? ' active' : '' %>
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
<table style="width:100%;">
@ -359,17 +341,6 @@
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
</td>
</tr>
<% if index1 == 0 %>
<tr>
<td>
<%= t('seminar.is_confirmation') %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]", true ,@email_set[index1].is_confirmation) %>
</td>
</tr>
<% end %>
<tr>
<td>
<%= t('seminar.email_title') %>

View File

@ -28,7 +28,6 @@
<li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_success"><%= t('seminar.seminar_signup_success') %></a></li>
<li><a href="<%=reviewer_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.reviewer_setting') %></a></li>
<li><a href="<%=template_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.template_setting') %></a></li>
<li><a href="<%=sub_page_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.sub_page_setting') %></a></li>
@ -41,7 +40,7 @@
</td>
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date) %></td>
<td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup?type=table">
<td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup">
<% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
<% if @seminar_review.present? && !@can_edit %>
<%= @seminar_review.get_all_seminar_signup_ids.count %>

View File

@ -52,39 +52,14 @@
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if @can_edit
val += content_tag :li do
link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
end
val += content_tag :li do
link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
end
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[1] == 'status' %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] == 'is_confirmed' %>
<% if seminar_signup.is_confirmed
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}(#{seminar_signup.signup_confirmed_counter.to_s})</span>"
else
val = "<span class='label label-danger'>#{t("seminar_signup.email_not_confirmed")}</span>"
end
%>
<% elsif names[1] == 'signup_confirmed' %>
<% if seminar_signup.signup_confirmed
val = "<span class='label label-success'>#{t("seminar_signup.signup_confirmed")}</span>"
else
val = "<span class='label label-danger'>#{t("seminar_signup.signup_not_confirmed")}</span>"
end
%>
<% elsif names[1] == 'signup_confirmed_date' %>
<% val = seminar_signup.signup_confirmed_date.strftime("%Y/%m/%d %H:%M") rescue ""
%>
<% elsif names[1] == 'is_confirmed_date' %>
<%
val = seminar_signup.is_confirmed_date.strftime("%Y/%m/%d %H:%M") rescue ""
%>
<% elsif names[1] != 'recaptcha' %>
<% val = seminar_signup.send("#{names[1]}") %>
<% end %>
@ -94,19 +69,15 @@
val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">"
if @can_edit
val += content_tag :li do
link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
end
val += content_tag :li do
link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
end
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
end
val += "</ul>
</div>"
%>
<% elsif names[2] == "tel" %>
<% val = seminar_signup.tel %>
<% elsif names[2] == "registration_status" %>
<% elsif names[2] == "registration_status" %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% end %>
<% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %>

View File

@ -1,63 +0,0 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<h2><%= t('seminar.seminar') %></h2>
<%= form_for @seminar, url: "/admin/seminars/#{@seminar.id.to_s}/seminar_signup_success_save", html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<div class="control-group input-content">
<label class="control-label muted"><%= t('seminar.seminar_signup_success') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :signup_success_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@seminar.signup_success_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_seminars_path, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -1,9 +0,0 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'reset_password'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('seminar.email_add_file_content') %>
<% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -1,9 +1,9 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'signup'} %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('seminar.email_signup_content') %>
<% end %>
<% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -1,9 +0,0 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'special_reminder'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('seminar.email_add_file_content') %>
<% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -39,9 +39,6 @@
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
</div>
<br/>
<div class="control-group clear">
<a href="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first + "?method=reset_email" %>"><%= t('seminar_signup.forgot_password') %></a>
</div>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>

View File

@ -21,17 +21,17 @@
else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end
%>
<h3 style="display:block;"><%= @seminar.title %></h3>
<% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && ( @seminar.contribute_end_date.nil? || @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %>
<% if !session[:seminar_signup_id].blank? %>
<%= t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
<a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary' style="display:inline;"><%= t('seminar_signup.logout') %></a>
<a href="<%= prefix_url %>?method=edit_login_seminar_signup&con_no=<%= @seminar.id %>" class='btn btn-primary' style="display:inline;"><%= t('seminar_signup.edit_form') %></a>
<% if data["show"] %>
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
<a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a>
<table class="table table-hover table-striped seminar-index">
<caption>
<h3><%= @seminar.title %></h3>
</caption>
<thead>
<tr>
<% if show1 %>
@ -91,7 +91,6 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
<% end %>
<% end %>
<br />
<br />

View File

@ -1,21 +0,0 @@
<% # encoding: utf-8 %>
<%
data = action_data("confirm_email_page")
if data["url"]
url = data["url"]
end
%>
<br>
<% if (data['confirm'] == true) %>
<%= t('seminar.confirm_ok') %>
<br>
<a href="<%= url %>?method=con_login" class="btn btn-primary">
<%= t('seminar.click_to_contribute') %>
</a>
<% else %>
<%= t('seminar.confirm_not_ok') %>
<br>
<a href="<%= url %>?method=show_data" class="btn btn-primary">
<%= t('seminar.back') %>
</a>
<% end %>

View File

@ -1,506 +0,0 @@
<%
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
@form_index = 0
if data["prefix_url"]
prefix_url = data["prefix_url"]
else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end
registration_is_open = @seminar.registration_status.present?
sign_up_not_yet = @seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
signup_is_full = @seminar.signup_is_full?
%>
<style>
.error {
color: red;
}
</style>
<% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %>
<% elsif sign_up_not_yet %>
<%= t('seminar.sign_up_not_yet') %>
<% elsif sign_up_overdue %>
<%= t('seminar.sign_up_overdue') %>
<% elsif signup_is_full %>
<%= t('seminar.sign_up_is_full') %>
<% else %>
<%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<% notice = flash["notice"] || params[:notice] %>
<% flash.each do |key, msg| %>
<% next if key.to_s == "notice" %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"], :style => "color: red; font-weight: bold;" %>
<% end %>
<% if notice.present? %>
<%= content_tag :p, params[:notice], :class => ["notice alert alert-error in fade"], :style => "color: red; font-weight: bold;" %>
<script type="text/javascript">
window.alert("<%=notice%>");
</script>
<% end %>
<style type="text/css">
.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {
position: relative;
margin: 0;
}
</style>
<%= form_for @seminar_signup, url: (@seminar_signup.new_record? ? seminars_path : update_signup_form_seminars_path), html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
<fieldset>
<!-- Title -->
<div class="form-group">
<label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
<div class="col-sm-10">
<h3><%= @seminar.title %></h3>
</div>
</div>
<% if !@seminar.signup_note.blank? %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar.note') %></label>
<div class="col-sm-10">
<%= @seminar.signup_note.html_safe %>
</div>
</div>
<% end %>
<div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
</div>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' && signup_field.field_name != 'password' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['address','note'].include? signup_field.field_name) %>
*
<% end %>
<%= signup_field['name'][I18n.locale] %>
</label>
<% if signup_field.field_name == 'status' %>
<% status_translations = ['G','C'].map{|c| [c, t("seminar.registration_status_#{c}")] }.to_h %>
<% status_translations = {'G'=>'No','C'=>'Yes'} if (signup_field.name.values.select{|v| v.include?('?') || v.include?('是否')}.count != 0 rescue false) %>
<div class="col-sm-10">
<% if @seminar.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= status_translations['G'] %>
</label>
<% end %>
<% if @seminar.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= status_translations['C'] %>
</label>
<% end %>
</div>
<% elsif signup_field.field_name == 'unit' %>
<div class="col-sm-10">
<%= f.text_field 'unit', :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
</div>
<% elsif signup_field.field_name == 'address' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
<div class="loader"></div>
</div>
<% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10">
<%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-medium form-control", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'tel' %>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: t("seminar.phone_hint") %>
<p>(<%= t("seminar.phone_hint") %>)</p>
</div>
<% else %>
<div class="col-sm-10">
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="form-group">
<label for="status" class="col-sm-2 control-label"><%= t('seminar.registration_status') %></label>
<div class="col-sm-10">
<% if @seminar.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
</label>
<% end %>
<% if @seminar.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= t('seminar.registration_status_C') %>
</label>
<% end %>
</div>
</div>
<!-- Name to Last Name -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('seminar_signup.name') %></label>
<div class="col-sm-10">
<%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('seminar_signup.name'), :required => true %>
</div>
</div>
<!-- Tel to First Name -->
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
</div>
</div>
<!-- Email -->
<div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
</div>
</div>
<div class="form-group <%= @seminar.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status">
<label for="password" class="col-sm-2 control-label">*<%= t('seminar_signup.password') %></label>
<div class="col-sm-10">
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.password') %>
<%= t('seminar_signup.password_message') %>
</div>
</div>
<% end %>
<%
group = 1
counter = 0
%>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 6) %>
<div id="optional">
<% end %>
<% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>">
<% else %>
<div id="group<%= group %>" style="display:none;">
<% end %>
<% end %>
<% counter += 1 %>
<div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div>
<% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 30) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %>
<% end %>
</div>
<div class="form-group" style="text-align:center;margin:10px 0;">
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
</div>
<!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 && @seminar_signup.new_record? %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
<div class="col-sm-10">
<%= gotcha_error %>
<%= gotcha %>
</div>
</div>
<% end %>
<% end %>
<!-- <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%#= t('nkuht_donate.recaptcha') %></label>
<div class="col-sm-10">
<%#= show_simple_captcha %>
</div>
</div> -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
<input id="agree" name="agree" value="1" type="checkbox" required="required" <% if !@seminar_signup.new_record? %>checked="checked"<%end%>>
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last rescue "/" %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<% if !@seminar_signup.new_record? %>
<input type="hidden" name="signup_id" value="<%= @seminar_signup.id %>">
<% end %>
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button "Delete", type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<script type="text/javascript">
(function(){
function check_repeat_value(event) {
var validated = true;
var all_values = $.map($('input[name^="seminar_signup_values"]:visible'), function(v) {
return [[v, $(v).val()]];
}).filter(function(v){
return v[1] != ''
});
var values = [];
for (var i=0;i< all_values.length;i++){
if (values.includes(all_values[i][1])){
all_values[i][0].setCustomValidity("<%= t('seminar.repeat_hint') %>");
all_values[i][0].focus();
$(all_values[i][0]).parents('form')[0].reportValidity();
validated = false;
$(all_values[i][0]).one('keyup change', function(){
this.setCustomValidity("");
});
break;
}
values.push(all_values[i][1]);
}
return validated;
}
function uploadSubmit(form){
$.ajax({
type: 'post',
method: 'post',
async: false,
contentType: false,
processData: false,
dataType: "script",
url: $(form).attr('action'),
data: new FormData(form)
});
}
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
var validated = false,
chks = false,
pwd = $('#seminar_signup_password')
$('input[type=submit]').on('click', function(){
var form = $(this).parents('form')[0];
if (form){
window.setTimeout(function(){
form.reportValidity();
}, 500);
}
});
$("form.content").submit(function(event) {
if (!check_repeat_value(event)){
return false;
}
if ($('*[name^="seminar_signup_values"]:visible')){
$('input[name^="seminar_signup_values"]:visible').map(function(k, v) {
return $(v).val();
});
}
if ($('#seminar_signup_status_c:checked').val() == 'C'){
if (pwd.val() == ''){
pwd.attr('required', true);
pwd.focus();
alert( '<%= t('seminar_signup.password') %>' + ' is required');
return false;
}
}
<%
@seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf|
if rf.markup == 'checkbox'
%>
var checkedCount = $("input[type=checkbox][id^=seminar_signup_values_<%= rf.id %>]:checked").length;
if (checkedCount == 0){
alert( '<%= rf.title %>' + ' is required');
return false;
}
<%
end
end
%>
var form = $(this),
isChecked = $('#agree:checked').val()?true:false;
if(!isChecked){
return false;
}
uploadSubmit(this);
return false;
});
$('input[type="email"]').blur(function(){
var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "email" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
loader.removeClass("error");
}else{
loader.addClass("error");
}
loader.text(data.result);
}
});
};
if( value ){
if (!this.checkValidity()){
loader.addClass("error");
loader.text("<%= t("seminar.email_hint") %>");
return;
}else{
loader.removeClass("error");
loader.text("");
}
if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability();
}
}
});
$(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename");
let filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
})
$("#optional label").each(function(){
if($(this).hasClass("control-label")){
$(this).text("*" + $(this).text());
}
})
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group, init){
$group.show();
$group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true);
if(init){
$group.find('input.tick').attr("checked", true);
}
}
function hideGroup($group){
$group.hide();
$group.find("input[type!=hidden], textarea").val("");
$.each($group.find("input[type=file]"), function(k, v) {
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
});
$group.find('input,textarea').attr("required", false);
}
if (currentGroup > 1){
$("#remove-member").show();
for (var i = 1; i <= currentGroup; i++){
showGroup($("#group" + i), true);
}
}
$("input.first-tick").attr("checked",true);
$("#add-member").on("click",function () {
if(currentGroup < 5){
$("#remove-member").show();
currentGroup++;
if(currentGroup == 5){
$(this).hide();
}
}
showGroup($("#group" + currentGroup));
return false;
})
$("#remove-member").on("click",function () {
$("#add-member").show();
if(currentGroup > 0){
hideGroup($("#group" + currentGroup));
currentGroup--;
if(currentGroup == 1){
$(this).hide();
}
}
return false;
})
})();
</script>
<% end %>

View File

@ -1,50 +0,0 @@
<% # encoding: utf-8 %>
<%
data = action_data("con_login")
@seminar = data["seminar"]
@time_now = data["time_now"]
%>
<style type="text/css">
.alert-error{
color: red;
}
</style>
<section id="main-wrap">
<div class="sign-in have-other-sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<div class="form">
<h2><%= @seminar.title %></h2>
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
<div>
<input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" />
</div>
<div class="form-block">
<div class="form-list clearfix">
<%= form_tag reset_password_proc_seminars_path, :class => 'content' do %>
<div class="control-group clear">
<label for="user_email">
<i class="icon-user"></i><%=t('seminar_signup.email_address')%>
</label>
<%= text_field_tag :user_name, params[:user_name], :placeholder => t('seminar_signup.email_address'), :id=>"user_email" %>
</div>
<br/>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
<% end %>
</div>
</div>
<br/>
</div>
</div>
</section>
<script type="text/javascript">
$(document).ready(function(){
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
$(".form .control-group label").width(max_width);
})
</script>

View File

@ -1,74 +0,0 @@
<% # encoding: utf-8 %>
<%
data = action_data
@seminar = data["seminar"]
%>
<style type="text/css">
.alert-error{
color: red;
}
</style>
<section id="main-wrap">
<% if data["status"] %>
<div class="sign-in have-other-sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<div class="form">
<h2><%= @seminar.title %></h2>
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
<div>
<input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" />
</div>
<div class="form-block">
<div class="form-list clearfix">
<%= form_tag reset_confirm_password_proc_seminars_path, :class => 'content', :id =>"change-password-form" do %>
<div class="control-group clear">
<label for="user_password">
<i class="icon-user"></i><%=t('seminar_signup.password')%>
</label>
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password", :required=> true, :pattern => data["pattern"], :title => t("seminar_signup.password_check") %>
</div>
<div class="control-group clear">
<label for="confirm_user_password">
<i class="icon-user"></i><%=t('seminar_signup.confirm_password')%>
</label>
<%= password_field_tag :confirm_password, nil, :placeholder => t(:dots), :id=>"confirm_user_password", :required=> true %>
</div>
<p class="alert-error" id="confirm-error"></p>
<br/>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="seminar_id" value="<%= @seminar.id %>">
<input type="hidden" name="cid" value="<%= params[:cid] %>">
<input type="hidden" name="reset_token" value="<%= data['token'] %>" />
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
<% end %>
</div>
</div>
<br/>
</div>
</div>
<% else %>
<p>Invalid URL</p>
<% end %>
</section>
<script type="text/javascript">
$(document).ready(function(){
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
$(".form .control-group label").width(max_width);
})
form = document.querySelector("#change-password-form");
form.onsubmit = function () {
var up = document.querySelector("#user_password").value,
cup = document.querySelector("#confirm_user_password").value
if(up != cup){
document.querySelector("#confirm-error").textContent = "<%= t("seminar_signup.password_mismatch") %>"
return false;
}else{
return true;
}
}
</script>

View File

@ -1,8 +1,8 @@
<%
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
@form_index = 0
if data["prefix_url"]
prefix_url = data["prefix_url"]
@ -14,11 +14,6 @@
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
signup_is_full = @seminar.signup_is_full?
%>
<style>
.error {
color: red;
}
</style>
<% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %>
@ -58,14 +53,14 @@
margin: 0;
}
</style>
<%= form_for @seminar_signup, url: (@seminar_signup.new_record? ? seminars_path : update_signup_form_seminars_path), html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
<%= form_for @seminar_signup, url: seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
<fieldset>
<!-- Title -->
<div class="form-group">
<label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
<label for="title" class="col-sm-2 control-label"><%= t('seminar.title') %></label>
<div class="col-sm-10">
<h3><%= @seminar.title %></h3>
<%= @seminar.title %>
</div>
</div>
<% if !@seminar.signup_note.blank? %>
@ -81,8 +76,8 @@
</div>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' && signup_field.field_name != 'password' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['address','note'].include? signup_field.field_name) %>
*
@ -129,12 +124,7 @@
</div>
<% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
<div class="loader"></div>
</div>
<% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10">
<%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
<%= 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=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10">
@ -155,19 +145,9 @@
</div>
</div>
</div>
<% elsif signup_field.field_name == 'tel' %>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: t("seminar.phone_hint") %>
<p>(<%= t("seminar.phone_hint") %>)</p>
</div>
<% elsif signup_field.field_name == 'name' %>
<div class="col-sm-10">
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
<div class="loader"></div>
</div>
<% else %>
<div class="col-sm-10">
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
</div>
<% end %>
</div>
@ -202,7 +182,7 @@
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true %>
</div>
</div>
@ -210,7 +190,7 @@
<div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
<%= 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=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
</div>
@ -223,46 +203,21 @@
</div>
<% end %>
<%
group = 1
counter = 0
%>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 6) %>
<div id="optional">
<% end %>
<% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>">
<% else %>
<div id="group<%= group %>" style="display:none;">
<% end %>
<% end %>
<% counter += 1 %>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf| %>
<div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div>
<% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 30) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %>
<% end %>
</div>
<div class="form-group" style="text-align:center;margin:10px 0;">
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
</div>
<!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 && @seminar_signup.new_record? %>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
@ -284,8 +239,8 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
<input id="agree" name="agree" value="1" type="checkbox" required="required" <% if !@seminar_signup.new_record? %>checked="checked"<%end%>>
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
<input id="agree" name="agree" value="1" type="checkbox" required="required">
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= t("seminar_signup.agree")%></a>
</label>
</div>
</div>
@ -294,9 +249,6 @@
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last rescue "/" %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<% if !@seminar_signup.new_record? %>
<input type="hidden" name="signup_id" value="<%= @seminar_signup.id %>">
<% end %>
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button "Delete", type: 'reset', class: 'btn' %>
</div>
@ -308,62 +260,12 @@
<script type="text/javascript">
(function(){
function check_repeat_value(event) {
var validated = true;
var all_values = $.map($('input[name^="seminar_signup_values"]:visible'), function(v) {
return [[v, $(v).val()]];
}).filter(function(v){
return v[1] != ''
});
var values = [];
for (var i=0;i< all_values.length;i++){
if (values.includes(all_values[i][1])){
all_values[i][0].setCustomValidity("<%= t('seminar.repeat_hint') %>");
all_values[i][0].focus();
$(all_values[i][0]).parents('form')[0].reportValidity();
validated = false;
$(all_values[i][0]).one('keyup change', function(){
this.setCustomValidity("");
});
break;
}
values.push(all_values[i][1]);
}
return validated;
}
function uploadSubmit(form){
$.ajax({
type: 'post',
method: 'post',
async: false,
contentType: false,
processData: false,
dataType: "script",
url: $(form).attr('action'),
data: new FormData(form)
});
}
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
var validated = false,
chks = false,
pwd = $('#seminar_signup_password')
$('input[type=submit]').on('click', function(){
var form = $(this).parents('form')[0];
if (form){
window.setTimeout(function(){
form.reportValidity();
}, 500);
}
});
$("form.content").submit(function(event) {
if (!check_repeat_value(event)){
return false;
}
if ($('*[name^="seminar_signup_values"]:visible')){
$('input[name^="seminar_signup_values"]:visible').map(function(k, v) {
return $(v).val();
});
}
if ($('#seminar_signup_status_c:checked').val() == 'C'){
@ -400,129 +302,41 @@
return false;
}
uploadSubmit(this);
return false;
});
$('#name').blur(function(){
var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val().trim() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "/xhr/seminars/check_name/#{@seminar.id}" %>",
data : {"type" : type, "name" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
loader.removeClass("error");
}else{
loader.addClass("error");
}
loader.text(data.result);
}
})
}
loader.text("Checking...")
checkAvailability();
});
$('input[type="email"]').blur(function(){
$(".availibility").blur(function(){
var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "email" : value},
url : "<%= "#{prefix_url}?method=check_availability&no=#{@seminar.id}" %>",
data : {"type" : type, "value" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
loader.removeClass("error");
alert("1tttt");
}else{
loader.addClass("error");
alert("1ssss2");
}
loader.text(data.result);
}
});
};
})
}
if( value ){
if (!this.checkValidity()){
loader.addClass("error");
loader.text("<%= t("seminar.email_hint") %>");
return;
}else{
loader.removeClass("error");
loader.text("");
}
if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability();
}
}
});
$(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename");
let filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
})
$("#optional label").each(function(){
if($(this).hasClass("control-label")){
$(this).text("*" + $(this).text());
}
})
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group){
$group.show();
$group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true);
}
function hideGroup($group){
$group.hide();
$group.find("input[type!=hidden], textarea").val("");
$.each($group.find("input[type=file]"), function(k, v) {
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
});
$group.find('input,textarea').attr("required", false);
}
if (currentGroup > 1){
$("#remove-member").show();
for (var i = 1; i < currentGroup; i++){
showGroup($("#group" + i));
}
}
$("#add-member").on("click",function () {
if(currentGroup < 5){
$("#remove-member").show();
currentGroup++;
if(currentGroup == 5){
$(this).hide();
}
}
showGroup($("#group" + currentGroup));
return false;
})
$("#remove-member").on("click",function () {
$("#add-member").show();
if(currentGroup > 0){
hideGroup($("#group" + currentGroup));
currentGroup--;
if(currentGroup == 1){
$(this).hide();
}
}
return false;
})
})();
</script>

View File

@ -9,7 +9,8 @@
@sign_up_time_range = data["sign_up_time_range"]
@seminar_time_range = data["seminar_time_range"]
@contribute_time_range = data["contribute_time_range"]
@contribute_action = data["contribute_action"]
@contribute_action = data["contribute_action"]
@sign_up_not_yet = data["sign_up_not_yet"]
%>
@ -19,7 +20,7 @@
<th class="seminarive-title-field"><%= t(:category) %></th>
<td class="seminarive-title-value"><%= @seminar.category.title %></td>
</tr>
<tr>
<tr <%= 'class="hidden"'.html_safe if @seminar_time_range.blank? %>>
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.event_during') %></th>
<td class="seminarive-title-value"><%= @seminar_time_range %></td>
</tr>
@ -39,7 +40,7 @@
<td class="seminarive-title-value"><%= nl2br(@seminar.content) %></td>
</tr>
<% end %>
<tr>
<tr <%= 'class="hidden"'.html_safe if @sign_up_time_range.blank? %>>
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.signup_during') %></th>
<td class="seminarive-title-value"><%= @sign_up_time_range %></td>
</tr>
@ -49,7 +50,7 @@
<td class="seminarive-title-value"><%= @contribute_time_range %></td>
</tr>
<% end %>
<tr>
<tr <%= 'class="hidden"'.html_safe if @sign_up_not_yet && @contribute_action.blank? %>>
<th class="seminarive-title-field"><%= t('seminar.signup') %></th>
<td class="seminarive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td>
</tr>

View File

@ -8,8 +8,7 @@
end
%>
<%#= t('seminar_signup.success_message') %>
<%= data["message"].html_safe %>
<%= t('seminar_signup.success_message') %>
<br>
<%=t('seminar_signup.serial_number') %>: <%=data["serial_number"] rescue ""%>
<% if !params['status'].nil? %>

View File

@ -45,11 +45,7 @@ markups:
ext_support: false
panel: typeF
display_only: seminar_submission_field
email:
panel: typeA
phone:
panel: typeA
instructions:
muti_lang_input_supprt: false
ext_support: false
panel: typeG
panel: typeG

View File

@ -6,8 +6,6 @@ en:
lists:
markups:
seminar_preferred_session: Preferred Session
email: Email
phone: Phone
instructions: Instructions
restful_actions:
@ -31,12 +29,6 @@ en:
abstract_number: Abstract number
presentation_type: Presentation
seminar:
repeat_hint: Input text must unique!
phone_hint: "Can only include number, +, -, and ()!(length: 10~13)"
email_hint: Email is not complete!
text_area_hint: Limit 300 characters
file_limit_hint: File Size cannot larger than 20MB!
file_format_hint: only support .pdf, .png, .jpg, .odf extensions!
signup_limit: Signup Limit
participant_list: Participant list
back: Back
@ -96,7 +88,7 @@ en:
dashboard: Dashboard
display_field: Display field
note: Note
email_email_or_name_existexist: "Email or name exist!"
email_exist: "Email exist!"
email_signup_success: Signup success
email_submission_success: Submission registration success
email_add_file_success: Add file success
@ -112,20 +104,6 @@ en:
email_edit_file: Edit file
email_add_file: Add file
auto_send_email_set: Auto send email setting
email_forgot_password: Forgot Password
email_special_reminder: Special Reminder
special_reminder: Special Reminder
email_reset_password_content: Forgot Password
email_reset_password_success: Forgot Password
email_special_reminder_content: Special Reminder
email_special_reminder_success: Special Reminder
is_confirmation: Confirmation Email
select_email_type: Select Email Type
send_email_button: Send email
click_here_to_confirm: Please click this link / 請點選此連結
confirm_ok: Email confirmed
confirm_not_ok: Email cannot be confirmed
validator: Validator
click_to_contribute: Click here to contribute
required: Required
already_used: Already Used
@ -143,6 +121,7 @@ en:
reviewer: Reviewer #審查委員
review_end_date: Review End Date #審查結束日期
review_start_date: Review Start Date #審查開始日期
review: Reveiw #審稿
blank_no_limit: Allow Blank Value #空白無限制
export_csv: Export CSV #匯出CSV
recaptcha: Recaptcha #驗證碼
@ -181,8 +160,6 @@ en:
sign_up_is_full: "Sign up is FULL!"
sign_up_failed: "Sign up failed!"
contribute_file_count: Count of Contribute Files #投稿檔案數
seminar_signup_success: Signup Success Message
reset_password: Reset Password
frontend:
seminar: Semianr #研討會前台
@ -215,12 +192,12 @@ en:
note: Note #註解
time: 'Start / End Time' #(開始/結束)時間
place: Place #地點
agree: "I agree with all terms"
agree: "Accept Privacy and Personal Information Protection Policy of the Site"
privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
recaptcha: Verification code
signup_field: Sign Up Field #圈選項目
uploads: Uploads #上傳檔案
con_login: Login #投稿者登入
con_login: Submission #投稿者登入
file_name: File Name #稿件名稱
file_note: Summary #摘要
files: Files #檔案
@ -237,32 +214,4 @@ en:
select: Select box
checkbox: Multiple choice
radio: Single choice
choices: Choices
forgot_password: Set Password
reset_email_sent: Reset Email Sent
login_failed: Login Failed
email_not_found: Email not found
reset: Reset
email_reset_password_success: Password reset
click_on_link: Please click on the link below to reset your password
confirm_password: Confirm Password
password_mismatch: Password mismatch
password_changed: Password changed successfully
password_changed_not_ok: There was an error changing password
password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters
email_check: Invalid email format
is_confirmed: Email Confirmed
signup_confirmed: Signup Confirmed
registration_complete: Registration Complete
email_confirmed: Email Confirmed
email_not_confirmed: Email not confirmed
signup_not_confirmed: Signup not confirmed
send_email: Send Email
edit_form: Edit Form
emails_already_sent: Emails Already Sent
is_confirmed_date: Email confirmed time
signup_confirmed_date: Signup confirmed time
add_member: Add Member
remove_member: Remove Member
send_email_text: Additional text to send
predefined_text: Predifined email text
choices: Choices

View File

@ -6,8 +6,6 @@ zh_tw:
lists:
markups:
seminar_preferred_session: Preferred Session
email: 電子信箱
phone: 電話
instructions: "說明文字 Instructions"
restful_actions:
@ -31,12 +29,6 @@ zh_tw:
abstract_number: 摘要編號
presentation_type: 發表方式
seminar:
repeat_hint: 輸入內容不能重複
phone_hint: "僅可輸入數字及+ - ()長度限制10~13"
email_hint: Email信箱不完整
text_area_hint: 字數最多只能300個字
file_limit_hint: 檔案不能超過20MB!
file_format_hint: 只能上傳.pdf, .png, .jpg, .odf格式
signup_limit: 報名限制人數
participant_list: 參加者名單
back: 回上一頁
@ -96,7 +88,7 @@ zh_tw:
dashboard: 儀錶板
display_field: 顯示的欄位
note: 附註
email_or_name_exist: 隊名或Email已存在
email_exist: "email已存在!"
email_signup_success: 報名成功
email_submission_success: 投稿註冊成功
email_add_file_success: 新增上傳成功
@ -112,20 +104,6 @@ zh_tw:
email_edit_file: 編輯上傳
email_add_file: 新增上傳
auto_send_email_set: 自動發信設定
email_forgot_password: 忘記密碼
email_special_reminder: 特殊通知
special_reminder: 特殊通知
email_reset_password_content: 忘記密碼
email_reset_password_success: 忘記密碼
email_special_reminder_content: 特殊通知
email_special_reminder_success: 特殊通知
is_confirmation: 認證Email
click_here_to_confirm: Please click this link / 請點選此連結
confirm_ok: 認證通過
confirm_not_ok: 連結已失效
select_email_type: 選擇Email種類
send_email_button: 寄送Email
validator: 驗證
click_to_contribute: 按此登入投稿
required: '必填, necessary'
already_used: 已存在
@ -143,6 +121,7 @@ zh_tw:
reviewer: 審查委員
review_end_date: 審查結束日期
review_start_date: 審查開始日期
review: 審稿
blank_no_limit: 空白無限制
export_csv: 匯出CSV
recaptcha: 驗證碼
@ -181,8 +160,6 @@ zh_tw:
sign_up_is_full: "報名已額滿!"
sign_up_failed: "報名失敗"
contribute_file_count: 投稿檔案數
seminar_signup_success: 送出註冊表單訊息頁
reset_password: 設定密碼
frontend:
seminar: 研討會前台
@ -215,53 +192,26 @@ zh_tw:
note: 註解
time: (開始/結束)時間
place: 地點
agree: 已確認閱讀相關條款
agree: 同意接受本站個資及隱私權保護宣告(Agree upon personal data protection declaration of this web)
privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼
signup_field: 圈選項目
uploads: 上傳檔案
con_login: 登入
con_login: Submission
file_name: 稿件名稱
file_note: 摘要
files: 檔案
logout: 登出
logout: Logout
logouting: 登出中
success_message: '您的報名已成功,感謝您的參與。'
email_address: Email位址
_password: 密碼
login: 登入
new_: '新增(upload abstract)'
load_file: 上傳檔案
email_address: Email address
_password: Password
login: Login
new_: '新增(load abstract)'
load_file: load file
enable_summary_choice: 開啟摘要選項
summary_choice_type: 摘要選項類型
select: 下拉選單
checkbox: 多選
radio: 單選
choices: 選項
forgot_password: 設定密碼
reset_email_sent: 重設密碼Email已送出
login_failed: 登入失敗
email_not_found: 找不到Email
reset: 重設
click_on_link: 請點選下方連結後重設密碼。
confirm_password: 確認密碼
password_mismatch: 密碼不正確
password_changed: 密碼更新成功
password_changed_not_ok: 更新密碼時發生錯誤
password_check: 至少須包含數字及大小寫英文字母共8碼
email_check: 不正確的Email格式
is_confirmed: Email已確認
signup_confirmed: 註冊已查核確認
registration_complete: 註冊程序完成
email_confirmed: Email已確認
email_not_confirmed: Email尚未確認
signup_not_confirmed: 註冊尚未查核確認
send_email: 寄送Email
edit_form: 編輯註冊表單
emails_already_sent: 已寄送Email
add_member: 增加組員
remove_member: 移除組員
is_confirmed_date: Email認證時間
signup_confirmed_date: 註冊查核確認時間
send_email_text: 附加額外文字內容
predefined_text: 預設郵件內容
choices: 選項

View File

@ -53,7 +53,7 @@ Rails.application.routes.draw do
SeminarSubmissionField.create_indexes
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
@ -64,8 +64,6 @@ Rails.application.routes.draw do
get 'seminar_signup'
get 'seminar_item_content'
get 'seminar_signup_field'
get 'seminar_signup_success'
patch 'seminar_signup_success_save'
get 'seminar_submission_field'
get 'seminar_signup_admin_setting'
post 'update_seminar_signup_admin_setting'
@ -83,10 +81,6 @@ Rails.application.routes.draw do
patch 'update_template_setting'
get 'sub_page_setting'
end
collection do
post "send_notifying_email"
get "get_predefined_text"
end
end
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
post 'seminar/update_seminar_review' => "seminars#update_seminar_review"
@ -107,16 +101,12 @@ Rails.application.routes.draw 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 'reset_password_proc', to: 'seminars#reset_password_proc'
post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_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'
patch 'update_signup_form', to: 'seminars#update_signup_form'
end
end
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
get "/xhr/seminars/check_name/:no" => "seminars#check_name"
end
end
end