<%= 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, 'browse' %>
<%= t :'spotlight.exhibits.translations.browse_categories.default_language_column_label' %>
<%= t :'spotlight.exhibits.translations.browse_categories.translation_column_label', language: t("locales.#{@language}") %>
<% current_exhibit.searches.each do |search| %> <% title_translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{search.slug}.title", locale: @language) %> <%= f.fields_for :translations, title_translation do |translation_fields| %> <%= translation_fields.hidden_field :key %> <%= translation_fields.hidden_field :locale %>
<%= translation_fields.label :value, search[:title], class: 'control-label col-xs-4' %>
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
<% if title_translation.value.present? %> <% end %>
<% end %> <% description_translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{search.slug}.long_description", locale: @language) %>
<%= f.fields_for :translations, description_translation do |translation_fields| %> <%= button_tag 'type' => 'button', class: 'btn btn-text collapsed tanslation-description-toggle', 'data-toggle': 'collapse', 'data-target': "#browse_category_description_#{search.id}", 'aria-expanded': 'false', 'aria-controls': "#browse_category_description_#{search.id}" do %> <%= translation_fields.label :value, t(:'spotlight.exhibits.translations.browse_categories.description_label') %> <% end %> <%= translation_fields.hidden_field :key %> <%= translation_fields.hidden_field :locale %>
<%= translation_fields.text_area_without_bootstrap :value, class: 'form-control' %>

<%= search[:long_description] %>

<% end %>
<% if description_translation.value.present? %> <% end %>
<% end %>
<%= f.submit nil, class: 'btn btn-primary' %>
<% end %>