Sha256: 97c43fe60dd80c7f6e332433aa6a81f9f4ba7d253ef463b541a54a221606640f

Contents?: true

Size: 1.71 KB

Versions: 37

Compression:

Stored size: 1.71 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 => 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

37 entries across 37 versions & 4 rubygems

Version Path
active_scaffold-3.1.14 frontends/default/views/_search.html.erb
active_scaffold-3.0.26 frontends/default/views/_search.html.erb
active_scaffold-3.1.13 frontends/default/views/_search.html.erb
active_scaffold-3.1.12 frontends/default/views/_search.html.erb
active_scaffold-3.0.25 frontends/default/views/_search.html.erb
active_scaffold-3.1.11 frontends/default/views/_search.html.erb
active_scaffold_clarity-3.0.24.2 frontends/default/views/_search.html.erb
active_scaffold-3.1.10 frontends/default/views/_search.html.erb
active_scaffold-3.1.9 frontends/default/views/_search.html.erb
active_scaffold-3.1.8 frontends/default/views/_search.html.erb
active_scaffold-3.1.7 frontends/default/views/_search.html.erb
active_scaffold-3.1.6 frontends/default/views/_search.html.erb
active_scaffold-3.1.5 frontends/default/views/_search.html.erb
active_scaffold-3.0.24 frontends/default/views/_search.html.erb
active_scaffold-3.1.4 frontends/default/views/_search.html.erb
active_scaffold-3.1.3 frontends/default/views/_search.html.erb
active_scaffold-3.0.23 frontends/default/views/_search.html.erb
active_scaffold-3.0.22 frontends/default/views/_search.html.erb
active_scaffold-3.0.21 frontends/default/views/_search.html.erb
active_scaffold_vho-3.0.20 frontends/default/views/_search.html.erb