Commit 2422b168 authored by Emma's avatar Emma

add tabs to user pages

parent 7264b6cb
Pipeline #12662977 passed with stage
in 5 minutes and 13 seconds
{% from _self import tab %}
{% macro tab(path, label) %}
{% with { active: app.request.baseUrl ~ app.request.pathInfo == path } %}
<li class="tabs__tab {{ active ? 'tabs__tab--active' }}">
<a href="{{ path }}" class="tabs__link {{ active ? 'tabs__link--active' }}">{{ label }}</a>
</li>
{% endwith %}
{% endmacro %}
<nav class="tabs user-nav">
<ul class="tabs__bar">
{{ tab(path('user', {username: user.username}), 'label.overview'|trans) }}
{{ tab(path('user_submissions', {username: user.username}), 'user.submissions'|trans) }}
{{ tab(path('user_comments', {username: user.username}), 'user.comments'|trans) }}
</ul>
</nav>
......@@ -15,6 +15,8 @@
{% endblock %}
{% block body %}
{{ include('user/_nav.html.twig', {user: user}, with_context=false) }}
<h1 class="page-heading">{{ block('title') }}</h1>
{% for comment in comments %}
......
......@@ -15,6 +15,8 @@
{% endblock %}
{% block body %}
{{ include('user/_nav.html.twig', {user: user}, with_context=false) }}
<h1 class="page-heading">{{ block('title') }}</h1>
{% for submission in submissions %}
......
......@@ -11,6 +11,8 @@
{% endblock %}
{% block body %}
{{ include('user/_nav.html.twig', {user: user}, with_context=false) }}
<h1 class="page-heading">{{ user.username }}</h1>
{% for contribution in contributions %}
......@@ -31,23 +33,34 @@
})|raw }}</p>
</section>
<section class="sidebar__section sidebar__section--user-toolbox">
<h1 class="sidebar__title">{{ 'user.toolbox'|trans }}</h1>
<nav>
{% set toolbox_items = [] %}
{% if is_granted('ROLE_USER') and user is not same as(app.user) %}
{% if is_granted('message', user) %}
{% set item %}
<li><a href="{{ path('compose_message', {username: user.username}) }}">{{ 'user.message'|trans }}</a></li>
{% endset %}
{% set toolbox_items = toolbox_items|merge([item]) %}
{% endif %}
{% if not app.user.isBlocking(user) %}
{% set item %}
<li><a href="{{ path('block_user', {username: user.username}) }}">{{ 'nav.block_user'|trans }}</a></li>
{% endset %}
{% set toolbox_items = toolbox_items|merge([item]) %}
{% endif %}
{% endif %}
{% if toolbox_items %}
<section class="sidebar__section sidebar__section--user-toolbox">
<h1 class="sidebar__title">{{ 'user.toolbox'|trans }}</h1>
<ul>
{% if is_granted('ROLE_USER') and user is not same as(app.user) %}
{% if is_granted('message', user) %}
<li><a href="{{ path('compose_message', {username: user.username}) }}">{{ 'user.message'|trans }}</a></li>
{% endif %}
{% if not app.user.isBlocking(user) %}
<li><a href="{{ path('block_user', {username: user.username}) }}">{{ 'nav.block_user'|trans }}</a></li>
{% endif %}
{% endif %}
<li><a href="{{ path('user_submissions', {username: user.username}) }}">{{ 'user.submissions'|trans }}</a></li>
<li><a href="{{ path('user_comments', {username: user.username}) }}">{{ 'user.comments'|trans }}</a></li>
{% for item in toolbox_items %}
{{ item }}
{% endfor %}
</ul>
</nav>
</section>
</section>
{% endif %}
{% if is_granted('ROLE_ADMIN') %}
<section class="sidebar__section sidebar__section--user-roles">
......
......@@ -234,6 +234,7 @@ label:
verification: Verification
admin: Admin
bans: Bans
overview: Overview
login_form:
log_in: Log in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment