From 4d88ff77f134f75afb0cf1d5282828b404a56574 Mon Sep 17 00:00:00 2001 From: kencx Date: Fri, 16 Jun 2023 22:00:49 +0800 Subject: [PATCH] Display num of results when searching/filtering tags --- tildes/tildes/templates/search.jinja2 | 3 ++- tildes/tildes/templates/topic_listing.jinja2 | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tildes/tildes/templates/search.jinja2 b/tildes/tildes/templates/search.jinja2 index 721b0f9..528be15 100644 --- a/tildes/tildes/templates/search.jinja2 +++ b/tildes/tildes/templates/search.jinja2 @@ -5,6 +5,7 @@ {% from 'macros/forms.jinja2' import search_form %} {% from 'macros/links.jinja2' import link_to_group with context %} +{% from 'macros/utils.jinja2' import pluralize %} {% block title %}Search results: {{ search }}{% endblock %} @@ -29,7 +30,7 @@ {% block sidebar %} {{ search_form(search, group) }} -

Search results

+

Found {{ pluralize(topics|length, "result") }}

Back to home page

diff --git a/tildes/tildes/templates/topic_listing.jinja2 b/tildes/tildes/templates/topic_listing.jinja2 index 5d0a1c0..94b5d38 100644 --- a/tildes/tildes/templates/topic_listing.jinja2 +++ b/tildes/tildes/templates/topic_listing.jinja2 @@ -104,7 +104,8 @@
{% if tag %} {% if is_single_group %} - Showing only topics in {{ link_to_group(group) }} with the tag "{{ tag|replace('_', ' ') }}". + Showing only topics in {{ link_to_group(group) }} with the tag "{{ tag|replace('_', ' ') }}" ({{ topics|length }} total). +

{{ pluralize(topic.num_comments, "comment") }}

Back to normal view / {% if request.user %} @@ -114,7 +115,7 @@ {% endif %} {% else %} - Showing only topics with the tag "{{ tag|replace('_', ' ') }}". + Showing only topics with the tag "{{ tag|replace('_', ' ') }}" ({{ topics|length }} total). Back to normal view {% endif %}