seminar2_old/app/views/admin/seminars/_get_display_fields.html.erb

157 lines
7.5 KiB
Plaintext
Raw Permalink Normal View History

<% @field_names = [] %>
<% @field_name_translations = [] %>
<% default_hidden = [] %>
2021-03-29 14:27:08 +00:00
<%
default_seminar_signup_fields = ["serial_number"]
default_seminar_signup_fields.each do |f|
@field_names << "seminar_signup.#{f}"
@field_name_translations << t("seminar_signup.#{f}")
end
%>
<% if @seminar.present? %>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |field_set| %>
2022-10-22 10:43:36 +00:00
<%
field_name = field_set.field_name
if SeminarMain::ExceptFieldSetDisplays.include?(field_name)
default_hidden << "seminar_signup_field_set.#{field_name}"
next
end
%>
<% default_hidden << "seminar_signup_field_set.#{field_name}" if (field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{field_name}" %>
<% @field_name_translations << field_set.name[I18n.locale] %>
<% end %>
<% else %>
<% ['seminar_signup.name','seminar_signup.tel','seminar.registration_status'].each do |th| %>
<% @field_names << "default.#{th}" %>
<% @field_name_translations << t(th) %>
<% end %>
<% end %>
2022-10-22 10:43:36 +00:00
<% if @seminar.seminar_signup_field_customs.count != 0 %>
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
2022-11-04 04:38:27 +00:00
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
2023-01-11 09:44:40 +00:00
<% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
2023-04-12 03:33:32 +00:00
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |s| %>
2023-01-11 09:44:40 +00:00
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>
<% if @seminar.seminar_submission_field_sets.count != 0 %>
<% show1 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% end %>
<% default_hidden << "seminar_signup_contributes.title" if !show1 %>
<% @field_names << 'seminar_signup_contributes.title' %>
<% @field_name_translations << t('seminar_signup.title') %>
<% default_hidden << "seminar_signup_contributes.file" if !show2 %>
<% @field_names << 'seminar_signup_contributes.file' %>
<% @field_name_translations << t('seminar_signup.file') %>
<% default_hidden << "seminar_signup_contributes.description" if !show3 %>
<% @field_names << 'seminar_signup_contributes.description' %>
<% @field_name_translations << t('seminar_signup.description') %>
2023-04-12 03:33:32 +00:00
<% @seminar.seminar_submission_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |s| %>
<% @field_names << "seminar_submission_fields.#{s.key}" %>
<% if s.markup != "seminar_preferred_session"
@field_name_translations << s.title
else
@field_name_translations << t("seminar.assigned_session")
end %>
<% end %>
<% @display_field = @seminar_signup_admin_setting.display_field rescue [] %>
<% if @display_field.blank?
@display_field = @field_names - default_hidden
2022-10-22 10:43:36 +00:00
else
@display_field = @display_field - SeminarMain::ExceptFieldSetDisplays.map{|f| "seminar_signup_field_set.#{f}"}
end %>
<% if @enable_review_result
@field_names.insert(1,"seminar_review_result.review")
@field_name_translations.insert(1,t("seminar.review"))
@display_field.insert(1,"seminar_review_result.review")
@field_names << "seminar_review_result.abstract_number"
@field_name_translations << t("helpers.label.seminar_review_result.abstract_number")
@display_field << "seminar_review_result.abstract_number"
@field_names << "seminar_review_result.presentation_type"
@field_name_translations << t("helpers.label.seminar_review_result.presentation_type")
@display_field << "seminar_review_result.presentation_type"
end%>
<% else %>
<% @field_names = [] %>
<% @field_name_translations = [] %>
<% default_show = [] %>
<% seminar_signup_field_sets = SeminarSignupFieldSet.all.uniq{|s| s.field_name} %>
<% if seminar_signup_field_sets.count != 0 %>
<% seminar_signup_field_sets.each do |field_set| %>
2022-10-22 10:43:36 +00:00
<%
field_name = field_set.field_name
next if SeminarMain::ExceptFieldSetDisplays.include?(field_name)
%>
<% default_show << "seminar_signup_field_set.#{field_name}" if !(field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{field_name}" %>
<% @field_name_translations << field_set.name[I18n.locale] %>
<% end %>
<% else %>
<% ['seminar_signup.name','seminar_signup.tel','seminar.registration_status'].each do |th| %>
<% @field_names << "default.#{th}" %>
<% @field_name_translations << t(th) %>
<% end %>
<% end %>
2023-04-12 03:33:32 +00:00
<% seminar_signup_fields = SeminarSignupField.where(:key.nin=>["", nil], :disabled=>false).asc(:seminar_main_id, :sort_number, :_id).uniq{|s| s.key} %>
2023-01-11 09:44:40 +00:00
<% seminar_signup_field_customs = SeminarSignupFieldCustom.where(:seminar_signup_field_id.in=> seminar_signup_fields.map(&:id)).to_a %>
2022-10-22 10:43:36 +00:00
<% if seminar_signup_field_customs.count != 0 %>
2023-01-11 09:44:40 +00:00
<% seminar_signup_field_customs.each do |field_set| %>
2022-11-04 04:38:27 +00:00
<% s = field_set.seminar_signup_field %>
2023-01-11 09:44:40 +00:00
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
<% seminar_signup_fields.each do |s| %>
2023-01-11 09:44:40 +00:00
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>
<% show1 = true
show2 = true
show3 = true
%>
<% default_show << "seminar_signup_contributes.title" if show1 %>
<% @field_names << 'seminar_signup_contributes.title' %>
<% @field_name_translations << t('seminar_signup.title') %>
<% default_show << "seminar_signup_contributes.file" if show2 %>
<% @field_names << 'seminar_signup_contributes.file' %>
<% @field_name_translations << t('seminar_signup.file') %>
<% default_show << "seminar_signup_contributes.description" if show3 %>
<% @field_names << 'seminar_signup_contributes.description' %>
<% @field_name_translations << t('seminar_signup.description') %>
2023-04-12 03:33:32 +00:00
<% seminar_submission_fields = SeminarSubmissionField.where(:key.nin=>["", nil], :disabled=>false).asc(:seminar_main_id, :sort_number, :_id).uniq{|s| s.key} %>
<% seminar_submission_fields.each do |s| %>
2023-01-11 09:44:40 +00:00
<% next if s.title.blank? %>
<% @field_names << "seminar_submission_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>
<% @display_field = @seminar_signup_admin_setting.display_field %>
2021-11-30 01:57:52 +00:00
<% @display_field.delete("seminar_signup_field_set.password") %>
<% if @display_field.blank?
2022-10-22 10:43:36 +00:00
@display_field = default_show - default_hidden
else
@display_field = @display_field - SeminarMain::ExceptFieldSetDisplays.map{|f| "seminar_signup_field_set.#{f}"}
end %>
<% end %>