diff --git a/app/controllers/admin/application_forms_controller.rb b/app/controllers/admin/application_forms_controller.rb index dd89207..d4af843 100644 --- a/app/controllers/admin/application_forms_controller.rb +++ b/app/controllers/admin/application_forms_controller.rb @@ -468,14 +468,14 @@ class Admin::ApplicationFormsController < OrbitAdminController application_form_main_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? end end - application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets'] - application_form_email_sets_params = application_form_main_params['application_form_email_sets'] - application_form_signup_field_customs_params = application_form_main_params["application_form_signup_field_customs"].to_h rescue {} - application_form_main_params["application_form_signup_field_customs"].to_h.each do |k,v| + application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets_attributes'] + application_form_email_sets_params = application_form_main_params['application_form_email_sets_attributes'] + application_form_signup_field_customs_params = application_form_main_params["application_form_signup_field_customs_attributes"].to_h rescue {} + application_form_main_params["application_form_signup_field_customs_attributes"].to_h.each do |k,v| v.delete "title" end - application_form_main_params.delete(:application_form_signup_field_sets) - application_form_main_params.delete(:application_form_email_sets) + application_form_main_params.delete(:application_form_signup_field_sets_attributes) + application_form_main_params.delete(:application_form_email_sets_attributes) application_form = ApplicationFormMain.new(application_form_main_params) application_form.create_user_id = current_user.id application_form.update_user_id = current_user.id @@ -541,8 +541,8 @@ class Admin::ApplicationFormsController < OrbitAdminController if @application_form_params.has_key?("title_translations") @application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil? end - if @application_form_params[:application_form_signup_fields] - @application_form_params[:application_form_signup_fields].each do |a| + if @application_form_params[:application_form_signup_fields_attributes] + @application_form_params[:application_form_signup_fields_attributes].each do |a| @field_name = 'application_form_main' field_status = a.last[:id].present? @attribute_field = ApplicationFormSignupField.add_application_form_signup_field(@application_form, a.last, a.last[:id], field_status) @@ -552,8 +552,8 @@ class Admin::ApplicationFormsController < OrbitAdminController @application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true} redirect_to admin_application_forms_path and return - elsif @application_form_params[:application_form_submission_fields] - params[:application_form_main][:application_form_submission_fields].each do |a| + elsif @application_form_params[:application_form_submission_fields_attributes] + params[:application_form_main][:application_form_submission_fields_attributes].each do |a| @field_name = 'application_form_main' field_status = a.last[:id].present? @attribute_field = ApplicationFormSubmissionField.add_application_form_signup_field(@application_form, a.last, a.last[:id], field_status) diff --git a/app/views/admin/application_forms/_form.html.erb b/app/views/admin/application_forms/_form.html.erb index b093086..0551ced 100644 --- a/app/views/admin/application_forms/_form.html.erb +++ b/app/views/admin/application_forms/_form.html.erb @@ -117,15 +117,15 @@ <%= t("application_form_signup.#{attr_signup.field_name}") %> - <%= show_set_field(attr_signup,'application_form_signup_field_sets',signup_index,'name') %> + <%= show_set_field(attr_signup,'application_form_signup_field_sets_attributes',signup_index,'name') %> - <%= show_set_field(attr_signup,'application_form_signup_field_sets',signup_index,'placeholder') %> + <%= show_set_field(attr_signup,'application_form_signup_field_sets_attributes',signup_index,'placeholder') %> - - - <%= check_box_tag("application_form_main[application_form_signup_field_sets][#{signup_index}][disabled]", true ,attr_signup.disabled) %> + + + <%= check_box_tag("application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][disabled]", true ,attr_signup.disabled) %> <% if attr_signup.field_name == 'email' %> @@ -144,9 +144,9 @@ <% end %> <% if false #attr_signup.field_name != 'recaptcha' %> - - <%= hidden_field_tag("application_form_main[application_form_signup_field_sets][#{signup_index}][hidden]",attr_signup.hidden) %> - <%#= check_box_tag("application_form_main[application_form_signup_field_sets][#{signup_index}][hidden]", true ,attr_signup.hidden) %> + + <%= hidden_field_tag("application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][hidden]",attr_signup.hidden) %> + <%#= check_box_tag("application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %> <% end %> @@ -169,13 +169,13 @@ <%= ApplicationFormSignupField.where(id:attr_custom.application_form_signup_field_id).first.title rescue '' %> - - <%= check_box_tag("application_form_main[application_form_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %> + + <%= check_box_tag("application_form_main[application_form_signup_field_customs_attributes][#{custom_index}][hidden]", true ,attr_custom.hidden) %> <% if !attr_custom.new_record? %> - + <% elsif f.object.copy_id.present? %> - + <% end %> <% end %> @@ -217,8 +217,8 @@ <%= t('application_form.disable') %> - - <%= check_box_tag("application_form_main[application_form_email_sets][#{index1}][disabled]", true ,@email_set[index1].disabled) %> + + <%= check_box_tag("application_form_main[application_form_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %> @@ -226,7 +226,7 @@ <%= t('application_form.email_title') %> - <%= show_set_field(@email_set[index1],'application_form_email_sets',index1,'title','text_field') %> + <%= show_set_field(@email_set[index1],'application_form_email_sets_attributes',index1,'title','text_field') %> @@ -235,7 +235,7 @@
- <%= show_set_field(@email_set[index1],'application_form_email_sets',index1,'content','text_area') %> + <%= show_set_field(@email_set[index1],'application_form_email_sets_attributes',index1,'content','text_area') %>