view sat_templates/templates/bulma/components/common.html @ 295:1de599c5a68f

bulma (base): loading screen: when the `loading_screen` variable is set before extending `base/base.html`, a loading modal is shown (and must be removed via JavaScript). This avoids the user to try to use an interface which is not reactive or working normally because JS is not fully loaded yet.
author Goffi <goffi@goffi.org>
date Fri, 27 Nov 2020 12:24:03 +0100
parents 1743fd741fed
children 6411615771b6
line wrap: on
line source

{% import 'components/menu_labels.html' as ml with context %}
{# we need to use "with context" to disable cache, needed for i18n #}

{% macro menu(menus, class='') %}
    <nav class="navbar has-background-primary">
        <div class="navbar-brand">
            <a class="navbar-item" href="/">
              <img src="{{media_path}}icons/apps/64/sat.png">
            </a>
            <a role="button" id="main_menu_burger" class="navbar-burger burger" data-target="main_menu">
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
            </a>
        </div>
        <div id="main_menu" class="navbar-menu">
            <div class="navbar-start">
            {% for name, url in menus %}
                  <a class="navbar-item" {{ {'href': url}|xmlattr }}>
                    {{ml.label[name] or name}}
                  </a>
            {% endfor %}
            </div>
            <div class="navbar-end">
                <div class="navbar-item has-dropdown is-hoverable">
                    <span class="navbar-link">{{locale.language_name}}</span>
                    <div class="navbar-dropdown">
                        {% for l in locales|reject("eq", locale) %}
                            <a class="navbar-item" href="?{{C.KEY_LANG}}={{l}}">{{l.language_name}}</a>
                        {% endfor %}

                </div>
            </div>
        </div>
    </nav>
{% endmacro %}

{% macro action_button(url, label=_("create"), icon="plus-circled", class="is-primary is-rounded", id=none) %}
    <a class="button {{class}}" {{ {"href":url, "id": id} | xmlattr }}><i class="icon-{{icon}}"></i> {{label}}</a>
{% endmacro %}