forked from spen/seminar
fix error
This commit is contained in:
parent
6c3b5ca75f
commit
e6d4227b71
|
@ -60,16 +60,7 @@ class Admin::SeminarSignupsController < OrbitAdminController
|
||||||
|
|
||||||
@seminar_signup.destroy
|
@seminar_signup.destroy
|
||||||
|
|
||||||
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
|
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup?type=table"
|
||||||
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -699,6 +699,38 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
redirect_to admin_seminars_path
|
redirect_to admin_seminars_path
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def set_seminar
|
def set_seminar
|
||||||
|
|
|
@ -295,7 +295,7 @@ class SeminarsController < ApplicationController
|
||||||
if last_path.include?("?")
|
if last_path.include?("?")
|
||||||
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
|
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
|
||||||
uri_query = last_path.split("?")[1..-1].join('?')
|
uri_query = last_path.split("?")[1..-1].join('?')
|
||||||
uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'')
|
uri_query = uri_query.gsub(/notice=[^&]*/,'').gsub(/&+$/,'')
|
||||||
if uri_query.blank?
|
if uri_query.blank?
|
||||||
referer_url = referer_url + "?notice=#{notice_words}"
|
referer_url = referer_url + "?notice=#{notice_words}"
|
||||||
else
|
else
|
||||||
|
@ -379,7 +379,20 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
seminar_signup = SeminarSignup.new
|
seminar_signup = SeminarSignup.new
|
||||||
|
|
||||||
time_now = Time.now
|
time_now = Time.now
|
||||||
|
|
||||||
|
referer_url = OrbitHelper.request.referer
|
||||||
|
|
||||||
|
if (referer_url.nil? || referer_url.match(/(\?|&)method=show_privacy/).nil?) && !OrbitHelper.request.flash[: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
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"seminar" => seminar,
|
"seminar" => seminar,
|
||||||
"seminar_signup" => seminar_signup,
|
"seminar_signup" => seminar_signup,
|
||||||
|
@ -420,6 +433,11 @@ class SeminarsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
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_id = params[:seminar_signup][:seminar_main_id]
|
||||||
@seminar = SeminarMain.where(id: seminar_id).first
|
@seminar = SeminarMain.where(id: seminar_id).first
|
||||||
if @seminar.enable_recaptcha && (!gotcha_valid?)
|
if @seminar.enable_recaptcha && (!gotcha_valid?)
|
||||||
|
@ -522,9 +540,9 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
def update_signup_form
|
def update_signup_form
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
|
tmp_seminar_signup_params = seminar_signup_params
|
||||||
@seminar_signup = SeminarSignup.find(params[:signup_id])
|
@seminar_signup = SeminarSignup.find(params[:signup_id])
|
||||||
@seminar_signup.update_attributes(seminar_signup_params)
|
@seminar_signup.update_attributes(tmp_seminar_signup_params)
|
||||||
|
|
||||||
if !params[:seminar_signup_values].nil?
|
if !params[:seminar_signup_values].nil?
|
||||||
params[:seminar_signup_values].each_with_index do |r,i|
|
params[:seminar_signup_values].each_with_index do |r,i|
|
||||||
field_value = r.last[:id].present?
|
field_value = r.last[:id].present?
|
||||||
|
@ -540,6 +558,20 @@ class SeminarsController < ApplicationController
|
||||||
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
||||||
@seminar.save
|
@seminar.save
|
||||||
end
|
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_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=con_upload"
|
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=con_upload"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -755,7 +787,7 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit_login_seminar_signup
|
def edit_login_seminar_signup #copy from show
|
||||||
if !@@session[:seminar_main_id].blank?
|
if !@@session[:seminar_main_id].blank?
|
||||||
seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
|
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
|
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil
|
||||||
|
@ -818,7 +850,11 @@ class SeminarsController < ApplicationController
|
||||||
def confirm_email_page
|
def confirm_email_page
|
||||||
confirm = false
|
confirm = false
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
seminar = SeminarMain.where(:uid => params[:uid]).first
|
uid = params[:uid]
|
||||||
|
if uid.nil?
|
||||||
|
uid = params[:page].split('-').last
|
||||||
|
end
|
||||||
|
seminar = SeminarMain.where(:uid => uid).first
|
||||||
if(!seminar.nil?)
|
if(!seminar.nil?)
|
||||||
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first
|
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first
|
||||||
if(!signup.nil?)
|
if(!signup.nil?)
|
||||||
|
@ -890,44 +926,7 @@ class SeminarsController < ApplicationController
|
||||||
params.require(:seminar_signup_contribute).permit!
|
params.require(:seminar_signup_contribute).permit!
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notifying_email
|
|
||||||
@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> #{params[:text]} </p>"
|
|
||||||
if params[:type] == "reset_password"
|
|
||||||
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.save
|
|
||||||
end
|
|
||||||
render :json => {
|
|
||||||
"type" => t("seminar.#{params[:type]}"),
|
|
||||||
"success" => true
|
|
||||||
}.to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
def seminar_signup_values_params
|
def seminar_signup_values_params
|
||||||
params.require(:seminar_signup_values).permit!
|
params.require(:seminar_signup_values).permit!
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -7,6 +7,7 @@ module Admin::SeminarsFieldHelper
|
||||||
include ActionView::Helpers::RenderingHelper
|
include ActionView::Helpers::RenderingHelper
|
||||||
include ActionView::Context
|
include ActionView::Context
|
||||||
include OrbitBasis::RenderAnywhere
|
include OrbitBasis::RenderAnywhere
|
||||||
|
include ::MemberHelper
|
||||||
|
|
||||||
include OrbitFormHelper
|
include OrbitFormHelper
|
||||||
|
|
||||||
|
@ -168,7 +169,9 @@ module Admin::SeminarsFieldHelper
|
||||||
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
|
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
|
||||||
place_holder= typeD["placeholder"][key] rescue ''
|
place_holder= typeD["placeholder"][key] rescue ''
|
||||||
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
|
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=>'ckeditor input-medium form-control'))
|
text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', :maxlength=> 300)) + (content_tag :p do
|
||||||
|
"(#{I18n.t("seminar.text_area_hint")})"
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -187,14 +190,32 @@ module Admin::SeminarsFieldHelper
|
||||||
add_more_blank = can_add_more ? "[]" : ""
|
add_more_blank = can_add_more ? "[]" : ""
|
||||||
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
||||||
field_name = [get_field_name_base,add_more_blank,key_field].join
|
field_name = [get_field_name_base,add_more_blank,key_field].join
|
||||||
file_required =@require ? 'required="required"' : ''
|
file_required =@require && !value ? 'required="required"' : ''
|
||||||
"<div class=\"file-selector\"><label class=\"ui-button\">
|
"<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\" />
|
<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='';}}\" />
|
||||||
<i class=\"fa fa-file\"></i> #{I18n.t('file.upload')}
|
<i class=\"fa fa-file\"></i> #{I18n.t('file.upload')}
|
||||||
</label><div class=\"filename\"></div></div>#{value}".html_safe
|
</label><div class=\"filename\"></div></div>#{value}".html_safe
|
||||||
end
|
end
|
||||||
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\\+\\-\\(\\)]+", title: I18n.t("seminar.phone_hint"))) + (content_tag :p do
|
||||||
|
"(#{I18n.t("seminar.phone_hint")})"
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def date_is_range?
|
def date_is_range?
|
||||||
is_range = "false"
|
is_range = "false"
|
||||||
data = get_data
|
data = get_data
|
||||||
|
|
|
@ -50,6 +50,24 @@ module Admin::SeminarsHelper
|
||||||
end
|
end
|
||||||
# return "/#{I18n.locale}#{page.url}/#{seminar.to_param}"
|
# return "/#{I18n.locale}#{page.url}/#{seminar.to_param}"
|
||||||
end
|
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
|
module MultiLang
|
||||||
extend self
|
extend self
|
||||||
extend ActionView::Helpers::FormTagHelper
|
extend ActionView::Helpers::FormTagHelper
|
||||||
|
|
|
@ -14,6 +14,7 @@ class SeminarSignup
|
||||||
field :is_confirmed_date, type: DateTime
|
field :is_confirmed_date, type: DateTime
|
||||||
field :signup_confirmed_date, type: DateTime
|
field :signup_confirmed_date, type: DateTime
|
||||||
field :emails_sent, type: Array, default: []
|
field :emails_sent, type: Array, default: []
|
||||||
|
field :emails_sent_time, type: Array, default: []
|
||||||
field :name # become Last Name for TICC
|
field :name # become Last Name for TICC
|
||||||
field :tel, type: String # become First Name for TICC
|
field :tel, type: String # become First Name for TICC
|
||||||
field :unit, localize: true #Only localize for preserving old record
|
field :unit, localize: true #Only localize for preserving old record
|
||||||
|
@ -190,4 +191,8 @@ class SeminarSignup
|
||||||
return all_fields
|
return all_fields
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -14,7 +14,15 @@
|
||||||
<%= javascript_include_tag "lib/file-type" %>
|
<%= javascript_include_tag "lib/file-type" %>
|
||||||
<%= javascript_include_tag "lib/module-area" %>
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<style type="text/css">
|
||||||
|
.emails_sent_groups{
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.emails_sent_time{
|
||||||
|
min-height: 1em;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<!-- Input Area -->
|
<!-- Input Area -->
|
||||||
<div class="input-area">
|
<div class="input-area">
|
||||||
|
|
||||||
|
@ -127,8 +135,18 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label for="" class="control-label muted"><%= t("seminar_signup.emails_already_sent") %></label>
|
<label for="" class="control-label muted"><%= t("seminar_signup.emails_already_sent") %></label>
|
||||||
<div class="controls" id="emails_sent">
|
<div class="controls" id="emails_sent">
|
||||||
<% @seminar_signup.emails_sent.each do |em| %>
|
<% @seminar_signup.emails_sent_groups.each do |em, em_date| %>
|
||||||
<span class="label label-success"><%= t("seminar.#{em}") %></span>
|
<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 %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -246,11 +264,14 @@ $(document).ready(function(){
|
||||||
if($(this).val() != ""){
|
if($(this).val() != ""){
|
||||||
let type = $(this).val();
|
let type = $(this).val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/admin/seminar_signups/get_predefined_text",
|
url : "/admin/seminars/get_predefined_text",
|
||||||
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
|
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "get",
|
type : "get",
|
||||||
success : function(data){
|
success : function(data){
|
||||||
|
if (type === 'reset_password'){
|
||||||
|
$('#seminar_signup_status_c').click();
|
||||||
|
}
|
||||||
if( data.success == true ){
|
if( data.success == true ){
|
||||||
$("#predefined_text").html(data.html);
|
$("#predefined_text").html(data.html);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +286,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
if($("#send_email").val() != ""){
|
if($("#send_email").val() != ""){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/xhr/seminars/send_notifying_email",
|
url : "/admin/seminars/send_notifying_email",
|
||||||
data : {
|
data : {
|
||||||
"type" : $("#send_email").val(),
|
"type" : $("#send_email").val(),
|
||||||
"email" : $("#seminar_signup_email").val(),
|
"email" : $("#seminar_signup_email").val(),
|
||||||
|
@ -277,7 +298,7 @@ $(document).ready(function(){
|
||||||
success : function(data){
|
success : function(data){
|
||||||
if( data.success == true ){
|
if( data.success == true ){
|
||||||
alert("Email Sent");
|
alert("Email Sent");
|
||||||
$("#emails_sent").append('<span class="label label-success">'+ data.type +'</span>');
|
$("#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>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -52,8 +52,12 @@
|
||||||
val += "<div class=\"quick-edit\">
|
val += "<div class=\"quick-edit\">
|
||||||
<ul class=\"nav nav-pills\">"
|
<ul class=\"nav nav-pills\">"
|
||||||
if @can_edit
|
if @can_edit
|
||||||
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
|
val += content_tag :li do
|
||||||
<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>"
|
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
|
||||||
end
|
end
|
||||||
val += "</ul>
|
val += "</ul>
|
||||||
</div>"
|
</div>"
|
||||||
|
@ -83,8 +87,12 @@
|
||||||
val += "<div class=\"quick-edit\">
|
val += "<div class=\"quick-edit\">
|
||||||
<ul class=\"nav nav-pills\">"
|
<ul class=\"nav nav-pills\">"
|
||||||
if @can_edit
|
if @can_edit
|
||||||
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
|
val += content_tag :li do
|
||||||
<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>"
|
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
|
||||||
end
|
end
|
||||||
val += "</ul>
|
val += "</ul>
|
||||||
</div>"
|
</div>"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<%
|
<%
|
||||||
data = action_data
|
data = action_data
|
||||||
@seminar = data["seminar"]
|
@seminar = data["seminar"]
|
||||||
@seminar_signup = data["seminar_signup"]
|
@seminar_signup = data["seminar_signup"]
|
||||||
@time_now = data["time_now"]
|
@time_now = data["time_now"]
|
||||||
@form_index = 0
|
@form_index = 0
|
||||||
if data["prefix_url"]
|
if data["prefix_url"]
|
||||||
prefix_url = data["prefix_url"]
|
prefix_url = data["prefix_url"]
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<%= form_for @seminar_signup, url: update_signup_form_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
|
<%= 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>
|
<fieldset>
|
||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
||||||
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
||||||
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
|
<% 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' : '' %>">
|
<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">
|
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||||
|
@ -155,6 +155,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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\\+\\-\\(\\)]+", title: t("seminar.phone_hint") %>
|
||||||
|
<p>(<%= t("seminar.phone_hint") %>)</p>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-sm-10">
|
<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 => true %>
|
||||||
|
@ -192,7 +197,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
|
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true %>
|
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
|
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -224,7 +229,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if(idx % 5 == 0) && idx != 0 %>
|
<% if(idx % 5 == 0) && idx != 0 %>
|
||||||
<% group += 1 %>
|
<% 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;">
|
<div id="group<%= group %>" style="display:none;">
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% counter += 1 %>
|
<% counter += 1 %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -249,7 +258,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 驗證碼 -->
|
<!-- 驗證碼 -->
|
||||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
<% 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) %>
|
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
|
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
|
||||||
|
@ -271,8 +280,8 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
<label>
|
<label>
|
||||||
<input id="agree" name="agree" value="1" type="checkbox" required="required" checked="checked">
|
<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>
|
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -281,7 +290,9 @@
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<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="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 %>">
|
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||||
<input type="hidden" name="signup_id" value="<%= @seminar_signup.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.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
|
||||||
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -293,12 +304,42 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function(){
|
(function(){
|
||||||
|
function check_repeat_value() {
|
||||||
|
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].reportValidity();
|
||||||
|
validated = false;
|
||||||
|
window.setTimeout(function(){
|
||||||
|
all_values[i][0].setCustomValidity("");
|
||||||
|
}, 500);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
values.push(all_values[i][1]);
|
||||||
|
}
|
||||||
|
return validated;
|
||||||
|
}
|
||||||
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
||||||
var validated = false,
|
var validated = false,
|
||||||
chks = false,
|
chks = false,
|
||||||
pwd = $('#seminar_signup_password')
|
pwd = $('#seminar_signup_password')
|
||||||
|
|
||||||
$("form.content").submit(function(event) {
|
$("form.content").submit(function(event) {
|
||||||
|
if (!check_repeat_value()){
|
||||||
|
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 ($('#seminar_signup_status_c:checked').val() == 'C'){
|
||||||
|
@ -337,35 +378,42 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('input[type="email"]').blur(function(){
|
||||||
$(".availibility").blur(function(){
|
|
||||||
var type = $(this).attr("id"),
|
var type = $(this).attr("id"),
|
||||||
loader = $(this).parent().find('.loader'),
|
loader = $(this).parent().find('.loader'),
|
||||||
elem = $(this),
|
elem = $(this),
|
||||||
value = $(this).val() || null;
|
value = $(this).val() || null;
|
||||||
var checkAvailability = function(){
|
var checkAvailability = function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
||||||
data : {"type" : type, "email" : value},
|
data : {"type" : type, "email" : value},
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "get",
|
type : "get",
|
||||||
success : function(data){
|
success : function(data){
|
||||||
if( data.success == true ){
|
if( data.success == true ){
|
||||||
loader.removeClass("error");
|
loader.removeClass("error");
|
||||||
}else{
|
}else{
|
||||||
loader.addClass("error");
|
loader.addClass("error");
|
||||||
}
|
|
||||||
loader.text(data.result);
|
|
||||||
}
|
}
|
||||||
})
|
loader.text(data.result);
|
||||||
}
|
|
||||||
if( value ){
|
|
||||||
if(type == "seminar_signup_email"){
|
|
||||||
loader.text("Checking...")
|
|
||||||
checkAvailability();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
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(){
|
$(".upload").on("change",function(){
|
||||||
let filenamedom = $(this).parent().parent().find(".filename");
|
let filenamedom = $(this).parent().parent().find(".filename");
|
||||||
let filenameA = $(this).val().split('\\');
|
let filenameA = $(this).val().split('\\');
|
||||||
|
@ -380,14 +428,18 @@ $(".availibility").blur(function(){
|
||||||
|
|
||||||
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
||||||
|
|
||||||
let currentGroup = 1;
|
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
|
||||||
|
if (currentGroup > 1){
|
||||||
|
$("#remove-member").show();
|
||||||
|
}
|
||||||
$("#add-member").on("click",function () {
|
$("#add-member").on("click",function () {
|
||||||
if(currentGroup < 5){
|
if(currentGroup < 5){
|
||||||
$("#remove-member").show();
|
$("#remove-member").show();
|
||||||
currentGroup++;
|
currentGroup++;
|
||||||
$("#group" + currentGroup).show();
|
$("#group" + currentGroup).show();
|
||||||
|
$("#group" + currentGroup + " .fake-clean-file").remove();
|
||||||
if(currentGroup == 5){
|
if(currentGroup == 5){
|
||||||
$(this).attr("disabled","disabled").hide();
|
$(this).hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#group" + currentGroup + " input").attr("required", true);
|
$("#group" + currentGroup + " input").attr("required", true);
|
||||||
|
@ -395,10 +447,14 @@ $(".availibility").blur(function(){
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
$("#remove-member").on("click",function () {
|
$("#remove-member").on("click",function () {
|
||||||
|
$("#add-member").show();
|
||||||
if(currentGroup > 0){
|
if(currentGroup > 0){
|
||||||
$("#group" + currentGroup).hide();
|
$("#group" + currentGroup).hide();
|
||||||
$("#group" + currentGroup + " input").attr("required", false);
|
$("#group" + currentGroup + " input").attr("required", false);
|
||||||
$("#group" + currentGroup + " input").val("");
|
$("#group" + currentGroup + " input[type!=hidden]").val("");
|
||||||
|
$.each($("#group" + currentGroup + " input[type=file]"), function(k, v) {
|
||||||
|
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
|
||||||
|
});
|
||||||
$("#group" + currentGroup + " textarea").attr("required", false);
|
$("#group" + currentGroup + " textarea").attr("required", false);
|
||||||
$("#group" + currentGroup + " textarea").val("");
|
$("#group" + currentGroup + " textarea").val("");
|
||||||
currentGroup--;
|
currentGroup--;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<%
|
<%
|
||||||
data = action_data
|
data = action_data
|
||||||
@seminar = data["seminar"]
|
@seminar = data["seminar"]
|
||||||
@seminar_signup = data["seminar_signup"]
|
@seminar_signup = data["seminar_signup"]
|
||||||
@time_now = data["time_now"]
|
@time_now = data["time_now"]
|
||||||
@form_index = 0
|
@form_index = 0
|
||||||
if data["prefix_url"]
|
if data["prefix_url"]
|
||||||
prefix_url = data["prefix_url"]
|
prefix_url = data["prefix_url"]
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<%= form_for @seminar_signup, url: seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
|
<%= 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>
|
<fieldset>
|
||||||
|
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
||||||
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
|
||||||
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
|
<% 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' : '' %>">
|
<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">
|
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||||
|
@ -155,6 +155,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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\\+\\-\\(\\)]+", title: t("seminar.phone_hint") %>
|
||||||
|
<p>(<%= t("seminar.phone_hint") %>)</p>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-sm-10">
|
<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 => true %>
|
||||||
|
@ -192,7 +197,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
|
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true %>
|
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
|
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -224,7 +229,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if(idx % 5 == 0) && idx != 0 %>
|
<% if(idx % 5 == 0) && idx != 0 %>
|
||||||
<% group += 1 %>
|
<% 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;">
|
<div id="group<%= group %>" style="display:none;">
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% counter += 1 %>
|
<% counter += 1 %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -249,7 +258,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 驗證碼 -->
|
<!-- 驗證碼 -->
|
||||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
<% 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) %>
|
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
|
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
|
||||||
|
@ -271,8 +280,8 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
<label>
|
<label>
|
||||||
<input id="agree" name="agree" value="1" type="checkbox" required="required">
|
<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>
|
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -281,6 +290,9 @@
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<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="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 %>">
|
<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.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
|
||||||
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
<%= f.button "Delete", type: 'reset', class: 'btn' %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -292,12 +304,42 @@
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function(){
|
(function(){
|
||||||
|
function check_repeat_value() {
|
||||||
|
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].reportValidity();
|
||||||
|
validated = false;
|
||||||
|
window.setTimeout(function(){
|
||||||
|
all_values[i][0].setCustomValidity("");
|
||||||
|
}, 500);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
values.push(all_values[i][1]);
|
||||||
|
}
|
||||||
|
return validated;
|
||||||
|
}
|
||||||
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
||||||
var validated = false,
|
var validated = false,
|
||||||
chks = false,
|
chks = false,
|
||||||
pwd = $('#seminar_signup_password')
|
pwd = $('#seminar_signup_password')
|
||||||
|
|
||||||
$("form.content").submit(function(event) {
|
$("form.content").submit(function(event) {
|
||||||
|
if (!check_repeat_value()){
|
||||||
|
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 ($('#seminar_signup_status_c:checked').val() == 'C'){
|
||||||
|
@ -336,35 +378,42 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('input[type="email"]').blur(function(){
|
||||||
$(".availibility").blur(function(){
|
|
||||||
var type = $(this).attr("id"),
|
var type = $(this).attr("id"),
|
||||||
loader = $(this).parent().find('.loader'),
|
loader = $(this).parent().find('.loader'),
|
||||||
elem = $(this),
|
elem = $(this),
|
||||||
value = $(this).val() || null;
|
value = $(this).val() || null;
|
||||||
var checkAvailability = function(){
|
var checkAvailability = function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
||||||
data : {"type" : type, "email" : value},
|
data : {"type" : type, "email" : value},
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "get",
|
type : "get",
|
||||||
success : function(data){
|
success : function(data){
|
||||||
if( data.success == true ){
|
if( data.success == true ){
|
||||||
loader.removeClass("error");
|
loader.removeClass("error");
|
||||||
}else{
|
}else{
|
||||||
loader.addClass("error");
|
loader.addClass("error");
|
||||||
}
|
|
||||||
loader.text(data.result);
|
|
||||||
}
|
}
|
||||||
})
|
loader.text(data.result);
|
||||||
}
|
|
||||||
if( value ){
|
|
||||||
if(type == "seminar_signup_email"){
|
|
||||||
loader.text("Checking...")
|
|
||||||
checkAvailability();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
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(){
|
$(".upload").on("change",function(){
|
||||||
let filenamedom = $(this).parent().parent().find(".filename");
|
let filenamedom = $(this).parent().parent().find(".filename");
|
||||||
let filenameA = $(this).val().split('\\');
|
let filenameA = $(this).val().split('\\');
|
||||||
|
@ -379,14 +428,18 @@ $(".availibility").blur(function(){
|
||||||
|
|
||||||
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
||||||
|
|
||||||
let currentGroup = 1;
|
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
|
||||||
|
if (currentGroup > 1){
|
||||||
|
$("#remove-member").show();
|
||||||
|
}
|
||||||
$("#add-member").on("click",function () {
|
$("#add-member").on("click",function () {
|
||||||
if(currentGroup < 5){
|
if(currentGroup < 5){
|
||||||
$("#remove-member").show();
|
$("#remove-member").show();
|
||||||
currentGroup++;
|
currentGroup++;
|
||||||
$("#group" + currentGroup).show();
|
$("#group" + currentGroup).show();
|
||||||
|
$("#group" + currentGroup + " .fake-clean-file").remove();
|
||||||
if(currentGroup == 5){
|
if(currentGroup == 5){
|
||||||
$(this).attr("disabled","disabled").hide();
|
$(this).hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#group" + currentGroup + " input").attr("required", true);
|
$("#group" + currentGroup + " input").attr("required", true);
|
||||||
|
@ -394,11 +447,14 @@ $(".availibility").blur(function(){
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
$("#remove-member").on("click",function () {
|
$("#remove-member").on("click",function () {
|
||||||
|
$("#add-member").show();
|
||||||
if(currentGroup > 0){
|
if(currentGroup > 0){
|
||||||
$("#group" + currentGroup).hide();
|
$("#group" + currentGroup).hide();
|
||||||
$("#group" + currentGroup + " input").attr("required", false);
|
$("#group" + currentGroup + " input").attr("required", false);
|
||||||
$("#group" + currentGroup + " input[type='text']").val("");
|
$("#group" + currentGroup + " input[type!=hidden]").val("");
|
||||||
$("#group" + currentGroup + " input[type='file']").val("");
|
$.each($("#group" + currentGroup + " input[type=file]"), function(k, v) {
|
||||||
|
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
|
||||||
|
});
|
||||||
$("#group" + currentGroup + " textarea").attr("required", false);
|
$("#group" + currentGroup + " textarea").attr("required", false);
|
||||||
$("#group" + currentGroup + " textarea").val("");
|
$("#group" + currentGroup + " textarea").val("");
|
||||||
currentGroup--;
|
currentGroup--;
|
||||||
|
|
|
@ -45,3 +45,7 @@ markups:
|
||||||
ext_support: false
|
ext_support: false
|
||||||
panel: typeF
|
panel: typeF
|
||||||
display_only: seminar_submission_field
|
display_only: seminar_submission_field
|
||||||
|
email:
|
||||||
|
panel: typeA
|
||||||
|
phone:
|
||||||
|
panel: typeA
|
|
@ -6,6 +6,8 @@ en:
|
||||||
lists:
|
lists:
|
||||||
markups:
|
markups:
|
||||||
seminar_preferred_session: Preferred Session
|
seminar_preferred_session: Preferred Session
|
||||||
|
email: Email
|
||||||
|
phone: Phone
|
||||||
restful_actions:
|
restful_actions:
|
||||||
edit_seminar_review: Review
|
edit_seminar_review: Review
|
||||||
copy: Copy
|
copy: Copy
|
||||||
|
@ -27,6 +29,12 @@ en:
|
||||||
abstract_number: Abstract number
|
abstract_number: Abstract number
|
||||||
presentation_type: Presentation
|
presentation_type: Presentation
|
||||||
seminar:
|
seminar:
|
||||||
|
repeat_hint: Input text must unique!
|
||||||
|
phone_hint: Can only include number, +, -, and ()!
|
||||||
|
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
|
signup_limit: Signup Limit
|
||||||
participant_list: Participant list
|
participant_list: Participant list
|
||||||
back: Back
|
back: Back
|
||||||
|
@ -111,9 +119,7 @@ en:
|
||||||
email_special_reminder_success: Special Reminder
|
email_special_reminder_success: Special Reminder
|
||||||
is_confirmation: Confirmation Email
|
is_confirmation: Confirmation Email
|
||||||
select_email_type: Select Email Type
|
select_email_type: Select Email Type
|
||||||
send_email_text: Additional text to send
|
|
||||||
send_email_button: Send email
|
send_email_button: Send email
|
||||||
predefined_text: Predifined email text
|
|
||||||
click_here_to_confirm: Please click this link / 請點選此連結
|
click_here_to_confirm: Please click this link / 請點選此連結
|
||||||
confirm_ok: Email confirmed
|
confirm_ok: Email confirmed
|
||||||
confirm_not_ok: Email cannot be confirmed
|
confirm_not_ok: Email cannot be confirmed
|
||||||
|
@ -256,3 +262,5 @@ en:
|
||||||
signup_confirmed_date: Signup confirmed time
|
signup_confirmed_date: Signup confirmed time
|
||||||
add_member: Add Member
|
add_member: Add Member
|
||||||
remove_member: Remove Member
|
remove_member: Remove Member
|
||||||
|
send_email_text: Additional text to send
|
||||||
|
predefined_text: Predifined email text
|
||||||
|
|
|
@ -6,7 +6,8 @@ zh_tw:
|
||||||
lists:
|
lists:
|
||||||
markups:
|
markups:
|
||||||
seminar_preferred_session: Preferred Session
|
seminar_preferred_session: Preferred Session
|
||||||
|
email: 電子信箱
|
||||||
|
phone: 電話
|
||||||
restful_actions:
|
restful_actions:
|
||||||
edit_seminar_review: 審查
|
edit_seminar_review: 審查
|
||||||
copy: 複製
|
copy: 複製
|
||||||
|
@ -28,6 +29,12 @@ zh_tw:
|
||||||
abstract_number: 摘要編號
|
abstract_number: 摘要編號
|
||||||
presentation_type: 發表方式
|
presentation_type: 發表方式
|
||||||
seminar:
|
seminar:
|
||||||
|
repeat_hint: 輸入內容不能重複
|
||||||
|
phone_hint: 僅可輸入數字及+ - ()
|
||||||
|
email_hint: Email信箱不完整
|
||||||
|
text_area_hint: 字數最多只能300個字
|
||||||
|
file_limit_hint: 檔案不能超過20MB!
|
||||||
|
file_format_hint: 只能上傳.pdf, .png, .jpg, .odf格式
|
||||||
signup_limit: 報名限制人數
|
signup_limit: 報名限制人數
|
||||||
participant_list: 參加者名單
|
participant_list: 參加者名單
|
||||||
back: 回上一頁
|
back: 回上一頁
|
||||||
|
@ -115,8 +122,6 @@ zh_tw:
|
||||||
confirm_ok: 認證通過
|
confirm_ok: 認證通過
|
||||||
confirm_not_ok: 連結已失效
|
confirm_not_ok: 連結已失效
|
||||||
select_email_type: 選擇Email種類
|
select_email_type: 選擇Email種類
|
||||||
send_email_text: 附加額外文字內容
|
|
||||||
predefined_text: 預設郵件內容
|
|
||||||
send_email_button: 寄送Email
|
send_email_button: 寄送Email
|
||||||
validator: 驗證
|
validator: 驗證
|
||||||
click_to_contribute: 按此登入投稿
|
click_to_contribute: 按此登入投稿
|
||||||
|
@ -256,3 +261,5 @@ zh_tw:
|
||||||
remove_member: 移除加組員
|
remove_member: 移除加組員
|
||||||
is_confirmed_date: Email認證時間
|
is_confirmed_date: Email認證時間
|
||||||
signup_confirmed_date: 註冊查核確認時間
|
signup_confirmed_date: 註冊查核確認時間
|
||||||
|
send_email_text: 附加額外文字內容
|
||||||
|
predefined_text: 預設郵件內容
|
||||||
|
|
|
@ -83,6 +83,10 @@ Rails.application.routes.draw do
|
||||||
patch 'update_template_setting'
|
patch 'update_template_setting'
|
||||||
get 'sub_page_setting'
|
get 'sub_page_setting'
|
||||||
end
|
end
|
||||||
|
collection do
|
||||||
|
post "send_notifying_email"
|
||||||
|
get "get_predefined_text"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
|
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
|
||||||
post 'seminar/update_seminar_review' => "seminars#update_seminar_review"
|
post 'seminar/update_seminar_review' => "seminars#update_seminar_review"
|
||||||
|
@ -91,7 +95,6 @@ Rails.application.routes.draw do
|
||||||
post 'delete_items'
|
post 'delete_items'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
get "seminar_signups/get_predefined_text" => "seminar_signups#get_predefined_text"
|
|
||||||
resources :seminar_agreements
|
resources :seminar_agreements
|
||||||
resources :seminar_signups
|
resources :seminar_signups
|
||||||
resources :seminar_submission_values
|
resources :seminar_submission_values
|
||||||
|
@ -112,7 +115,6 @@ Rails.application.routes.draw do
|
||||||
patch 'update_signup_form', to: 'seminars#update_signup_form'
|
patch 'update_signup_form', to: 'seminars#update_signup_form'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
|
||||||
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
|
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue