emory-libraries/dlp-selfdeposit

View on GitHub
app/views/catalog/_search_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_tag search_form_action, method: :get, class: "search-form", id: "search-form-header", role: "search" do %>
    <%= render Blacklight::HiddenSearchStateComponent.new(params: search_state.params_for_search.except(:q, :search_field, :qt, :page, :utf8)) %>
    <%= hidden_field_tag :search_field, 'all_fields' %>
    <div class="form-group header-search row">
  
      <div class="input-group header-search col-sm-9">
        <%= text_field_tag :q, current_search_parameters , 'aria-label': 'Search', class: "q form-control", id: "search-field-header", placeholder: t("hyrax.search.form.q.placeholder") %>
  
        <div class="input-group-append">
          <button type="submit" class="btn btn-primary" id="search-submit-header">
            <%= t('hyrax.search.button.html') %>
          </button>
         <% if user_signed_in? %>
            <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
  
              <span class="sr-only" data-search-element="label"><%= t("hyrax.search.form.option.all.label_long", application_name: application_name) %></span>
              <span aria-hidden="true"><%= t("hyrax.search.form.option.all.label_short") %></span>
            </button>
  
            <ul class="dropdown-menu dropdown-menu-right">
              <li class="dropdown-item">
                <%= link_to t("hyrax.search.form.option.all.label_long", application_name: application_name), "#",
                    data: { "search-option" => main_app.search_catalog_path, "search-label" => t("hyrax.search.form.option.all.label_short") } %>
              </li>
              <li class="dropdown-item">
                <%= link_to t("hyrax.search.form.option.my_works.label_long"), "#",
                    data: { "search-option" => hyrax.my_works_path, "search-label" => t("hyrax.search.form.option.my_works.label_short") } %>
              </li>
              <li class="dropdown-item">
                <%= link_to t("hyrax.search.form.option.my_collections.label_long"), "#",
                    data: { "search-option" => hyrax.my_collections_path, "search-label" => t("hyrax.search.form.option.my_collections.label_short") } %>
              </li>
            </ul>
          <% end %>
        </div><!-- /.input-group-btn -->
      </div><!-- /.input-group -->
      
    </div><!-- /.form-group -->
  <% end %>