backup remote change
This commit is contained in:
parent
383d1f5862
commit
6c3b5ca75f
|
@ -391,18 +391,18 @@ class SeminarsController < ApplicationController
|
|||
def check_email
|
||||
|
||||
params = OrbitHelper.params
|
||||
|
||||
success = true
|
||||
if !params[:email].blank?
|
||||
count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count
|
||||
|
||||
result = count > 0 ? t('seminar.already_used') : t('seminar.available')
|
||||
else
|
||||
result = t('seminar.please_enter_email')
|
||||
success = count > 0 ? false : true
|
||||
end
|
||||
|
||||
{
|
||||
"result" => result
|
||||
}
|
||||
render :json => {
|
||||
"result" => result,
|
||||
"success" => success
|
||||
}.to_json
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
|
||||
signup_is_full = @seminar.signup_is_full?
|
||||
%>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<% if !registration_is_open %>
|
||||
|
||||
<%= t('seminar.sign_up_not_open') %>
|
||||
|
@ -58,9 +63,9 @@
|
|||
|
||||
<!-- Title -->
|
||||
<div class="form-group">
|
||||
<label for="title" class="col-sm-2 control-label"><%= t('seminar.title') %></label>
|
||||
<label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
|
||||
<div class="col-sm-10">
|
||||
<%= @seminar.title %>
|
||||
<h3><%= @seminar.title %></h3>
|
||||
</div>
|
||||
</div>
|
||||
<% if !@seminar.signup_note.blank? %>
|
||||
|
@ -77,7 +82,7 @@
|
|||
<% 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' : '' %>">
|
||||
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
||||
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||
*
|
||||
|
@ -124,7 +129,8 @@
|
|||
</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>
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'password' %>
|
||||
<div class="col-sm-10">
|
||||
|
@ -207,18 +213,40 @@
|
|||
</div>
|
||||
|
||||
<% end %>
|
||||
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf| %>
|
||||
|
||||
<%
|
||||
group = 1
|
||||
counter = 0
|
||||
%>
|
||||
|
||||
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
|
||||
<% if(idx == 5) %>
|
||||
<div id="optional">
|
||||
<% end %>
|
||||
<% if(idx % 5 == 0) && idx != 0 %>
|
||||
<% group += 1 %>
|
||||
<div id="group<%= group %>" style="display:none;">
|
||||
<% end %>
|
||||
<% counter += 1 %>
|
||||
<div class="form-group">
|
||||
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
|
||||
|
||||
</div>
|
||||
|
||||
<% if(counter % 5 == 0) && idx != 4 %>
|
||||
<% counter = 0 %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if(idx == 25) %>
|
||||
<div id="optional">
|
||||
<% end %>
|
||||
<% @form_index = @form_index +1 %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="form-group" style="text-align:center;margin:10px 0;">
|
||||
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
|
||||
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
|
||||
</div>
|
||||
|
||||
<!-- 驗證碼 -->
|
||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
||||
|
@ -243,8 +271,8 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<label>
|
||||
<input id="agree" name="agree" value="1" type="checkbox" required="required">
|
||||
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= t("seminar_signup.agree")%></a>
|
||||
<input id="agree" name="agree" value="1" type="checkbox" required="required" checked="checked">
|
||||
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -310,36 +338,33 @@
|
|||
});
|
||||
|
||||
|
||||
$(".availibility").blur(function(){
|
||||
$(".availibility").blur(function(){
|
||||
var type = $(this).attr("id"),
|
||||
loader = $(this).parent().find('.loader'),
|
||||
elem = $(this),
|
||||
value = $(this).val() || null;
|
||||
var checkAvailability = function(){
|
||||
$.ajax({
|
||||
url : "<%= "#{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");
|
||||
var checkAvailability = function(){
|
||||
$.ajax({
|
||||
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
||||
data : {"type" : type, "email" : value},
|
||||
dataType : "json",
|
||||
type : "get",
|
||||
success : function(data){
|
||||
if( data.success == true ){
|
||||
loader.removeClass("error");
|
||||
}else{
|
||||
loader.addClass("error");
|
||||
}
|
||||
loader.text(data.result);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if( value ){
|
||||
if(type == "seminar_signup_email"){
|
||||
checkAvailability();
|
||||
})
|
||||
}
|
||||
if( value ){
|
||||
if(type == "seminar_signup_email"){
|
||||
loader.text("Checking...")
|
||||
checkAvailability();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
$(".upload").on("change",function(){
|
||||
let filenamedom = $(this).parent().parent().find(".filename");
|
||||
|
@ -347,6 +372,43 @@ alert("1ssss2");
|
|||
filenamedom.text(filenameA[filenameA.length - 1]);
|
||||
})
|
||||
|
||||
$("#optional label").each(function(){
|
||||
if($(this).hasClass("control-label")){
|
||||
$(this).text("*" + $(this).text());
|
||||
}
|
||||
})
|
||||
|
||||
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
||||
|
||||
let currentGroup = 1;
|
||||
$("#add-member").on("click",function () {
|
||||
if(currentGroup < 5){
|
||||
$("#remove-member").show();
|
||||
currentGroup++;
|
||||
$("#group" + currentGroup).show();
|
||||
if(currentGroup == 5){
|
||||
$(this).attr("disabled","disabled").hide();
|
||||
}
|
||||
}
|
||||
$("#group" + currentGroup + " input").attr("required", true);
|
||||
$("#group" + currentGroup + " textarea").attr("required", true);
|
||||
return false;
|
||||
})
|
||||
$("#remove-member").on("click",function () {
|
||||
if(currentGroup > 0){
|
||||
$("#group" + currentGroup).hide();
|
||||
$("#group" + currentGroup + " input").attr("required", false);
|
||||
$("#group" + currentGroup + " input").val("");
|
||||
$("#group" + currentGroup + " textarea").attr("required", false);
|
||||
$("#group" + currentGroup + " textarea").val("");
|
||||
currentGroup--;
|
||||
if(currentGroup == 1){
|
||||
$(this).hide();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
|
||||
signup_is_full = @seminar.signup_is_full?
|
||||
%>
|
||||
<style>
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<% if !registration_is_open %>
|
||||
|
||||
<%= t('seminar.sign_up_not_open') %>
|
||||
|
@ -58,9 +63,9 @@
|
|||
|
||||
<!-- Title -->
|
||||
<div class="form-group">
|
||||
<label for="title" class="col-sm-2 control-label"><%= t('seminar.title') %></label>
|
||||
<label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
|
||||
<div class="col-sm-10">
|
||||
<%= @seminar.title %>
|
||||
<h3><%= @seminar.title %></h3>
|
||||
</div>
|
||||
</div>
|
||||
<% if !@seminar.signup_note.blank? %>
|
||||
|
@ -77,7 +82,7 @@
|
|||
<% 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' : '' %>">
|
||||
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
||||
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||
*
|
||||
|
@ -124,7 +129,8 @@
|
|||
</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>
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'password' %>
|
||||
<div class="col-sm-10">
|
||||
|
@ -207,18 +213,40 @@
|
|||
</div>
|
||||
|
||||
<% end %>
|
||||
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf| %>
|
||||
|
||||
<%
|
||||
group = 1
|
||||
counter = 0
|
||||
%>
|
||||
|
||||
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
|
||||
<% if(idx == 5) %>
|
||||
<div id="optional">
|
||||
<% end %>
|
||||
<% if(idx % 5 == 0) && idx != 0 %>
|
||||
<% group += 1 %>
|
||||
<div id="group<%= group %>" style="display:none;">
|
||||
<% end %>
|
||||
<% counter += 1 %>
|
||||
<div class="form-group">
|
||||
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
|
||||
|
||||
</div>
|
||||
|
||||
<% if(counter % 5 == 0) && idx != 4 %>
|
||||
<% counter = 0 %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if(idx == 25) %>
|
||||
<div id="optional">
|
||||
<% end %>
|
||||
<% @form_index = @form_index +1 %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="form-group" style="text-align:center;margin:10px 0;">
|
||||
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
|
||||
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
|
||||
</div>
|
||||
|
||||
<!-- 驗證碼 -->
|
||||
<% if @seminar.seminar_signup_field_sets.count != 0 %>
|
||||
|
@ -244,7 +272,7 @@
|
|||
<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>
|
||||
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -309,36 +337,33 @@
|
|||
});
|
||||
|
||||
|
||||
$(".availibility").blur(function(){
|
||||
$(".availibility").blur(function(){
|
||||
var type = $(this).attr("id"),
|
||||
loader = $(this).parent().find('.loader'),
|
||||
elem = $(this),
|
||||
value = $(this).val() || null;
|
||||
var checkAvailability = function(){
|
||||
$.ajax({
|
||||
url : "<%= "#{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");
|
||||
var checkAvailability = function(){
|
||||
$.ajax({
|
||||
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
|
||||
data : {"type" : type, "email" : value},
|
||||
dataType : "json",
|
||||
type : "get",
|
||||
success : function(data){
|
||||
if( data.success == true ){
|
||||
loader.removeClass("error");
|
||||
}else{
|
||||
loader.addClass("error");
|
||||
}
|
||||
loader.text(data.result);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if( value ){
|
||||
if(type == "seminar_signup_email"){
|
||||
checkAvailability();
|
||||
})
|
||||
}
|
||||
if( value ){
|
||||
if(type == "seminar_signup_email"){
|
||||
loader.text("Checking...")
|
||||
checkAvailability();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
$(".upload").on("change",function(){
|
||||
let filenamedom = $(this).parent().parent().find(".filename");
|
||||
|
@ -346,6 +371,44 @@ alert("1ssss2");
|
|||
filenamedom.text(filenameA[filenameA.length - 1]);
|
||||
})
|
||||
|
||||
$("#optional label").each(function(){
|
||||
if($(this).hasClass("control-label")){
|
||||
$(this).text("*" + $(this).text());
|
||||
}
|
||||
})
|
||||
|
||||
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
|
||||
|
||||
let currentGroup = 1;
|
||||
$("#add-member").on("click",function () {
|
||||
if(currentGroup < 5){
|
||||
$("#remove-member").show();
|
||||
currentGroup++;
|
||||
$("#group" + currentGroup).show();
|
||||
if(currentGroup == 5){
|
||||
$(this).attr("disabled","disabled").hide();
|
||||
}
|
||||
}
|
||||
$("#group" + currentGroup + " input").attr("required", true);
|
||||
$("#group" + currentGroup + " textarea").attr("required", true);
|
||||
return false;
|
||||
})
|
||||
$("#remove-member").on("click",function () {
|
||||
if(currentGroup > 0){
|
||||
$("#group" + currentGroup).hide();
|
||||
$("#group" + currentGroup + " input").attr("required", false);
|
||||
$("#group" + currentGroup + " input[type='text']").val("");
|
||||
$("#group" + currentGroup + " input[type='file']").val("");
|
||||
$("#group" + currentGroup + " textarea").attr("required", false);
|
||||
$("#group" + currentGroup + " textarea").val("");
|
||||
currentGroup--;
|
||||
if(currentGroup == 1){
|
||||
$(this).hide();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ en:
|
|||
note: Note #註解
|
||||
time: 'Start / End Time' #(開始/結束)時間
|
||||
place: Place #地點
|
||||
agree: "Accept Privacy and Personal Information Protection Policy of the Site"
|
||||
agree: "I agree with all terms"
|
||||
privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
|
||||
recaptcha: Verification code
|
||||
signup_field: Sign Up Field #圈選項目
|
||||
|
@ -253,4 +253,6 @@ en:
|
|||
edit_form: Edit Form
|
||||
emails_already_sent: Emails Already Sent
|
||||
is_confirmed_date: Email confirmed time
|
||||
signup_confirmed_date: Signup confirmed time
|
||||
signup_confirmed_date: Signup confirmed time
|
||||
add_member: Add Member
|
||||
remove_member: Remove Member
|
||||
|
|
|
@ -208,7 +208,7 @@ zh_tw:
|
|||
note: 註解
|
||||
time: (開始/結束)時間
|
||||
place: 地點
|
||||
agree: 同意接受註冊相關條款(Agree upon terms of this web)
|
||||
agree: 已確認閱讀相關條款
|
||||
privacy_statement: '個資及隱私權保護宣告'
|
||||
recaptcha: 驗證碼
|
||||
signup_field: 圈選項目
|
||||
|
@ -250,7 +250,9 @@ zh_tw:
|
|||
email_not_confirmed: Email尚未確認
|
||||
signup_not_confirmed: 註冊尚未查核確認
|
||||
send_email: 寄送Email
|
||||
edit_form: 編輯註冊表單
|
||||
edit_form: 編輯註冊表單
|
||||
emails_already_sent: 已寄送Email
|
||||
add_member: 增加組員
|
||||
remove_member: 移除加組員
|
||||
is_confirmed_date: Email認證時間
|
||||
signup_confirmed_date: 註冊查核確認時間
|
|
@ -113,6 +113,7 @@ Rails.application.routes.draw do
|
|||
end
|
||||
end
|
||||
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
||||
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue