From d2d3c3d8b7d9b51e1f313ceeff6f453e0de5bc83 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Mon, 15 Mar 2021 16:05:29 +0100 Subject: [PATCH] [IMP] legal page display --- conf.py | 6 ++++-- content/services/legal.rst | 5 ++++- extensions/odoo_theme/layout.html | 8 +++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/conf.py b/conf.py index 0a397f26b..251de83f7 100644 --- a/conf.py +++ b/conf.py @@ -333,7 +333,7 @@ def _generate_alternate_urls(app, pagename, templatename, context, doctree): def tag_toctrees(app, doctree, docname): - """Add a 'is-toc-page' metadata entry to all documents containing only a toctree node""" + """Add a 'has_only_toc' metadata entry to all documents containing only a toctree node""" # document # section # title @@ -348,4 +348,6 @@ def tag_toctrees(app, doctree, docname): if 'toctree-wrapper' not in compound['classes']: return - app.env.metadata[docname]['has_only_toc'] = True + if 'show_content' not in app.env.metadata[docname]: + # If page contains custom content: we have to show github link and local toc + app.env.metadata[docname]['has_only_toc'] = True diff --git a/content/services/legal.rst b/content/services/legal.rst index 700fa6ac3..7e51863a1 100644 --- a/content/services/legal.rst +++ b/content/services/legal.rst @@ -1,7 +1,10 @@ :custom-css: legal.css +:show_content: +:hide_page_toc: -.. ^^: cheat to have a full-width table as if this was a real toc page +.. show_content makes Legal clickable on the global ToC +.. hide_page_toc hides the local page toc and widens the body place on the page ===== Legal diff --git a/extensions/odoo_theme/layout.html b/extensions/odoo_theme/layout.html index 635120269..8c79bfb64 100644 --- a/extensions/odoo_theme/layout.html +++ b/extensions/odoo_theme/layout.html @@ -79,8 +79,10 @@ {% set main_classes = main_classes + meta['classes'].split() %} {% endif %} - {% if 'has_only_toc' in meta %} {# The page only contains a toctree #} - {% set main_classes = main_classes + ['doc-toc'] %} {# TODO EDI do you use this ?#} + {% if 'has_only_toc' in meta or 'hide_page_toc' in meta %} + {# The page only contains a toctree or the page toc is hidden #} + {# TODO EDI rename doc-toc class to sthg more meaningful explaining the result (body taking full page) #} + {% set main_classes = main_classes + ['doc-toc'] %} {# Increase body width, taking the place of the page toc #} {% endif %}
@@ -104,7 +106,7 @@
{# VFE TODO Check if this condition is still needed ??? #} - {% if pagename not in toc %} + {% if pagename not in toc and 'hide_page_toc' not in meta %}