Show user avatar next to its name, in all possible locations

This commit is contained in:
Jan Böhmer 2023-01-23 23:01:57 +01:00
parent 29bce6f19f
commit 97b87dee5f
9 changed files with 143 additions and 47 deletions

View file

@ -9,7 +9,7 @@
<div class="card-body row">
<div class="col-md-2">
<div class="mx-auto">
<img class="img-fluid img-thumbnail img-rounded " alt="User avatar" src="{{ avatar }}">
<img class="img-fluid img-thumbnail rounded" alt="User avatar" src="{{ avatar_helper.avatarURL(user) }}">
</div>
</div>
<div class="col-md-5">

View file

@ -1,3 +1,5 @@
{% import "helper.twig" as helper %}
<nav class="navbar navbar-expand-md navbar-light bg-light border-bottom shadow-sm fixed-top py-0" id="navbar">
<div class="container-fluid">
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#sidebar-container">
@ -41,7 +43,7 @@
<ul class="dropdown-menu dropdown-menu-end" id="login-menu" aria-labelledby="navbar-user-dropdown-btn">
{% if app.user %}
<a class="dropdown-item disabled" href="#">{% trans %}user.loggedin.label{% endtrans %}
<b>{{ app.user.firstName }} {{ app.user.lastName }}</b> (@{{ app.user.name }})</a>
{{ helper.user_icon(app.user) }} <b>{{ app.user.firstName }} {{ app.user.lastName }}</b> (@{{ app.user.name }})</a>
<a class="dropdown-item" href="{{ path("user_settings") }}"><i class="fa fa-cogs fa-fw"
aria-hidden="true"></i> {% trans %}user.settings.label{% endtrans %}
</a>

View file

@ -160,14 +160,18 @@
{% if user is not null %}
{% if user.fullName is not empty %}
(<a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">{{ user.fullName }}</a>)
({{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">{{ user.fullName }}</a>)
{% else %}
(<a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">@{{ user.name }}</a>)
({{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">@{{ user.name }}</a>)
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{% macro user_icon(user) %}
<img src="{{ avatar_helper.avatarSmURL(user) }}" class="rounded" style="height: 1.2rem;" alt="User avatar">
{% endmacro %}
{% macro parameters_table(parameters) %}
<table class="table table-hover table-striped table-sm">
<thead>