Merge pull request #1939 from overleaf/jel-no-search-results

Show message when there are no learn wiki search results

GitOrigin-RevId: cb1600baeb4a9860575385be78a825cb3942903a
This commit is contained in:
Eric Mc Sween 2019-07-04 08:40:41 -04:00 committed by sharelatex
parent a31090daab
commit 545b57d6be
2 changed files with 5 additions and 0 deletions

View file

@ -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")}

View file

@ -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 {