[IMP] odoo_theme: introduce fallback URLs for the page switchers

When a user clicks on the link of an alternate page in the version or
language switcher, we now check if the page referenced by the target URL
exists or not. If not, we generate a series of fallback URLs from the
target URL and check whether the targeted resource exists or not, until
we read the root of the documentation. As soon as we find a valid URL,
we redirect the user to it.

This is inspired by the behaviour of docs.python.org's version and
language switchers.

task-2534669

closes odoo/documentation#2051

X-original-commit: 25e863a64c
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Martin Trigaux
2022-02-14 13:07:29 +00:00
committed by Antoine Vandevenne (anv)
parent a572e055a8
commit c9d95858b4
3 changed files with 125 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ def setup(app):
app.add_js_file('js/layout.js')
app.add_js_file('js/menu.js')
app.add_js_file('js/page_toc.js')
app.add_js_file('js/switchers.js')
return {
'parallel_read_safe': True,