From 545b57d6bead13f3edd8a9da487d960495154efd Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Thu, 4 Jul 2019 08:40:41 -0400 Subject: [PATCH] Merge pull request #1939 from overleaf/jel-no-search-results Show message when there are no learn wiki search results GitOrigin-RevId: cb1600baeb4a9860575385be78a825cb3942903a --- services/web/app/views/_mixins/faq_search.pug | 2 ++ services/web/public/src/main/learn.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/services/web/app/views/_mixins/faq_search.pug b/services/web/app/views/_mixins/faq_search.pug index 8229f8a52d..b713209bb4 100644 --- a/services/web/app/views/_mixins/faq_search.pug +++ b/services/web/app/views/_mixins/faq_search.pug @@ -28,3 +28,5 @@ mixin faq_search(headerText, headerClass) a(ng-href='{{hit.url}}',ng-repeat='hit in hits').search-result.card.card-thin span(ng-bind-html='hit.name') div.search-result-content(ng-show="hit.content != ''", ng-bind-html='hit.content') + .row-spaced-small.search-result.card.card-thin(ng-if="!processingSearch && searchQueryText.length > 1 && hits.length === 0") + p #{translate("no_search_results")} \ No newline at end of file diff --git a/services/web/public/src/main/learn.js b/services/web/public/src/main/learn.js index b32f8e4dca..eeb104c427 100644 --- a/services/web/public/src/main/learn.js +++ b/services/web/public/src/main/learn.js @@ -26,6 +26,7 @@ define(['base', 'directives/mathjax', 'services/algolia-search'], function( $scope.hits = [] $scope.hits_total = 0 $scope.config_hits_per_page = 20 + $scope.processingSearch = false $scope.clearSearchText = function() { $scope.searchQueryText = '' @@ -85,6 +86,7 @@ define(['base', 'directives/mathjax', 'services/algolia-search'], function( } $scope.search = function() { + $scope.processingSearch = true const query = $scope.searchQueryText if (query == null || query.length === 0) { updateHits([]) @@ -94,6 +96,7 @@ define(['base', 'directives/mathjax', 'services/algolia-search'], function( return algoliaSearch.searchWiki( query, function(err, response) { + $scope.processingSearch = false if (response.hits.length === 0) { return updateHits([]) } else {