Sha256: cde6311d1eaa97f00413816dd670f5241deb93c9f0d34f5b7a395ea5a04bd823

Contents?: true

Size: 1.31 KB

Versions: 17

Compression:

Stored size: 1.31 KB

Contents

<%
  # Clients of this partial can override the following variables:
  search_action_path ||= nil
  search_results_partial ||= nil
  method ||= :get
  remote ||= false
  form_html ||=  {id: 'search-form', class: 'form-inline'}
  search_types ||= ['Any', 'Username', 'Name', 'First Name', 'Last Name', 'Email']
%>

<%= lev_form_for :search,
                 url: search_action_path,
                 remote: remote,
                 method: method,
                 html: form_html do |f| %>

  <div class="form-group">
    <%= f.label :query, 'Search for' %>&nbsp;
    <%= f.search_field :query, autofocus: true, style: 'width:300px' %>&nbsp;
    <%= f.label :type, 'in' %>&nbsp;
    <%= f.select :type, search_types, {}, {tabindex: -1, style: 'width: 150px'} %>&nbsp;

    <%= f.submit 'Search', tabindex: -1, class: 'btn btn-primary' %>
  </div>

<% end %>

<div id="search-results">
  <% unless search_results_partial.blank? %>
    <%= render partial: search_results_partial %>
  <% end %>
</div>

<script>
  var input = $('input[name="search[query]"]');
  var form  = $("#search-form");
  input.keyup(function(){
    var results = $('#search-results-list');
    results.addClass('loading');
    $.get(form.attr("action"), form.serialize(), null, 'script').then(function(){
      results.removeClass('loading');
    });
  })
</script>

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
openstax_accounts-9.9.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.8.1 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.8.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.7.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.6.1 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.6.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.5.1 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.5.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.4.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.3.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.0.5 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.0.4 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.2.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.0.3 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.1.0 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.0.2 app/views/openstax/accounts/shared/accounts/_search.html.erb
openstax_accounts-9.0.1 app/views/openstax/accounts/shared/accounts/_search.html.erb