<%= bootstrap_form_for current_exhibit, url: spotlight.exhibit_translations_path(current_exhibit), layout: :horizontal do |f| %> <% # Add a hidden field for the language so the redirect knows how to come back here %> <%= hidden_field_tag :language, @language %> <%= hidden_field_tag :tab, 'metadata', id: nil %> <% non_custom_metadata_fields.each do |key, field_config| %> <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "blacklight.search.fields.#{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.#{key}", default: field_config.label, locale: I18n.default_locale), class: 'col-form-label col-12 col-sm-2' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> <%= field_config.label %>
<% if translation.value.present? %> <%= blacklight_icon('check', classes: 'translation-complete') %> <% end %>
<% end %> <% end %> <% if current_exhibit.custom_fields.any? %>

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

<% current_exhibit.custom_fields.each do |custom_field| %> <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "blacklight.search.fields.#{custom_field.field}", 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.#{custom_field.field}", default: custom_field.configuration['label'], locale: I18n.default_locale), class: 'col-form-label col-12 col-sm-2' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> <%= custom_field.configuration['label'] %>
<% if translation.value.present? %> <%= blacklight_icon('check', classes: 'translation-complete') %> <% end %>
<% end %> <% end %>
<% end %>
<%= f.submit nil, class: 'btn btn-primary' %>
<% end %>