Sha256: 6b16025161bc2462b1dd63bf90799fe9422c912d34e17c8e4ba552bf27f6253e

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

<%
  base_class = "search-bar".freeze

  # Data
  @taxons = @taxon && @taxon.parent ? @taxon.parent.children : Spree::Taxon.roots
  options = [[t('spree.all_departments'), '']] + @taxons.map {|t| [t.name, t.id]}
  selected = @taxon ? @taxon.id : params[:taxon]

  # Classes
  class_names = [base_class]
  class_names = class_names.join(" ")
%>

<%= form_tag spree.products_path, class: class_names, method: :get do %>
  <% cache [I18n.locale, @taxons] do %>
    <%= select_tag(
      :taxon,
      options_for_select(options, selected),
      class: "#{base_class}__select"
    ) %>
  <% end %>

  <input
    name="keywords"
    placeholder="Hoodie, mug, shirt..."
    type="search"
    class="<%= "#{base_class}__input" %>"
  >

  <button
    type="submit"
    class="<%= "#{base_class}__button" %>"
  >
    Search
  </button>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_starter_frontend-0.1.0 app/views/spree/components/search/_search_bar.html.erb