[IMP] website: make pager post compatible

As we introduced postlinks, some routes are no longer compatible with
GET requests anymore. Some of those routes were using the pager which
only send GET request. In order to make the pager comptabile, we're
addding a way to use postlinks in the pager.

task-2250385

closes odoo/odoo#52475

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
DramixDw
2020-06-05 15:47:06 +00:00
committed by Jeremy Kersten
parent 5411486134
commit f0420013e0
3 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -420,13 +420,13 @@
<template id="pager" name="Pager">
<ul t-if="pager['page_count'] > 1" t-attf-class="#{ classname or '' } pagination m-0 #{_classes}" t-att-style="style or None">
<li t-attf-class="page-item #{'disabled' if pager['page']['num'] == 1 else ''}">
<a t-att-href=" pager['page_previous']['url'] if pager['page']['num'] != 1 else None" class="page-link">Prev</a>
<a t-att-href=" pager['page_previous']['url'] if pager['page']['num'] != 1 else None" t-attf-class="page-link #{extraLinkClass}">Prev</a>
</li>
<t t-foreach="pager['pages']" t-as="page">
<li t-attf-class="page-item #{'active' if page['num'] == pager['page']['num'] else ''}"> <a t-att-href="page['url']" class="page-link" t-raw="page['num']"></a></li>
<li t-attf-class="page-item #{'active' if page['num'] == pager['page']['num'] else ''}"> <a t-att-href="page['url']" t-attf-class="page-link #{extraLinkClass}" t-raw="page['num']"></a></li>
</t>
<li t-attf-class="page-item #{'disabled' if pager['page']['num'] == pager['page_count'] else ''}">
<a t-att-href="pager['page_next']['url'] if pager['page']['num'] != pager['page_count'] else None" class="page-link">Next</a>
<a t-att-href="pager['page_next']['url'] if pager['page']['num'] != pager['page_count'] else None" t-attf-class="page-link #{extraLinkClass}">Next</a>
</li>
</ul>
</template>
+1 -1
View File
@@ -161,7 +161,7 @@ class WebsiteBlog(http.Controller):
# redirect get tag-1,tag-2 -> get tag-1
tags = tag.split(',')
if len(tags) > 1:
url = QueryURL('', ['blog', 'tag'], blog=blog, tag=tags[0], date_begin=date_begin, date_end=date_end)()
url = QueryURL('' if blog else '/blog', ['blog', 'tag'], blog=blog, tag=tags[0], date_begin=date_begin, date_end=date_end)()
return request.redirect(url, code=302)
values = self._prepare_blog_values(blogs=blogs, blog=blog, date_begin=date_begin, date_end=date_end, tags=tag, state=state, page=page)
@@ -97,6 +97,7 @@ list of filtered posts (by date or tag).
<t t-call="website.pager" >
<t t-set="classname" t-valuef="justify-content-center"/>
<t t-set="extraLinkClass" t-valuef="post_link"/>
</t>
</div>
</div>