forked from spen/seminar
i1. Signup form: remove member button(hide added fields and content), all fields become required after add member, hide page title
2. Login refill form interface 3. Back office file upload field problem, files will disappear after edit and submit 4. Signup number change to day and time or any other form that user cannot recognize order 5. Add 1 more field: “ Sent Email 寄送郵件“, show sent Email type and time 6. Show time log in the back office signee list page for: form submission, Email Confirmed, Signup Confirmed, Sent Email 7. Wordings: Forgot password link to reset page: “重設密碼” change to 設定密碼 Set Password Confirmation Email link to the page: “Confirm OK” —> ” 認證通過 “ ; “Confirm Not OK” —> “連結已失效”
This commit is contained in:
parent
64a8077e5b
commit
dbff09dbc0
|
@ -3,7 +3,7 @@ class SeminarsController < ApplicationController
|
||||||
include MemberHelper
|
include MemberHelper
|
||||||
include ActionView::Context #vary important (only add this can access @@session from view)
|
include ActionView::Context #vary important (only add this can access @@session from view)
|
||||||
include Admin::SeminarsHelper
|
include Admin::SeminarsHelper
|
||||||
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page"]
|
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page","edit_login_seminar_signup"]
|
||||||
# include SimpleCaptcha::ControllerHelpers
|
# include SimpleCaptcha::ControllerHelpers
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@ -520,6 +520,29 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_signup_form
|
||||||
|
params = OrbitHelper.params
|
||||||
|
@seminar_signup = SeminarSignup.find(params[:signup_id])
|
||||||
|
@seminar_signup.update_attributes(seminar_signup_params)
|
||||||
|
|
||||||
|
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
|
||||||
|
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=con_upload"
|
||||||
|
end
|
||||||
|
|
||||||
def signup_ok
|
def signup_ok
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
msg = SeminarMain.where(:uid => params[:seminar]).first.signup_success
|
msg = SeminarMain.where(:uid => params[:seminar]).first.signup_success
|
||||||
|
@ -706,6 +729,16 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
show = true
|
||||||
|
seminar.seminar_submission_field_sets.each do |ssf|
|
||||||
|
if ssf.disabled && ssf.hidden
|
||||||
|
show = false
|
||||||
|
else
|
||||||
|
show = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
seminar = {}
|
seminar = {}
|
||||||
|
@ -716,11 +749,32 @@ class SeminarsController < ApplicationController
|
||||||
{
|
{
|
||||||
'time_now' => time_now,
|
'time_now' => time_now,
|
||||||
'seminar' => seminar,
|
'seminar' => seminar,
|
||||||
'seminar_signup' => seminar_signup
|
'seminar_signup' => seminar_signup,
|
||||||
|
"show" => show
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit_login_seminar_signup
|
||||||
|
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
|
def con_logout
|
||||||
|
|
||||||
# redirect_to page_for_seminar_url
|
# redirect_to page_for_seminar_url
|
||||||
|
@ -770,6 +824,7 @@ class SeminarsController < ApplicationController
|
||||||
if(!signup.nil?)
|
if(!signup.nil?)
|
||||||
signup.token = nil
|
signup.token = nil
|
||||||
signup.is_confirmed = true
|
signup.is_confirmed = true
|
||||||
|
signup.is_confirmed_date = DateTime.now
|
||||||
signup.save
|
signup.save
|
||||||
confirm = true
|
confirm = true
|
||||||
end
|
end
|
||||||
|
@ -845,8 +900,11 @@ class SeminarsController < ApplicationController
|
||||||
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>"
|
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
|
end
|
||||||
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
|
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
|
||||||
|
seminar_signup.emails_sent << params[:type]
|
||||||
|
seminar_signup.save
|
||||||
end
|
end
|
||||||
render :json => {
|
render :json => {
|
||||||
|
"type" => t("seminar.#{params[:type]}"),
|
||||||
"success" => true
|
"success" => true
|
||||||
}.to_json
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
|
@ -454,7 +454,8 @@ protected
|
||||||
|
|
||||||
def form_label
|
def form_label
|
||||||
if self.markup == "text_area"
|
if self.markup == "text_area"
|
||||||
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
|
# plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
|
||||||
|
plc = nil
|
||||||
label_tag(key, '' , :class=>"col-sm-2 control-label muted") do
|
label_tag(key, '' , :class=>"col-sm-2 control-label muted") do
|
||||||
concat (!@require.blank? ? '*'+title : title)
|
concat (!@require.blank? ? '*'+title : title)
|
||||||
if plc
|
if plc
|
||||||
|
|
|
@ -11,6 +11,9 @@ class SeminarSignup
|
||||||
field :token
|
field :token
|
||||||
field :is_confirmed, type: Boolean, default: false # for email confirmation
|
field :is_confirmed, type: Boolean, default: false # for email confirmation
|
||||||
field :signup_confirmed, type: Boolean, default: false
|
field :signup_confirmed, type: Boolean, default: false
|
||||||
|
field :is_confirmed_date, type: DateTime
|
||||||
|
field :signup_confirmed_date, type: DateTime
|
||||||
|
field :emails_sent, 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
|
||||||
|
@ -54,9 +57,10 @@ class SeminarSignup
|
||||||
[l, (tmp ? tmp : unit)]
|
[l, (tmp ? tmp : unit)]
|
||||||
end.to_h
|
end.to_h
|
||||||
if self.serial_number.nil?
|
if self.serial_number.nil?
|
||||||
last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).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
|
# self.serial_number = last_serial_number + 1
|
||||||
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"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
|
||||||
end
|
end
|
||||||
self.token = SecureRandom.hex(5)
|
self.token = SecureRandom.hex(5)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms"} do |f| %>
|
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms", multipart: true} do |f| %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|
||||||
<% content_for :page_specific_css do %>
|
<% content_for :page_specific_css do %>
|
||||||
|
@ -123,6 +123,15 @@
|
||||||
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
|
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
|
||||||
</div>
|
</div>
|
||||||
</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.each do |em| %>
|
||||||
|
<span class="label label-success"><%= t("seminar.#{em}") %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% elsif signup_field.field_name == 'note' %>
|
<% elsif signup_field.field_name == 'note' %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
|
@ -212,6 +221,7 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
|
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
|
||||||
|
<%= f.hidden_field :signup_confirmed_date %>
|
||||||
<%= t('seminar_signup.registration_complete') %>
|
<%= t('seminar_signup.registration_complete') %>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -267,6 +277,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>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -274,4 +285,19 @@ $(document).ready(function(){
|
||||||
return false;
|
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() + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
|
||||||
|
$("#seminar_signup_signup_confirmed_date").val(format);
|
||||||
|
}else{
|
||||||
|
$("#seminar_signup_signup_confirmed_date").val("");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
|
@ -21,17 +21,17 @@
|
||||||
else
|
else
|
||||||
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
|
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
|
||||||
end
|
end
|
||||||
|
|
||||||
%>
|
%>
|
||||||
|
<h3 style="display:block;"><%= @seminar.title %></h3>
|
||||||
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
|
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
|
||||||
<% begin %>
|
<% begin %>
|
||||||
<% if !session[:seminar_signup_id].blank? %>
|
<% if !session[:seminar_signup_id].blank? %>
|
||||||
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
|
<%= 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>
|
<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"] %>
|
||||||
<table class="table table-hover table-striped seminar-index">
|
<table class="table table-hover table-striped seminar-index">
|
||||||
<caption>
|
|
||||||
<h3><%= @seminar.title %></h3>
|
|
||||||
</caption>
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<% if show1 %>
|
<% if show1 %>
|
||||||
|
@ -91,6 +91,7 @@
|
||||||
|
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -0,0 +1,353 @@
|
||||||
|
<%
|
||||||
|
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?
|
||||||
|
%>
|
||||||
|
<% 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: 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">
|
||||||
|
<%= @seminar.title %>
|
||||||
|
</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' %>
|
||||||
|
<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) %>
|
||||||
|
*
|
||||||
|
<% 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") %> <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 == '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>
|
||||||
|
<% 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 %>
|
||||||
|
</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 %> <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>
|
||||||
|
|
||||||
|
<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 %>
|
||||||
|
<% @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>
|
||||||
|
|
||||||
|
<% @form_index = @form_index +1 %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 驗證碼 -->
|
||||||
|
<% 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>
|
||||||
|
<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">
|
||||||
|
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= 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 %>">
|
||||||
|
<input type="hidden" name="signup_id" value="<%= @seminar_signup.id %>">
|
||||||
|
<%= 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(){
|
||||||
|
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
|
||||||
|
var validated = false,
|
||||||
|
chks = false,
|
||||||
|
pwd = $('#seminar_signup_password')
|
||||||
|
|
||||||
|
$("form.content").submit(function(event) {
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".availibility").blur(function(){
|
||||||
|
var type = $(this).attr("id"),
|
||||||
|
loader = $(this).parent().find('.loader'),
|
||||||
|
elem = $(this),
|
||||||
|
value = $(this).val() || null;
|
||||||
|
var checkAvailability = function(){
|
||||||
|
$.ajax({
|
||||||
|
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 ){
|
||||||
|
|
||||||
|
alert("1tttt");
|
||||||
|
}else{
|
||||||
|
|
||||||
|
alert("1ssss2");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if( value ){
|
||||||
|
if(type == "seminar_signup_email"){
|
||||||
|
checkAvailability();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
$(".upload").on("change",function(){
|
||||||
|
let filenamedom = $(this).parent().parent().find(".filename");
|
||||||
|
let filenameA = $(this).val().split('\\');
|
||||||
|
filenamedom.text(filenameA[filenameA.length - 1]);
|
||||||
|
})
|
||||||
|
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% end %>
|
|
@ -104,6 +104,7 @@ en:
|
||||||
auto_send_email_set: Auto send email setting
|
auto_send_email_set: Auto send email setting
|
||||||
email_forgot_password: Forgot Password
|
email_forgot_password: Forgot Password
|
||||||
email_special_reminder: Special Reminder
|
email_special_reminder: Special Reminder
|
||||||
|
special_reminder: Special Reminder
|
||||||
email_reset_password_content: Forgot Password
|
email_reset_password_content: Forgot Password
|
||||||
email_reset_password_success: Forgot Password
|
email_reset_password_success: Forgot Password
|
||||||
email_special_reminder_content: Special Reminder
|
email_special_reminder_content: Special Reminder
|
||||||
|
@ -173,6 +174,7 @@ en:
|
||||||
sign_up_failed: "Sign up failed!"
|
sign_up_failed: "Sign up failed!"
|
||||||
contribute_file_count: Count of Contribute Files #投稿檔案數
|
contribute_file_count: Count of Contribute Files #投稿檔案數
|
||||||
seminar_signup_success: Signup Success Message
|
seminar_signup_success: Signup Success Message
|
||||||
|
reset_password: Reset Password
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
seminar: Semianr #研討會前台
|
seminar: Semianr #研討會前台
|
||||||
|
@ -210,7 +212,7 @@ en:
|
||||||
recaptcha: Verification code
|
recaptcha: Verification code
|
||||||
signup_field: Sign Up Field #圈選項目
|
signup_field: Sign Up Field #圈選項目
|
||||||
uploads: Uploads #上傳檔案
|
uploads: Uploads #上傳檔案
|
||||||
con_login: Submission #投稿者登入
|
con_login: Login #投稿者登入
|
||||||
file_name: File Name #稿件名稱
|
file_name: File Name #稿件名稱
|
||||||
file_note: Summary #摘要
|
file_note: Summary #摘要
|
||||||
files: Files #檔案
|
files: Files #檔案
|
||||||
|
@ -228,7 +230,7 @@ en:
|
||||||
checkbox: Multiple choice
|
checkbox: Multiple choice
|
||||||
radio: Single choice
|
radio: Single choice
|
||||||
choices: Choices
|
choices: Choices
|
||||||
forgot_password: Forgot Password
|
forgot_password: Set Password
|
||||||
reset_email_sent: Reset Email Sent
|
reset_email_sent: Reset Email Sent
|
||||||
login_failed: Login Failed
|
login_failed: Login Failed
|
||||||
email_not_found: Email not found
|
email_not_found: Email not found
|
||||||
|
@ -248,3 +250,5 @@ en:
|
||||||
email_not_confirmed: Email not confirmed
|
email_not_confirmed: Email not confirmed
|
||||||
signup_not_confirmed: Signup not confirmed
|
signup_not_confirmed: Signup not confirmed
|
||||||
send_email: Send Email
|
send_email: Send Email
|
||||||
|
edit_form: Edit Form
|
||||||
|
emails_already_sent: Emails Already Sent
|
|
@ -105,14 +105,15 @@ zh_tw:
|
||||||
auto_send_email_set: 自動發信設定
|
auto_send_email_set: 自動發信設定
|
||||||
email_forgot_password: 忘記密碼
|
email_forgot_password: 忘記密碼
|
||||||
email_special_reminder: 特殊通知
|
email_special_reminder: 特殊通知
|
||||||
|
special_reminder: 特殊通知
|
||||||
email_reset_password_content: 忘記密碼
|
email_reset_password_content: 忘記密碼
|
||||||
email_reset_password_success: 忘記密碼
|
email_reset_password_success: 忘記密碼
|
||||||
email_special_reminder_content: 特殊通知
|
email_special_reminder_content: 特殊通知
|
||||||
email_special_reminder_success: 特殊通知
|
email_special_reminder_success: 特殊通知
|
||||||
is_confirmation: 認證Email
|
is_confirmation: 認證Email
|
||||||
click_here_to_confirm: Please click this link / 請點選此連結
|
click_here_to_confirm: Please click this link / 請點選此連結
|
||||||
confirm_ok: Email已認證
|
confirm_ok: 認證通過
|
||||||
confirm_not_ok: Email未認證
|
confirm_not_ok: 連結已失效
|
||||||
select_email_type: 選擇Email種類
|
select_email_type: 選擇Email種類
|
||||||
send_email_text: 附加額外文字內容
|
send_email_text: 附加額外文字內容
|
||||||
predefined_text: 預設郵件內容
|
predefined_text: 預設郵件內容
|
||||||
|
@ -174,6 +175,7 @@ zh_tw:
|
||||||
sign_up_failed: "報名失敗"
|
sign_up_failed: "報名失敗"
|
||||||
contribute_file_count: 投稿檔案數
|
contribute_file_count: 投稿檔案數
|
||||||
seminar_signup_success: Signup Success Message
|
seminar_signup_success: Signup Success Message
|
||||||
|
reset_password: Reset Password
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
seminar: 研討會前台
|
seminar: 研討會前台
|
||||||
|
@ -211,7 +213,7 @@ zh_tw:
|
||||||
recaptcha: 驗證碼
|
recaptcha: 驗證碼
|
||||||
signup_field: 圈選項目
|
signup_field: 圈選項目
|
||||||
uploads: 上傳檔案
|
uploads: 上傳檔案
|
||||||
con_login: Submission
|
con_login: 登入
|
||||||
file_name: 稿件名稱
|
file_name: 稿件名稱
|
||||||
file_note: 摘要
|
file_note: 摘要
|
||||||
files: 檔案
|
files: 檔案
|
||||||
|
@ -229,7 +231,7 @@ zh_tw:
|
||||||
checkbox: 多選
|
checkbox: 多選
|
||||||
radio: 單選
|
radio: 單選
|
||||||
choices: 選項
|
choices: 選項
|
||||||
forgot_password: 忘記密碼
|
forgot_password: 設定密碼
|
||||||
reset_email_sent: 重設密碼Email已送出
|
reset_email_sent: 重設密碼Email已送出
|
||||||
login_failed: 登入失敗
|
login_failed: 登入失敗
|
||||||
email_not_found: 找不到Email
|
email_not_found: 找不到Email
|
||||||
|
@ -248,3 +250,5 @@ zh_tw:
|
||||||
email_not_confirmed: Email尚未確認
|
email_not_confirmed: Email尚未確認
|
||||||
signup_not_confirmed: 註冊尚未查核確認
|
signup_not_confirmed: 註冊尚未查核確認
|
||||||
send_email: 寄送Email
|
send_email: 寄送Email
|
||||||
|
edit_form: Edit Form
|
||||||
|
emails_already_sent: Emails Already Sent
|
|
@ -109,6 +109,7 @@ Rails.application.routes.draw do
|
||||||
post 'add_file_proc', to: 'seminars#add_file_proc'
|
post 'add_file_proc', to: 'seminars#add_file_proc'
|
||||||
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
||||||
post 'del_file', to: 'seminars#del_file'
|
post 'del_file', to: 'seminars#del_file'
|
||||||
|
patch 'update_signup_form', to: 'seminars#update_signup_form'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
||||||
|
|
Loading…
Reference in New Issue