diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-01-02 12:50:21 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-01-02 12:50:21 +0100 |
commit | 0cca9e26c41a1957b3a574d33b3835ea76c63e13 (patch) | |
tree | b4795ecd6a32dddebcd9e359343579d0ba73ab75 /search | |
parent | 9e3f4e043f6204a336a6efc4a9c39f23723d0522 (diff) | |
download | nextcloud-server-0cca9e26c41a1957b3a574d33b3835ea76c63e13.tar.gz nextcloud-server-0cca9e26c41a1957b3a574d33b3835ea76c63e13.zip |
show no files found message
Diffstat (limited to 'search')
-rw-r--r-- | search/js/search.js | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/search/js/search.js b/search/js/search.js index b090a4ec4a8..8e576e6e8f0 100644 --- a/search/js/search.js +++ b/search/js/search.js @@ -109,7 +109,7 @@ } } // prevent double pages - if ($searchResults && query === lastQuery && page === lastPage&& size === lastSize) { + if ($searchResults && query === lastQuery && page === lastPage && size === lastSize) { return; } lastQuery = query; @@ -153,9 +153,6 @@ } } function showResults(results) { - if (results.length === 0) { - return; - } if (!$searchResults) { $wrapper = $('<div class="searchresults-wrapper"/>'); $('#app-content') @@ -190,9 +187,7 @@ }); $('#app-content').on('scroll', _.bind(onScroll, this)); lastResults = results; - $status = $searchResults.find('#status') - .data('count', results.length) - .text(t('search', '{count} search results in other folders', {count:results.length}, results.length)); + $status = $searchResults.find('#status'); placeStatus(); showResults(results); }); @@ -231,16 +226,11 @@ } if ($row) { $searchResults.find('tbody').append($row); - } else { - // not showing result, decrease counter - var count = $status.data('count') - 1; - if (count < 0) { - count = 0; - } - $status.data('count', count) - .text(t('search', '{count} search results in other places', {count:count}, count)); } }); + var count = $searchResults.find('tr.result').length; + $status.data('count', count) + .text(t('search', '{count} search results in other places', {count:count}, count)); } function renderCurrent() { var result = $searchResults.find('tr.result')[currentResult]; @@ -263,6 +253,7 @@ $wrapper.remove(); $searchResults = false; $wrapper = false; + lastQuery = false; } }; @@ -292,14 +283,14 @@ var query = $searchBox.val(); if (lastQuery !== query) { currentResult = -1; - if(self.hasFilter(getCurrentApp())) { - self.getFilter(getCurrentApp())(query); - } if (query.length > 2) { self.search(query); } else { self.hideResults(); } + if(self.hasFilter(getCurrentApp())) { + self.getFilter(getCurrentApp())(query); + } } } }); |