psu-libraries/psulib_blacklight

View on GitHub
app/components/blacklight/advanced_search_form_component.html.erb

Summary

Maintainability
Test Coverage
<%= form_tag @url, method: @method, class: @classes.join(' '), role: 'search', 'aria-label' => t('blacklight.search.form.submit') do %>

  <h1 class="advanced page-header">
    <%= t('blacklight_advanced_search.form.title') %>

    <span class="submit-buttons-top">
      <%= button_tag t('blacklight_advanced_search.form.start_over'), type: 'reset', class: 'btn btn-secondary pull-right advanced-search-start-over' %>
      <%= submit_tag t('blacklight_advanced_search.form.search_btn'), class: 'btn btn-primary advanced-search-submit', id: 'advanced-search-submit-top' %>
    </span>
  </h1>

  <div class="input-criteria">
    <div class="query-criteria mb-4">
      <h3 class="query-criteria-heading">
        <%= t('blacklight_advanced_search.form.query_criteria_heading_html', select_menu: default_operator_menu) %>
      </h3>

      <div id="advanced_search">
        <% search_field_controls.each do |control| %>
            <%= control %>
        <% end %>
      </div>
    </div>

    <% if search_filter_controls? %>
      <div class="limit-criteria mb-4">
        <h2 class="limit-criteria-heading h3"><%= t('blacklight.advanced_search.form.limit_criteria_heading_html') %></h2>

        <div id="advanced_search_facets" class="limit_input row">
          <div class="advanced-facet-limits panel-group col-md-9 offset-md-3">
            <% search_filter_controls.each do |control| %>
              <%= control %>
            <% end %>
          </div>
        </div>
      </div>
    <% end %>
  </div>

  <%# Publication Date is a range input %>
<% pub_date = helpers.facet_configuration_for_field('pub_date_itsi') %>
<div class="form-group advanced-search-facet row">
  <%= label_tag pub_date.field.parameterize, class: 'col-sm-4 control-label' do %>
    <%= pub_date.label %>
  <% end %>
  <div class="col-sm-8 range_limit">
    <label for="range_pub_date_start_sort_begin" class="sr-only">Publication date range (starting year)</label>
    <%= number_field_tag('range[pub_date_itsi][begin]', nil, maxlength: 6, class: 'form-control text-center range_begin') %> –
    <label for="range_pub_date_start_sort_end" class="sr-only">Publication date range (ending year)</label>
    <%= number_field_tag('range[pub_date_itsi][end]', nil, maxlength: 6, class: 'form-control text-center range_end') %>
  </div>
</div>

   <div class="sort-submit-buttons clearfix">
    <%= render 'advanced_search_submit_btns' %>
  </div>

<% end %>