Sha256: 758033338067c821270ef07e62f44643bac2024da65edd1c1847204099ec5123

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 KB

Contents

<% live_search = active_scaffold_config.search.live? -%>
<% url_options =  params_for(:action => :index, :escape => false).delete_if{|k,v| k == 'search'} -%>
<%=
options = {:id => search_form_id,
           :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('<%= search_form_id %>');
//]]>
</script>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_scaffold-3.0.5 frontends/default/views/_search.html.erb
active_scaffold-3.0.4 frontends/default/views/_search.html.erb
active_scaffold-3.0.2 frontends/default/views/_search.html.erb
active_scaffold-3.0.1 frontends/default/views/_search.html.erb
active_scaffold-3.0.0 frontends/default/views/_search.html.erb