Sha256: 9e4d87c1a1c7e1b8c143f0c96cf2959ae471115858b941b01f566867c3c35752

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 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 %>
  $(<%= "##{search_input_id}".to_json.html_safe %>).next().hide();
  $(<%= "##{search_input_id}".to_json.html_safe %>).delayedObserver(0.5, function() {
     $(<%= "##{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

2 entries across 2 versions & 1 rubygems

Version Path
active_scaffold-3.1.17 frontends/default/views/_search.html.erb
active_scaffold-3.1.15 frontends/default/views/_search.html.erb