UX: show '{count}+' when not sure about exact search count

This commit is contained in:
Arpit Jalan 2017-12-26 19:42:00 +05:30
parent 27a368bb70
commit 89d1107f81
3 changed files with 8 additions and 2 deletions

View File

@ -151,6 +151,12 @@ export default Ember.Controller.extend({
this.set("application.showFooter", !this.get("loading"));
},
@computed('resultCount', 'noSortQ')
resultCountLabel(count, term) {
const plus = (count % 50 === 0 ? "+" : "");
return I18n.t('search.result_count', {count, plus, term});
},
@observes('model.posts.length')
resultCountChanged() {
this.set("resultCount", this.get("model.posts.length"));

View File

@ -51,7 +51,7 @@
<div class='search-title clearfix'>
<div class='result-count'>
<span>
{{{i18n "search.result_count" count=resultCount term=noSortQ}}}
{{{resultCountLabel}}}
</span>
</div>
<div class='sort-by'>

View File

@ -1381,7 +1381,7 @@ en:
too_short: "Your search term is too short."
result_count:
one: "1 result for <span class='term'>{{term}}</span>"
other: "{{count}} results for <span class='term'>{{term}}</span>"
other: "{{count}}{{plus}} results for <span class='term'>{{term}}</span>"
title: "search topics, posts, users, or categories"
no_results: "No results found."
no_more_results: "No more results found."