Commit ca19bf6a638809a75400f6da8fe0d3d4002d8975

Authored by Rodrigo Souto
1 parent 118b8590

[search-improvements] Submit search when autocomplete option is selected

Showing 1 changed file with 4 additions and 0 deletions   Show diff stats
public/javascripts/application.js
@@ -1107,6 +1107,10 @@ jQuery(document).ready(function(){ @@ -1107,6 +1107,10 @@ jQuery(document).ready(function(){
1107 var suggestions_cache = {}; 1107 var suggestions_cache = {};
1108 $("#search-input").autocomplete({ 1108 $("#search-input").autocomplete({
1109 minLength: 2, 1109 minLength: 2,
  1110 + select: function(event, ui){
  1111 + $(this).val(ui.item.value);
  1112 + $(this).closest('form').submit();
  1113 + },
1110 source: function(request, response) { 1114 source: function(request, response) {
1111 var term = request.term; 1115 var term = request.term;
1112 if (term in suggestions_cache) { 1116 if (term in suggestions_cache) {