<%= bootstrap_form_for current_exhibit, url: spotlight.exhibit_translations_path(current_exhibit), layout: :horizontal do |f| %> <% # Add hidden fields for the language and tab so the redirect knows how to come back here %> <%= hidden_field_tag :language, @language %> <%= hidden_field_tag :tab, 'search_fields' %>

<%= t('.field_based_search_fields.label') %>

<% current_exhibit.blacklight_config.search_fields.select { |_, config| config.if }.each do |key, search_config| %> <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "blacklight.search.fields.search.#{key}", locale: @language) %> <%= f.fields_for :translations, translation do |translation_fields| %> <%= translation_fields.hidden_field :key %> <%= translation_fields.hidden_field :locale %>
<%= translation_fields.label :value, t("spotlight.search.fields.search.#{key}", locale: I18n.default_locale), class: 'col-form-label col-12 col-sm-2' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> <%= search_config.label %>
<% if translation.value.present? %> <%= blacklight_icon('check', classes: 'translation-complete') %> <% end %>
<% end %> <% end %>

<%= t('.facet_fields.label') %>

<% current_exhibit.blacklight_config.facet_fields.each do |key, facet_config| %> <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "blacklight.search.fields.facet.#{key}", locale: @language) %> <%= f.fields_for :translations, translation do |translation_fields| %> <%= translation_fields.hidden_field :key %> <%= translation_fields.hidden_field :locale %>
<%= translation_fields.label :value, t("spotlight.search.fields.facet.#{key}", locale: I18n.default_locale), class: 'col-form-label col-12 col-sm-2' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> <%= facet_config.label %>
<% if translation.value.present? %> <%= blacklight_icon('check', classes: 'translation-complete') %> <% end %>
<% end %> <% end %>

<%= t('.sort_fields.label') %>

<% current_exhibit.blacklight_config.sort_fields.each do |key, sort_config| %> <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "blacklight.search.fields.sort.#{key}", locale: @language) %> <%= f.fields_for :translations, translation do |translation_fields| %> <%= translation_fields.hidden_field :key %> <%= translation_fields.hidden_field :locale %>
<%= translation_fields.label :value, t("spotlight.search.fields.sort.#{key}", locale: I18n.default_locale), class: 'col-form-label col-12 col-sm-2' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> <%= sort_config.label %>
<% if translation.value.present? %> <%= blacklight_icon('check', classes: 'translation-complete') %> <% end %>
<% end %> <% end %>
<%= f.submit nil, class: 'btn btn-primary' %>
<% end %>