fix new error
This commit is contained in:
parent
28b824f018
commit
57167f9d08
|
@ -31,7 +31,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
sort = {params[:sort].to_sym=>params[:order]}
|
||||
end
|
||||
else
|
||||
sort = {:signup_start_date=>"desc"}
|
||||
sort = {:signup_start_date=>"desc"}
|
||||
end
|
||||
|
||||
@seminars = SeminarMain.all.order_by(sort).with_categories(filters("category"))
|
||||
|
@ -60,7 +60,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
def new
|
||||
@member = nil
|
||||
@seminar = SeminarMain.new
|
||||
create_set
|
||||
create_set (false)
|
||||
@signup_sets = @seminar.seminar_signup_field_sets
|
||||
@submission_set = @seminar.seminar_submission_field_sets
|
||||
@custom_set = @seminar.seminar_signup_field_customs
|
||||
|
@ -75,14 +75,21 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
|
||||
end
|
||||
end
|
||||
|
||||
seminar = SeminarMain.new(seminar_params)
|
||||
|
||||
seminar_main_params = seminar_params
|
||||
seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets']
|
||||
seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets']
|
||||
seminar_main_params.delete(:seminar_signup_field_sets)
|
||||
seminar_main_params.delete(:seminar_submission_field_sets)
|
||||
seminar = SeminarMain.new(seminar_main_params)
|
||||
seminar.create_user_id = current_user.id
|
||||
seminar.update_user_id = current_user.id
|
||||
|
||||
seminar.save
|
||||
|
||||
seminar_signup_set_params.each do |key,value|
|
||||
seminar.seminar_signup_field_sets.create(value)
|
||||
end
|
||||
seminar_submission_set_params.each do |key,value|
|
||||
seminar.seminar_submission_field_sets.create(value)
|
||||
end
|
||||
redirect_to params['referer_url']
|
||||
|
||||
end
|
||||
|
@ -105,7 +112,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
custom_set.delete
|
||||
end
|
||||
end
|
||||
create_set
|
||||
create_set (true)
|
||||
@signup_sets = @seminar.seminar_signup_field_sets
|
||||
@submission_set = @seminar.seminar_submission_field_sets
|
||||
@custom_set = @seminar.seminar_signup_field_customs
|
||||
|
@ -231,7 +238,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
def seminar_params
|
||||
params.require(:seminar_main).permit!
|
||||
end
|
||||
def create_set
|
||||
def create_set (save_flag)
|
||||
SeminarSignup.attribute_names.each do |attr_signup|
|
||||
if !(['_id', 'created_at', 'updated_at','seminar_main_id'].include? attr_signup)
|
||||
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
|
||||
|
@ -253,7 +260,11 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
name1[locale] = t("seminar_signup.#{attr_signup}")
|
||||
end
|
||||
I18n.locale = now_locale
|
||||
@seminar.seminar_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
|
||||
if save_flag
|
||||
@seminar.seminar_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
|
||||
else
|
||||
@seminar.seminar_signup_field_sets.new(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -265,8 +276,12 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
I18n.locale = locale
|
||||
name1[locale] = t("seminar_signup.recaptcha")
|
||||
end
|
||||
I18n.locale = now_locale
|
||||
@seminar.seminar_signup_field_sets.create(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
|
||||
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
|
||||
SeminarSignupContribute.attribute_names.each do |attr_submission|
|
||||
if !(['_id', 'created_at', 'updated_at','seminar_signup_id'].include? attr_submission)
|
||||
|
@ -278,8 +293,12 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
I18n.locale = locale
|
||||
name1[locale] = t("seminar_signup.#{attr_submission}")
|
||||
end
|
||||
I18n.locale = now_locale
|
||||
@seminar.seminar_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
|
||||
I18n.locale = now_locale
|
||||
if save_flag
|
||||
@seminar.seminar_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
|
||||
else
|
||||
@seminar.seminar_submission_field_sets.new(field_name:attr_submission,name:name1,placeholder:name1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -168,6 +168,7 @@
|
|||
<%= show_set_field(attr_signup,'seminar_signup_field_sets',signup_index,'placeholder') %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_signup_field_sets][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
||||
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_sets][#{signup_index}][disabled]" %>' value="false">
|
||||
<%= check_box_tag("seminar_main[seminar_signup_field_sets][#{signup_index}][disabled]", true ,attr_signup.disabled) %>
|
||||
</td>
|
||||
|
@ -206,6 +207,7 @@
|
|||
<%= show_set_field(attr_signup,'seminar_submission_field_sets',submission_index,'placeholder') %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_submission_field_sets][#{submission_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
||||
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_submission_field_sets][#{submission_index}][disabled]" %>' value="false">
|
||||
<%= check_box_tag("seminar_main[seminar_submission_field_sets][#{submission_index}][disabled]", true ,attr_signup.disabled) %>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue