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

153 lines
7.2 KiB
Plaintext

<% @field_names = [] %>
<% @field_name_translations = [] %>
<% default_hidden = [] %>
<%
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| %>
<%
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 %>
<% if @seminar.seminar_signup_field_customs.count != 0 %>
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
<% @seminar.seminar_signup_fields.each do |s| %>
<% 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') %>
<% @seminar.seminar_submission_fields.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
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| %>
<%
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 %>
<% seminar_signup_field_customs = SeminarSignupFieldCustom.all.map{|field_set| SeminarSignupField.where(id: field_set.seminar_signup_field_id).first}.select{|s| !s.nil?}.uniq{|s| s.key } %>
<% if seminar_signup_field_customs.count != 0 %>
<% seminar_signup_field_customs.each do |s| %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
<% seminar_signup_fields = SeminarSignupField.all.uniq{|s| s.key} %>
<% seminar_signup_fields.each do |s| %>
<% @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') %>
<% seminar_submission_fields = SeminarSignupField.all.uniq{|s| s.key} %>
<% seminar_submission_fields.each do |s| %>
<% @field_names << "seminar_submission_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>
<% @display_field = @seminar_signup_admin_setting.display_field %>
<% @display_field.delete("seminar_signup_field_set.password") %>
<% if @display_field.blank?
@display_field = default_show - default_hidden
else
@display_field = @display_field - SeminarMain::ExceptFieldSetDisplays.map{|f| "seminar_signup_field_set.#{f}"}
end %>
<% end %>