Sha256: daba1d53bc7b2969e233b1c6f8ec9d167030cd9022d6268dff625d8ab81ec23d

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

<% live_search = active_scaffold_config.search.live? -%>
<% url_options =  params_for(:action => :index).delete_if{|k,v| k == 'search'} -%>
<%=
options = {:id => element_form_id(:action => 'search'),
           :class => "as_form search",
           :remote => true,
           :method => :get}
options['data-loading'] = true unless live_search
  form_tag url_options, options %>
  <%= text_field_tag :search, search_params, :class => 'text-input', :id => search_input_id, :size => 50, :autocomplete => :off %>
  <%= submit_tag as_(:search), :class => "submit" %>
  <%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true %>
  <%= loading_indicator_tag(:action => :search) %>
</form>

<script type="text/javascript">
//<![CDATA[
<% if ActiveScaffold.js_framework == :prototype %>
  new TextFieldWithExample('<%= search_input_id %>', '<%= as_(live_search ? :live_search : :search_terms) %>', {focus: true});
<% end -%>
<% if live_search && ActiveScaffold.js_framework == :prototype -%>
  $(<%= search_input_id.to_json.html_safe %>).next().hide();
  new Form.Element.DelayedObserver('<%= search_input_id %>', 0.5, function(element, value) {
    if (!$(element.id)) return false; // because the element may have been destroyed
    $(element).next().click();
  });
<% elsif live_search && ActiveScaffold.js_framework == :jquery %>
  jQuery(<%= "##{search_input_id}".to_json.html_safe %>).next().hide();
  jQuery(<%= "##{search_input_id}".to_json.html_safe %>).delayedObserver(0.5, function() {
     jQuery(<%= "##{search_input_id}".to_json.html_safe %>).parent().trigger("submit");});
<% end -%>
ActiveScaffold.focus_first_element_of_form('<%= element_form_id(:action => 'search') %>');
//]]>
</script>

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_scaffold-sequel-0.3.0 frontends/default/views/_search.html.erb
active_scaffold-3.2.0 frontends/default/views/_search.html.erb
active_scaffold-3.1.20 frontends/default/views/_search.html.erb
active_scaffold-3.1.19 frontends/default/views/_search.html.erb
active_scaffold-3.1.18 frontends/default/views/_search.html.erb