From c2ace9a0a043d4fd49c7a21a6a09b36711b31d89 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 27 Jun 2016 10:21:36 +0100 Subject: [PATCH] Restrict # of hits returned; clear results on empty search string. --- services/web/public/coffee/main/contact-us.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/public/coffee/main/contact-us.coffee b/services/web/public/coffee/main/contact-us.coffee index 60441d0282..6f9ca36266 100644 --- a/services/web/public/coffee/main/contact-us.coffee +++ b/services/web/public/coffee/main/contact-us.coffee @@ -29,7 +29,7 @@ define [ $scope.sending = false $scope.suggestions = []; - _handleSearchResults = (success, results) -> + _handleSearchResults = (success, results) -> suggestions = for hit in results.hits page_underscored = hit.pageName.replace(/\s/g,'_') section_underscored = hit.sectionName.replace(/\s/g,'_') @@ -64,9 +64,9 @@ define [ $scope.$watch "form.subject", (newVal, oldVal) -> if newVal and newVal != oldVal - algoliaSearch.searchWiki newVal, _handleSearchResults - - $scope.$watch "suggestions", (newVal) -> console.log newVal + algoliaSearch.searchWiki newVal, _handleSearchResults, { hitsPerPage: 3 } + else + $scope.suggestions = []; $scope.close = () -> $modalInstance.close()