added fix for edit page

This commit is contained in:
rulingcom 2024-04-02 21:51:42 +08:00
parent 06d09747b6
commit b0116e3d5a
1 changed files with 11 additions and 8 deletions

View File

@ -224,10 +224,10 @@
%> %>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %> <% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 5) %> <% if(idx == 6) %>
<div id="optional"> <div id="optional">
<% end %> <% end %>
<% if(idx % 5 == 0) && idx != 0 %> <% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %> <% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %> <% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>"> <div id="group<%= group %>">
@ -241,11 +241,11 @@
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %> <%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div> </div>
<% if(counter % 5 == 0) && idx != 4 %> <% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %> <% counter = 0 %>
</div> </div>
<% end %> <% end %>
<% if(idx == 25) %> <% if(idx == 30) %>
<div id="optional"> <div id="optional">
<% end %> <% end %>
<% @form_index = @form_index +1 %> <% @form_index = @form_index +1 %>
@ -452,10 +452,13 @@
// $("#seminar_signup_values_3_value").removeAttr("placeholder"); // $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length; let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group){ function showGroup($group, init){
$group.show(); $group.show();
$group.find('.fake-clean-file').remove(); $group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true); $group.find('input,textarea').attr("required", true);
if(init){
$group.find('input.tick').attr("checked", true);
}
} }
function hideGroup($group){ function hideGroup($group){
@ -469,11 +472,11 @@
if (currentGroup > 1){ if (currentGroup > 1){
$("#remove-member").show(); $("#remove-member").show();
for (var i = 1; i < currentGroup; i++){ for (var i = 1; i <= currentGroup; i++){
showGroup($("#group" + i)); showGroup($("#group" + i), true);
} }
} }
$("input.first-tick").attr("checked",true);
$("#add-member").on("click",function () { $("#add-member").on("click",function () {
if(currentGroup < 5){ if(currentGroup < 5){
$("#remove-member").show(); $("#remove-member").show();