[FIX] website_blog: display the total number of filtered elements

Steps to reproduce:
- Add the same tag to 13 different blog posts.
- On the "Blog" page, click on this tag to filter the blogs.

-> Problem: the result displays "12 Articles" but they are actually 13.

In this case, the result displays "12 Articles" as they are 12 articles
on the current page. When going on the second page of the results,
"1 Article" is displayed. This problem is solved by displaying the total
number of articles found after the filtering operation rather than the
number of articles on the page.

opw-3802729

closes odoo/odoo#161137

X-original-commit: 4e90dc9096cbcf9f2fe7f251b247c8d62bc0bc5d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
This commit is contained in:
Louis (loco)
2024-04-10 08:17:54 +00:00
parent 4ff88bc7be
commit 9f2a920f2f
@@ -38,11 +38,22 @@ according to the enabled options.
<div t-attf-class="row #{posts and not opt_blog_readable and 'mx-n2'}">
<!-- Filters -->
<div t-if="tag or date_begin or search" class="col-12 mb-3">
<div t-if="posts" class="h4 mb-3">
<t t-esc="search_count"/>
<t t-if="search_count &lt; 2">Article</t>
<t t-else="">Articles</t>
</div>
<!-- TODO: in master, remove the next useless lines. They have
to be kept in the stable versions in case of a potential
customization that would do a 'xpath' on them.-->
<t t-set="posts_save" t-value="posts"/>
<t t-set="posts" t-value="False"/>
<div t-if="posts" class="h4 mb-3">
<t t-esc="len(posts)"/>
<t t-if="len(posts) &lt; 2">Article</t>
<t t-else="">Articles</t>
</div>
<t t-set="posts" t-value="posts_save"/>
<span t-if="search" class="align-items-baseline border d-inline-flex ps-2 rounded mb-2">
<i class="fa fa-search me-2 text-muted"/>
<t t-esc="search"/>