fediplan/templates/nav.html.twig
2024-05-14 08:50:06 +02:00

65 lines
No EOL
4.3 KiB
Twig

{% trans_default_domain 'fediplan' %}
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-light fixed-top bg-light">
<a class="navbar-brand" href="#">FediPlan</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
{% if not is_granted('ROLE_USER') %}
<li class="nav-item {% if app.request.attributes.get('_route') == 'index' %} active {% endif %}">
<a class="nav-link" href="{{ path('index') }}">{{ 'common.login'|trans }} <span class="sr-only">(current)</span></a>
</li>
{% endif %}
{% if is_granted('ROLE_USER') %}
<li class="nav-item {% if app.request.attributes.get('_route') == 'schedule' %}active {% endif %}">
<a class="nav-link" href="{{ path('schedule') }}">{{ 'common.schedule'|trans }}</a>
</li>
<li class="nav-item {% if app.request.attributes.get('_route') == 'scheduled' %} active {% endif %}">
<a class="nav-link" href="{{ path('scheduled') }}">{{ 'common.scheduled'|trans }}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ path('logout') }}" tabindex="-1" >{{ 'common.logout'|trans }}</a>
</li>
{% endif %}
<li class="nav-item {% if app.request.attributes.get('_route') == 'about' %} active {% endif %}">
<a class="nav-link" href="{{ path('about') }}" tabindex="-1" >{{ 'common.about'|trans }}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://fedilab.app/page/donations/" tabindex="-1" >{{ 'common.support_my_work'|trans }}</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
{{ getLanguage(app.request.locale) }}
</a>
<div class="dropdown-menu scrollable-menu">
{% set route = app.request.attributes.get('_route') %}
{% if route == "app_fediplan_about" %}
{% set route = "about" %}
{% endif %}
{% if route | length < 5 %}
{% set route = "index" %}
{% endif %}
<a class="dropdown-item" href="{{ path(route, {'_locale':'en' }) }}">English</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'fr' }) }}">Français</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'de' }) }}">Deutsch</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'nl' }) }}">Nederlands</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'ar' }) }}">العربية</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'it' }) }}">Italiano</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'pt-PT' }) }}">Português</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'pt-BR' }) }}">Brasil</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'ca' }) }}">Català</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'ja' }) }}">日本語</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'pl' }) }}">Polski</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'ru' }) }}">Русский</a>
<a class="dropdown-item" href="{{ path(route, {'_locale':'uk' }) }}">Украïна</a>
</div>
</li>
</ul>
</div>
</nav>
</header>