diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index caa4fd8..f7718c3 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -3,7 +3,7 @@ class SeminarsController < ApplicationController include MemberHelper include ActionView::Context #vary important (only add this can access @@session from view) 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","edit_login_seminar_signup"] + FrontendMethods = ["show_privacy", "show_data", "check_email", "check_name", "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 def index @@ -419,6 +419,24 @@ class SeminarsController < ApplicationController end + def check_name + + params = OrbitHelper.params + success = true + if !params[:name].blank? + count = SeminarSignup.where(:name => params[:name], :seminar_main_id => params[:no]).count + + result = count > 0 ? t('seminar.already_used') : t('seminar.available') + success = count > 0 ? false : true + end + + render :json => { + "result" => result, + "success" => success + }.to_json + + end + def check_availability params = OrbitHelper.params @@ -477,7 +495,7 @@ class SeminarsController < ApplicationController end end end - @signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first + @signup = SeminarSignup.where(name: params[:seminar_signup][:name], email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first @seminar_signup = SeminarSignup.new(seminar_signup_params) not_signup_yet = @signup.blank? @@ -529,7 +547,7 @@ class SeminarsController < ApplicationController end end if !not_signup_yet - notice_words = t('seminar.email_exist') + notice_words = t('seminar.email_or_name_exist') referer_url = get_referer_url_for_notice(notice_words) show_alert(notice_words) else diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index a5ab61e..d9ca678 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -160,6 +160,11 @@ <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: t("seminar.phone_hint") %>
(<%= t("seminar.phone_hint") %>)
+ <% elsif signup_field.field_name == 'name' %> +