forked from spen/seminar
Merge branch 'master' into 'master'
Fix bug. See merge request spen/seminar!46
This commit is contained in:
commit
8b1c4582df
|
@ -503,22 +503,6 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
def edit
|
def edit
|
||||||
@seminar_items = SeminarItem.all
|
@seminar_items = SeminarItem.all
|
||||||
@seminar = SeminarMain.where(id: params[:id]).first
|
@seminar = SeminarMain.where(id: params[:id]).first
|
||||||
except_attributes = SeminarSignup::HiddenFields
|
|
||||||
@seminar.seminar_signup_field_sets.each do |signup_field_set|
|
|
||||||
if (!(SeminarSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha') || except_attributes.include?(signup_field_set.field_name)
|
|
||||||
signup_field_set.delete
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@seminar.seminar_submission_field_sets.each do |submission_field_set|
|
|
||||||
if (!(SeminarSignupContribute.attribute_names.include? submission_field_set.field_name)) || except_attributes.include?(submission_field_set.field_name)
|
|
||||||
submission_field_set.delete
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@seminar.seminar_signup_field_customs.each do |custom_set|
|
|
||||||
if !(@seminar.seminar_signup_fields.collect(&:id).include? custom_set.seminar_signup_field_id)
|
|
||||||
custom_set.delete
|
|
||||||
end
|
|
||||||
end
|
|
||||||
create_set (true)
|
create_set (true)
|
||||||
@signup_sets = @seminar.seminar_signup_field_sets
|
@signup_sets = @seminar.seminar_signup_field_sets
|
||||||
@submission_set = @seminar.seminar_submission_field_sets
|
@submission_set = @seminar.seminar_submission_field_sets
|
||||||
|
@ -754,8 +738,10 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
def create_set (save_flag)
|
def create_set (save_flag)
|
||||||
except_attributes = SeminarSignup::HiddenFields
|
except_attributes = SeminarSignup::HiddenFields
|
||||||
@seminar.seminar_signup_field_sets.where(:field_name.in=>except_attributes).destroy
|
if @seminar.seminar_signup_field_sets.where(:field_name.in=>except_attributes).destroy != 0
|
||||||
SeminarSignup.attribute_names.each do |attr_signup|
|
@seminar = @seminar.reload
|
||||||
|
end
|
||||||
|
(SeminarSignup.attribute_names + ['recaptcha']).each do |attr_signup|
|
||||||
next if except_attributes.include?(attr_signup)
|
next if except_attributes.include?(attr_signup)
|
||||||
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
|
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
|
||||||
if signup_set.length==0
|
if signup_set.length==0
|
||||||
|
@ -783,21 +769,6 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name== 'recaptcha' }
|
|
||||||
if signup_set.length==0
|
|
||||||
name1 = Hash.new
|
|
||||||
now_locale = I18n.locale
|
|
||||||
I18n.available_locales.each do |locale|
|
|
||||||
I18n.locale = locale
|
|
||||||
name1[locale] = t("seminar_signup.recaptcha")
|
|
||||||
end
|
|
||||||
I18n.locale = now_locale
|
|
||||||
if save_flag
|
|
||||||
@seminar.seminar_signup_field_sets.create(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
|
|
||||||
else
|
|
||||||
@seminar.seminar_signup_field_sets.new(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@seminar.seminar_submission_field_sets.where(:field_name.in=>except_attributes).destroy
|
@seminar.seminar_submission_field_sets.where(:field_name.in=>except_attributes).destroy
|
||||||
SeminarSignupContribute.attribute_names.each do |attr_submission|
|
SeminarSignupContribute.attribute_names.each do |attr_submission|
|
||||||
next if except_attributes.include?(attr_submission)
|
next if except_attributes.include?(attr_submission)
|
||||||
|
|
|
@ -4,7 +4,7 @@ class SeminarSignup
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type"]
|
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type"]
|
||||||
DefaultEnableFields = ['status','name','tel','phone','email','password']
|
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
|
||||||
field :sort_number , type: Integer, default: 10000
|
field :sort_number , type: Integer, default: 10000
|
||||||
|
|
||||||
field :status
|
field :status
|
||||||
|
|
Loading…
Reference in New Issue