CombinedSearch: Format numbers with commas

Add commas to subscriber counts, link scores, and comment counts using
`format_number()`.
This commit is contained in:
Florence Yeun
2015-05-21 12:07:17 -07:00
committed by Matt Lee
parent c927f13dca
commit 6897766c59
2 changed files with 5 additions and 4 deletions

View File

@@ -26,6 +26,7 @@
<%namespace file="link.html" import="thumbnail" />
<%!
from r2.lib.template_helpers import format_number
from r2.lib.pages import WrappedUser
%>
@@ -81,8 +82,8 @@
cname=False,
_class='search-subreddit-link may-blank',
)}&#32;
<span class="search-score">${thing.score} ${ungettext('point', 'points', thing.score)},</span>&#32;
<span class="search-comments">${thing.num_comments} ${ungettext('comment', 'comments', thing.num_comments)},</span>&#32;
<span class="search-score">${format_number(thing.score)} ${ungettext('point', 'points', thing.score)},</span>&#32;
<span class="search-comments">${format_number(thing.num_comments)} ${ungettext('comment', 'comments', thing.num_comments)},</span>&#32;
<span class="search-time">submitted&#32;${thing_timestamp(thing, thing.timesince, include_tense=True)}</span>&#32;
<span class="search-author">by&#32;${WrappedUser(thing.author, thing.attribs, thing)}</span>&#32;
</%parent:search_result_meta>

View File

@@ -26,7 +26,7 @@
<%namespace file="subscribebutton.html" import="subscribe_button" />
<%!
from r2.lib.template_helpers import search_url
from r2.lib.template_helpers import format_number, search_url
from r2.lib.utils import timesince
%>
@@ -61,7 +61,7 @@
_class='search-subreddit-link may-blank',
)}&#32;
%if not thing.score_hidden:
<span class="search-subscribers">${thing._ups} ${ungettext('subscriber', 'subscribers', thing._ups)},</span>&#32;
<span class="search-subscribers">${format_number(thing._ups)} ${ungettext('subscriber', 'subscribers', thing._ups)},</span>&#32;
%endif
<span class="search-time">${_("a community for %(time)s") % dict(time=timesince(thing._date))}</span>&#32;
</%parent:search_result_meta>