view default/base/base.html @ 61:f76ec90e0e1e

base: menus handling, first draft: this is a very basic way to handle menu (big buttons on the top), just a first draft to be able to navigate.
author Goffi <goffi@goffi.org>
date Sat, 11 Nov 2017 00:16:35 +0100
parents 37fd11d71233
children 9834106678da
line wrap: on
line source

{% set embedded = True %} {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #}
{{ script.include('css') }} {# css.js is a common script, so it's useful to import it here #}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />

    {% if norobots %}
        <meta name="robots" content="noindex, nofollow">
    {% endif %}

    <title>{% block title %}{{C.APP_NAME}}{% endblock %}</title>

    {% if css_content is defined %}
        <style type="text/css">
            {{css_content}}
        </style>
    {% else %}
        {% for css_file in css_files %}
            <link rel='stylesheet' type="text/css" href='{{root_path}}{{css_file}}'>
        {% endfor %}
    {% endif %}

    {% if background_image is defined %}
        {# Q&D workaround to implement dynamic background-image
           it should be replaced by a better mechanism in the future, avoid using it #}
        <style type="text/css">
            html {
                background-image: url('{{background_image}}');
                background-size: 15em;
            }
        </style>
    {% endif %}

    {{ script.generate_scripts() }}
</head>
<body>

    <header>
        {% if confirm %}
        {# confirmation message used when post data has been handled correctly #}
            {% block confirm %}
                <div class="box post_confirm">
                    {% block confirm_message %}
                        {% trans %}Your data has been sent correctly.{% endtrans %}
                    {% endblock confirm_message %}
                </div>
            {% endblock confirm %}
        {% endif %}

        {% if menus %}
            {% block menu %}
                <nav class="menu">
                    <ul>
                    {% for url,label,cls in menus %}
                        <li><a class="menu_item button {{cls}}" {{ {'href': url}|xmlattr }}>{{ label }}</a></li>
                    {% endfor %}
                    </ul>
                </nav>
            {% endblock menu %}
        {% endif %}
    </header>

    <div id="body">
    {% block body %}
    {% endblock body %}
    </div>
    <footer>{% block footer %}{% trans app_name=C.APP_NAME %}Powered by {{app_name}}{% endtrans %}{% endblock %}</footer>
</body>
</html>