Commit ac0ab274fa65c892b3144b4403ec557d257c15e0

Authored by Fabio Teixeira
1 parent a6d9e08e

Fix software catalog search bug issue #138

Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
public/views/search-software-catalog.js
... ... @@ -134,7 +134,10 @@ modulejs.define(&#39;SearchSoftwareCatalog&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SoftwareCat
134 134 var timer = null;
135 135  
136 136 $("#search-input").keyup(function() {
137   - timer = setTimeout(update_page_by_text_filter, 400);
  137 + // Only start the search(with ajax) after 3 characters
  138 + if(this.value.length >= 3) {
  139 + timer = setTimeout(update_page_by_text_filter, 400);
  140 + }
138 141 }).keydown(function() {
139 142 clearTimeout(timer);
140 143 });
... ...
views/search/_software_search_form.html.erb
... ... @@ -11,7 +11,7 @@
11 11  
12 12 <div class="search-field">
13 13 <span class="formfield">
14   - <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software_info you're looking for") %>
  14 + <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software_info you're looking for (the search begins after 3 characters)") %>
15 15 </span>
16 16  
17 17 <%= submit_button(:search, _('Filter')) %>
... ...