<%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, role: 'search', **@form_options do |f| %> <%= render Blacklight::HiddenSearchStateComponent.new(params: @params) %> <% if search_fields.length > 1 %> <%= f.label :search_field, scoped_t('search_field.label'), class: 'sr-only visually-hidden' %> <% end %> <% before_input_groups.each do |input_group| %> <%= input_group %> <% end %>
<%= prepend %> <% if search_fields.length > 1 %> <%= f.select(:search_field, options_for_select(search_fields, h(@search_field)), {}, title: scoped_t('search_field.title'), class: "custom-select form-select search-field") %> <% elsif search_fields.length == 1 %> <%= f.hidden_field :search_field, value: search_fields.first.last %> <% end %> <%= f.label @query_param, scoped_t('search.label'), class: 'sr-only visually-hidden' %> <% if autocomplete_path.present? %> <%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label'), autocomplete: 'list', controls: 'autocomplete-popup' } %> <% else %> <%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", autofocus: @autofocus, aria: { label: scoped_t('search.label') } %> <% end %> <%= append %> <%= search_button || render(Blacklight::SearchButtonComponent.new(id: "#{@prefix}search", text: scoped_t('submit'))) %>
<% end %> <% if advanced_search_enabled? %> <%= link_to t('blacklight.advanced_search.more_options'), @advanced_search_url, class: 'advanced_search btn btn-secondary'%> <% end %>