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

143 lines
6.7 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| %>
<% default_hidden << "seminar_signup_field_set.#{field_set.field_name}" if (field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{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 = SeminarSignupField.where(id:field_set.seminar_signup_field_id).first %>
<% title = s.title rescue '' %>
<% next if title.blank? %>
<% next if s.key.blank? %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% @field_names << "seminar_signup_field_custom.#{s.key}" %>
<% @field_name_translations << (title)%>
<% 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
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| %>
<% default_show << "seminar_signup_field_set.#{field_set.field_name}" if !(field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{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| %>
<% title = s.title rescue '' %>
<% next if title.blank? %>
<% next if s.key.blank? %>
<% @field_names << "seminar_signup_field_custom.#{s.key}" %>
<% @field_name_translations << (title)%>
<% 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 %>
<% if @display_field.blank?
@display_field = default_show
end %>
<% end %>