backup remote change

This commit is contained in:
邱博亞 2023-10-10 10:14:57 +08:00
parent 383d1f5862
commit 6c3b5ca75f
6 changed files with 207 additions and 77 deletions

View File

@ -391,18 +391,18 @@ class SeminarsController < ApplicationController
def check_email def check_email
params = OrbitHelper.params params = OrbitHelper.params
success = true
if !params[:email].blank? if !params[:email].blank?
count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count
result = count > 0 ? t('seminar.already_used') : t('seminar.available') result = count > 0 ? t('seminar.already_used') : t('seminar.available')
else success = count > 0 ? false : true
result = t('seminar.please_enter_email')
end end
{ render :json => {
"result" => result "result" => result,
} "success" => success
}.to_json
end end

View File

@ -14,6 +14,11 @@
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @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? signup_is_full = @seminar.signup_is_full?
%> %>
<style>
.error {
color: red;
}
</style>
<% if !registration_is_open %> <% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %> <%= t('seminar.sign_up_not_open') %>
@ -58,9 +63,9 @@
<!-- Title --> <!-- Title -->
<div class="form-group"> <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"> <div class="col-sm-10">
<%= @seminar.title %> <h3><%= @seminar.title %></h3>
</div> </div>
</div> </div>
<% if !@seminar.signup_note.blank? %> <% if !@seminar.signup_note.blank? %>
@ -77,7 +82,7 @@
<% 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' %>
<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"> <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) %>
* *
@ -124,7 +129,8 @@
</div> </div>
<% elsif signup_field.field_name == 'email' %> <% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :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> </div>
<% elsif signup_field.field_name == 'password' %> <% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10"> <div class="col-sm-10">
@ -207,18 +213,40 @@
</div> </div>
<% end %> <% 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"> <div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %> <%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div> </div>
<% if(counter % 5 == 0) && idx != 4 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 25) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %> <% @form_index = @form_index +1 %>
<% end %> <% 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 %> <% if @seminar.seminar_signup_field_sets.count != 0 %>
@ -243,8 +271,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" checked="checked">
<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> </label>
</div> </div>
</div> </div>
@ -317,29 +345,26 @@
value = $(this).val() || null; value = $(this).val() || null;
var checkAvailability = function(){ var checkAvailability = function(){
$.ajax({ $.ajax({
url : "<%= "#{prefix_url}?method=check_availability&no=#{@seminar.id}" %>", url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "value" : 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");
alert("1tttt");
}else{ }else{
loader.addClass("error");
alert("1ssss2");
} }
loader.text(data.result);
} }
}) })
} }
if( value ){ if( value ){
if(type == "seminar_signup_email"){ if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability(); checkAvailability();
} }
} }
}) })
$(".upload").on("change",function(){ $(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename"); let filenamedom = $(this).parent().parent().find(".filename");
@ -347,6 +372,43 @@ alert("1ssss2");
filenamedom.text(filenameA[filenameA.length - 1]); 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> </script>

View File

@ -14,6 +14,11 @@
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @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? signup_is_full = @seminar.signup_is_full?
%> %>
<style>
.error {
color: red;
}
</style>
<% if !registration_is_open %> <% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %> <%= t('seminar.sign_up_not_open') %>
@ -58,9 +63,9 @@
<!-- Title --> <!-- Title -->
<div class="form-group"> <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"> <div class="col-sm-10">
<%= @seminar.title %> <h3><%= @seminar.title %></h3>
</div> </div>
</div> </div>
<% if !@seminar.signup_note.blank? %> <% if !@seminar.signup_note.blank? %>
@ -77,7 +82,7 @@
<% 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' %>
<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"> <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) %>
* *
@ -124,7 +129,8 @@
</div> </div>
<% elsif signup_field.field_name == 'email' %> <% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :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> </div>
<% elsif signup_field.field_name == 'password' %> <% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10"> <div class="col-sm-10">
@ -207,18 +213,40 @@
</div> </div>
<% end %> <% 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"> <div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %> <%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div> </div>
<% if(counter % 5 == 0) && idx != 4 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 25) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %> <% @form_index = @form_index +1 %>
<% end %> <% 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 %> <% if @seminar.seminar_signup_field_sets.count != 0 %>
@ -244,7 +272,7 @@
<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">
<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> </label>
</div> </div>
</div> </div>
@ -316,29 +344,26 @@
value = $(this).val() || null; value = $(this).val() || null;
var checkAvailability = function(){ var checkAvailability = function(){
$.ajax({ $.ajax({
url : "<%= "#{prefix_url}?method=check_availability&no=#{@seminar.id}" %>", url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "value" : 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");
alert("1tttt");
}else{ }else{
loader.addClass("error");
alert("1ssss2");
} }
loader.text(data.result);
} }
}) })
} }
if( value ){ if( value ){
if(type == "seminar_signup_email"){ if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability(); checkAvailability();
} }
} }
}) })
$(".upload").on("change",function(){ $(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename"); let filenamedom = $(this).parent().parent().find(".filename");
@ -346,6 +371,44 @@ alert("1ssss2");
filenamedom.text(filenameA[filenameA.length - 1]); 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> </script>

View File

@ -207,7 +207,7 @@ en:
note: Note #註解 note: Note #註解
time: 'Start / End Time' #(開始/結束)時間 time: 'Start / End Time' #(開始/結束)時間
place: Place #地點 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' privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
recaptcha: Verification code recaptcha: Verification code
signup_field: Sign Up Field #圈選項目 signup_field: Sign Up Field #圈選項目
@ -254,3 +254,5 @@ en:
emails_already_sent: Emails Already Sent emails_already_sent: Emails Already Sent
is_confirmed_date: Email confirmed time 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

View File

@ -208,7 +208,7 @@ zh_tw:
note: 註解 note: 註解
time: (開始/結束)時間 time: (開始/結束)時間
place: 地點 place: 地點
agree: 同意接受註冊相關條款(Agree upon terms of this web) agree: 已確認閱讀相關條款
privacy_statement: '個資及隱私權保護宣告' privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼 recaptcha: 驗證碼
signup_field: 圈選項目 signup_field: 圈選項目
@ -252,5 +252,7 @@ zh_tw:
send_email: 寄送Email send_email: 寄送Email
edit_form: 編輯註冊表單 edit_form: 編輯註冊表單
emails_already_sent: 已寄送Email emails_already_sent: 已寄送Email
add_member: 增加組員
remove_member: 移除加組員
is_confirmed_date: Email認證時間 is_confirmed_date: Email認證時間
signup_confirmed_date: 註冊查核確認時間 signup_confirmed_date: 註冊查核確認時間

View File

@ -113,6 +113,7 @@ Rails.application.routes.draw do
end end
end end
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email" post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
end end
end end