This commit is contained in:
BoHung Chiu 2023-03-07 21:32:45 +08:00
parent 3ba5d512cf
commit ba912412d3
2 changed files with 26 additions and 26 deletions

View File

@ -468,14 +468,14 @@ class Admin::ApplicationFormsController < OrbitAdminController
application_form_main_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank? application_form_main_params['application_form_links_attributes'].delete(idx.to_s) if link['url'].blank?
end end
end end
application_form_signup_set_params = application_form_main_params['application_form_signup_field_sets'] 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'] 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"].to_h rescue {} 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"].to_h.each do |k,v| application_form_main_params["application_form_signup_field_customs_attributes"].to_h.each do |k,v|
v.delete "title" v.delete "title"
end end
application_form_main_params.delete(:application_form_signup_field_sets) application_form_main_params.delete(:application_form_signup_field_sets_attributes)
application_form_main_params.delete(:application_form_email_sets) application_form_main_params.delete(:application_form_email_sets_attributes)
application_form = ApplicationFormMain.new(application_form_main_params) application_form = ApplicationFormMain.new(application_form_main_params)
application_form.create_user_id = current_user.id application_form.create_user_id = current_user.id
application_form.update_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") if @application_form_params.has_key?("title_translations")
@application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil? @application_form_params["organizer_id"] = nil if @application_form_params["organizer_id"].nil?
end end
if @application_form_params[:application_form_signup_fields] if @application_form_params[:application_form_signup_fields_attributes]
@application_form_params[:application_form_signup_fields].each do |a| @application_form_params[:application_form_signup_fields_attributes].each do |a|
@field_name = 'application_form_main' @field_name = 'application_form_main'
field_status = a.last[:id].present? field_status = a.last[:id].present?
@attribute_field = ApplicationFormSignupField.add_application_form_signup_field(@application_form, a.last, a.last[:id], field_status) @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} @application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_application_forms_path and return redirect_to admin_application_forms_path and return
elsif @application_form_params[:application_form_submission_fields] elsif @application_form_params[:application_form_submission_fields_attributes]
params[:application_form_main][:application_form_submission_fields].each do |a| params[:application_form_main][:application_form_submission_fields_attributes].each do |a|
@field_name = 'application_form_main' @field_name = 'application_form_main'
field_status = a.last[:id].present? field_status = a.last[:id].present?
@attribute_field = ApplicationFormSubmissionField.add_application_form_signup_field(@application_form, a.last, a.last[:id], field_status) @attribute_field = ApplicationFormSubmissionField.add_application_form_signup_field(@application_form, a.last, a.last[:id], field_status)

View File

@ -117,15 +117,15 @@
<%= t("application_form_signup.#{attr_signup.field_name}") %> <%= t("application_form_signup.#{attr_signup.field_name}") %>
</td> </td>
<td> <td>
<%= 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') %>
</td> </td>
<td> <td>
<%= 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') %>
</td> </td>
<td> <td>
<input type="hidden" class="field_name" name='<%= "application_form_main[application_form_signup_field_sets][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>"> <input type="hidden" class="field_name" name='<%= "application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
<input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_sets][#{signup_index}][disabled]" %>' value="false"> <input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][disabled]" %>' value="false">
<%= 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) %>
</td> </td>
<td style="padding-left: 1em;"> <td style="padding-left: 1em;">
<% if attr_signup.field_name == 'email' %> <% if attr_signup.field_name == 'email' %>
@ -144,9 +144,9 @@
</script> </script>
<% end %> <% end %>
<% if false #attr_signup.field_name != 'recaptcha' %> <% if false #attr_signup.field_name != 'recaptcha' %>
<!-- <input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_sets][#{signup_index}][hidden]" %>' value="false"> --> <!-- <input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][hidden]" %>' value="false"> -->
<%= hidden_field_tag("application_form_main[application_form_signup_field_sets][#{signup_index}][hidden]",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][#{signup_index}][hidden]", true ,attr_signup.hidden) %> <%#= check_box_tag("application_form_main[application_form_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
<% end %> <% end %>
</td> </td>
</tr> </tr>
@ -169,13 +169,13 @@
<%= ApplicationFormSignupField.where(id:attr_custom.application_form_signup_field_id).first.title rescue '' %> <%= ApplicationFormSignupField.where(id:attr_custom.application_form_signup_field_id).first.title rescue '' %>
</td> </td>
<td> <td>
<input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_customs][#{custom_index}][hidden]" %>' value="false"> <input type="hidden" class="field_set" name='<%= "application_form_main[application_form_signup_field_customs_attributes][#{custom_index}][hidden]" %>' value="false">
<%= 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) %>
</td> </td>
<% if !attr_custom.new_record? %> <% if !attr_custom.new_record? %>
<input for="field_0" id="application_form_main_application_form_signup_field_customs_<%= custom_index.to_s %>_id" name="application_form_main[application_form_signup_field_customs][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>"> <input for="field_0" id="application_form_main_application_form_signup_field_customs_<%= custom_index.to_s %>_id" name="application_form_main[application_form_signup_field_customs_attributes][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
<% elsif f.object.copy_id.present? %> <% elsif f.object.copy_id.present? %>
<input name="application_form_main[application_form_signup_field_customs][<%= custom_index.to_s %>][title]" type="hidden" value="<%= attr_custom.application_form_signup_field.title.to_s %>"> <input name="application_form_main[application_form_signup_field_customs_attributes][<%= custom_index.to_s %>][title]" type="hidden" value="<%= attr_custom.application_form_signup_field.title.to_s %>">
<% end %> <% end %>
</tr> </tr>
<% end %> <% end %>
@ -217,8 +217,8 @@
<%= t('application_form.disable') %> <%= t('application_form.disable') %>
</td> </td>
<td> <td>
<input type="hidden" class="field_set" name='<%= "application_form_main[application_form_email_sets][#{index1}][disabled]" %>' value="false"> <input type="hidden" class="field_set" name='<%= "application_form_main[application_form_email_sets_attributes][#{index1}][disabled]" %>' value="false">
<%= 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) %>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -226,7 +226,7 @@
<%= t('application_form.email_title') %> <%= t('application_form.email_title') %>
</td> </td>
<td> <td>
<%= 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') %>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -235,7 +235,7 @@
</td> </td>
<td> <td>
<div class="form-group"> <div class="form-group">
<%= 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') %>
</div> </div>
</td> </td>
</tr> </tr>