view sat_templates/templates/bulma/components/common.html @ 402:2bbcb7da56bc default tip

bulma: use Font-Awesome instead of Fontello + start of major redesign: - Font-Awesome is now used instead of Fontello, following change in Libervia Media. - This is a beginning of a major redesign of the web templates/web frontend. This currently breaks a lot of thing.
author Goffi <goffi@goffi.org>
date Sat, 26 Oct 2024 22:53:26 +0200
parents b313a7d343af
children
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='is-light') %}
    {{ icon_defs("bell", "circle-user") }}
    {% for menu in menus %}
        {{ icon_defs(menu.icon) }}
    {% endfor %}
    <nav class="navbar main_menu {{class}} {{'is-fixed-top' if menu_fixed_top}}"
         role="navigation" aria-label="main navigation"
    >

        <div class="navbar-brand">
            <a class="navbar-item" href="/">
              <img src="{{media_path}}icons/apps/64/sat.png">
            </a>
            <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="main_menu">
                <span aria-hidden="true"></span>
                <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 menu in menus %}
                <a
                    class="navbar-item {% if menu.name == current_page %}is-tab is-active{% endif%}"
                    {{ {'href': menu.url}|xmlattr }}
                    {# External links should not replace current page. #}
                    {% if menu.url.startswith('http:') or menu.url.startswith('https:') -%}target="_blank"{%- endif %}
                >
                    <span class="icon">{{ icon(menu.icon) }}</span>
                    <span class="menu-item">{{ml.label[menu.name] or menu.name}}</span>
                  </a>
            {% endfor %}
            </div>
            <div class="navbar-end">
                <div class="navbar-item has-dropdown is-hoverable">
                    <span class="menu-item navbar-link"><span class="menu-item">{{locale.language_name}}</span></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 class="navbar-item" id="menu_notifs">
                    <div class="buttons">
                        <a class="button is-light">
                            <span class="icon">{{ icon("bell") }}</span>
                            <span class="tag is-danger has-text-white menu-item">3</span>
                        </a>
                        <a {{ {'href': login_url}|xmlattr }}>
                            {% if profile %}
                                <div class="button is-light">
                                    <span class="icon">{{ icon("circle-user") }}</span>
                                    <span class="menu-item">{{profile}}</span>
                                </div>
                            {% else %}
                                <div class="button is-light">
                                    <span class="menu-item">Log In</span>
                                </div>
                            {% endif %}
                        </a>
                    </div>
                </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 %}