documentation/extensions/odoo_theme/layout.html

123 lines
5.7 KiB
HTML

{% extends "basic/layout.html" %}
{% set html5_doctype = True %}
{% block css %}
{{ super() }}
{# Allow custom css style import for specific pages #}
{% if 'custom-css' in meta %}
{% set link = '_static/css/' + meta['custom-css'] %}
<link rel="stylesheet" href="{{ pathto(link, 1) }}" type="text/css"/>
{% endif %}
{% endblock %}
{% block scripts %}
{% if 'custom-js' in meta %}
{# Before the custom files using React & Immutable #}
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"
integrity="sha512-myCdDiGJRYrvRb/VuJ67ljifYTJdc1jdEvL4c4ftX9o3N6EAnmD83c/7l2/91RCINZ7c8w21tiXDT7RDFjdc3g=="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react-with-addons.min.js"
integrity="sha512-wsnDgOxfyn4lhblRMHPMuJh+9CnLcwcisda1zLRGNWKh6OiQynebYTyRZYgH+eWLEdNTKak0OD2GAd/S51UhTw=="
crossorigin="anonymous"></script>
<script src="{{ pathto('_static/js/atom.js', 1) }}"></script>
{% set js_files = meta['custom-js'].split(';') %}
{% for js_file in js_files %}
{% set link = '_static/js/' + js_file %}
<script src="{{ pathto(link, 1) }}"></script>
{% endfor %}
{% endif %}
{# FIXME ANVFEDI Do we really need prefixfree ? It triggers a reload of css files two more times/page #}
<!-- <script src="https://cdn.jsdelivr.net/npm/prefixfree@1.0.0/prefixfree.min.js"
integrity="sha256-a1jYldRqTzpGqk63nmXXjh/zPYp7Sjxp9iUYhNbYPXI="
crossorigin="anonymous"></script> -->
{{ super() }}
{# TODO EDI boostrap beta cdn ??? Isn't there a stable CDN ? It looks like this cdn won't exist forever :D #}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
{% endblock %}
{% block linktags %}
{% for alternate_language, language_code, url in alternate_languages %}
<link rel="alternate" hreflang="{{ language_code }}" href="{{ url }}" />
{%- endfor %}
<link rel="canonical" href="{{ canonical }}" />
{{ super() }}
{% endblock %}
{#
Google analytics key logic.
We do not want to call super here since our custom footer logic is defined in the content block.
#}
{% block footer %}
{%- if google_analytics_key -%}
{% include "layout_templates/google_analytics.html" %}
{%- endif -%}
{% endblock %}
{% block header %}
{# shown when js has properly set all the classes on the toc elements #}
<nav id="o_main_toctree" class="o_side_nav border-end" hidden>
{% include "layout_templates/menu.html" %}
</nav>
<header class="o_main_header border-bottom">
{% include "layout_templates/header.html" %}
</header>
{% endblock %}
{% block content %}
<div id="wrap">
<nav class="navbar navbar-expand-lg navbar-light d-lg-none" aria-label="Toggle OffCanvas">
<button class="navbar-toggler p-0 border-0" type="button" data-bs-toggle="offcanvas" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
{% set main_classes = [] %}
{% if pagename == master_doc %} {# The current page is the homepage #}
{% set main_classes = main_classes + ['index'] %} {# TODO ANVFE should be 'o_index' #}
{% endif %}
{% if 'code-column' in meta %} {# The page contains a 'memento' (side dynamic block) #}
{% set main_classes = main_classes + ['has_code_col'] %} {# TODO ANVFE see #}
{% endif %}
{% if 'classes' in meta %} {# The page source defines custom classes #}
{% set main_classes = main_classes + meta['classes'].split() %}
{% endif %}
{% 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 %}
<main class="container-fluid {{ ' '.join(main_classes) }}">
<div id="o_content">
{% if pagename == master_doc %}
{# Custom landing page on the root of the documentation #}
{% include "layout_templates/homepage.html" %}
{% else %}
<article class="doc-body">
<!-- Beacon used by the Sphinx search to know where to look for a string -->
<div role="main">
{% block body %} {% endblock %}
</div>
{# Do not show the edition link for pages without content #}
{% if github_link and 'has_only_toc' not in meta and pagename != 'search' %}
<a href="{{ github_link(mode='edit') }}" class="o_git_link"><i class="i-edit"></i> Edit on GitHub</a>
{% endif %}
</article>
{% endif %}
</div>
<div id="mask"></div>
</main>
{# VFE TODO Check if this condition is still needed ??? #}
{% if pagename not in toc and 'hide_page_toc' not in meta %}
<aside id="o_page_toc" class="o_page_toc">
{% include "layout_templates/page_toc.html" %}
</aside>
{% endif %}
</div>
<footer>
{% include "layout_templates/footer.html" %}
</footer>
{% endblock %}