From 6c3b5ca75fae5f78ebc23cf04de0ea28d8dd4095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Tue, 10 Oct 2023 10:14:57 +0800 Subject: [PATCH] backup remote change --- app/controllers/seminars_controller.rb | 12 +- .../edit_login_seminar_signup.html.erb | 130 +++++++++++++----- app/views/seminars/show.html.erb | 129 ++++++++++++----- config/locales/en.yml | 6 +- config/locales/zh_tw.yml | 6 +- config/routes.rb | 1 + 6 files changed, 207 insertions(+), 77 deletions(-) diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index 628c987..f46feba 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -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 diff --git a/app/views/seminars/edit_login_seminar_signup.html.erb b/app/views/seminars/edit_login_seminar_signup.html.erb index de08a4e..4066bfd 100644 --- a/app/views/seminars/edit_login_seminar_signup.html.erb +++ b/app/views/seminars/edit_login_seminar_signup.html.erb @@ -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? %> + <% if !registration_is_open %> <%= t('seminar.sign_up_not_open') %> @@ -58,9 +63,9 @@
- +
- <%= @seminar.title %> +

<%= @seminar.title %>

<% 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' %> -
+ <% elsif signup_field.field_name == 'email' %>
- <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %> check mail + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %> +
<% elsif signup_field.field_name == 'password' %>
@@ -207,18 +213,40 @@
<% 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) %> +
+ <% end %> + <% if(idx % 5 == 0) && idx != 0 %> + <% group += 1 %> + + <% end %> + <% if(idx == 25) %> +
+ <% end %> <% @form_index = @form_index +1 %> <% end %> - +
+
+ + +
<% if @seminar.seminar_signup_field_sets.count != 0 %> @@ -243,8 +271,8 @@ @@ -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; + }) + })(); diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index 3f33675..0185a32 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -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? %> + <% if !registration_is_open %> <%= t('seminar.sign_up_not_open') %> @@ -58,9 +63,9 @@
- +
- <%= @seminar.title %> +

<%= @seminar.title %>

<% 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' %> -