diff --git a/client/application.js b/client/application.js index d616660..47e6b0d 100644 --- a/client/application.js +++ b/client/application.js @@ -27,7 +27,7 @@ } function onSearch() { - var keywords = $('#keywords').val() || []; + var keywords = $('#keywordsToSearch').val() || []; var searchParams = {}; for (var i = 0, count = keywords.length; i < count; ++i) { @@ -91,8 +91,6 @@ } function outputResults(results, count) { - $('#results').empty(); - var searchResultCnt = String(results.length); if (results.length < count) { searchResultCnt += ' of ' + count; @@ -100,6 +98,7 @@ $('#count').text(searchResultCnt); var template = Handlebars.compile($('#template').html()); + $('#results').empty(); $('#results').append(template({'results': results})); } @@ -113,18 +112,16 @@ }, ready: function() { - $('#keywords').selectpicker(); + $('#keywordsToSearch').selectpicker(); $.getJSON('/node/getKeywords', function(keywords) { for (var i = 0, count = keywords.length; i < count; ++i) { - $('#keywords').append($('', { + $('#keywordsToSearch').append($('', { value: keywords[i], text: keywords[i] })); } - $('#search').click(onSearch); - $('#learnDialog').on('show.bs.modal', function() { $('#learnKeyword').prop('disabled', true); $('#keywordToLearn').val(''); @@ -136,9 +133,10 @@ $('#learnKeyword').prop('disabled', !$(this).val()); }); - $('#keywords').selectpicker('refresh'); - $('#keywords').change(function() { - $('#search').prop('disabled', !$(this).val()); + $('#searchKeywords').click(onSearch); + $('#keywordsToSearch').selectpicker('refresh'); + $('#keywordsToSearch').change(function() { + $('#searchKeywords').prop('disabled', !$(this).val()); }); }); } diff --git a/client/index.html b/client/index.html index 201723f..46ea76c 100644 --- a/client/index.html +++ b/client/index.html @@ -17,9 +17,9 @@