symfony-with-user-account/templates/common/nav.html.twig

24 lines
1.1 KiB
Twig

{% set currentRoute = app.request.attributes.get('_route') %}
<div id="nav_menu">
<nav>
<div class="mb-3">
<a href="{{ path('app_index') }}"
class="{% if currentRoute == 'app_index' %}active{% endif %}"
>{{ 'common.homepage'|trans }}</a>
{% if app.user %}
<a
class="account-link {% if currentRoute == 'app_account' %}active{% endif %}"
href="{{ path('app_account') }}">{{ app.user.userIdentifier }}</a>
<a href="{{ path('app_logout') }}">{{ 'user.logout'|trans }}</a>
{% else %}
<a class="account-link {% if currentRoute == 'app_login' %}active{% endif %}"
href="{{ path('app_login') }}">{{ 'user.login'|trans }}</a>
<a class="account-link {% if currentRoute == 'app_register' %}active{% endif %}"
href="{{ path('app_register') }}">{{ 'user.register'|trans }}</a>
{% endif %}
</div>
{# <a href="{{path('admin')}}">Admin</a> #}
</nav>
</div>