From ac0ab274fa65c892b3144b4403ec557d257c15e0 Mon Sep 17 00:00:00 2001 From: Fabio Teixeira Date: Mon, 25 May 2015 14:42:06 -0300 Subject: [PATCH] Fix software catalog search bug issue #138 --- public/views/search-software-catalog.js | 5 ++++- views/search/_software_search_form.html.erb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/views/search-software-catalog.js b/public/views/search-software-catalog.js index a9fe121..cb3bd01 100644 --- a/public/views/search-software-catalog.js +++ b/public/views/search-software-catalog.js @@ -134,7 +134,10 @@ modulejs.define('SearchSoftwareCatalog', ['jquery', 'NoosferoRoot', 'SoftwareCat var timer = null; $("#search-input").keyup(function() { - timer = setTimeout(update_page_by_text_filter, 400); + // Only start the search(with ajax) after 3 characters + if(this.value.length >= 3) { + timer = setTimeout(update_page_by_text_filter, 400); + } }).keydown(function() { clearTimeout(timer); }); diff --git a/views/search/_software_search_form.html.erb b/views/search/_software_search_form.html.erb index 7c4f705..8647b88 100644 --- a/views/search/_software_search_form.html.erb +++ b/views/search/_software_search_form.html.erb @@ -11,7 +11,7 @@
- <%= text_field_tag 'query', @query, :id => 'search-input', :size => 50, :placeholder=>_("Type words about the software_info you're looking for") %> + <%= 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)") %> <%= submit_button(:search, _('Filter')) %> -- libgit2 0.21.2