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' %> <%= f.search_field :query, autofocus: true, style: 'width:300px' %> <%= f.label :type, 'in' %> <%= f.select :type, search_types, {}, {tabindex: -1, style: 'width: 150px'} %> <%= 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