misuzu/templates/user/macros.twig

47 lines
2.3 KiB
Twig
Raw Normal View History

{% macro user_card(user, profile_url, rank_url, actions) %}
<div class="usercard">
<a href="{{ profile_url|default('/profile.php?u=%d')|format(user.user_id) }}"
2018-08-16 02:02:27 +00:00
class="usercard__background" title="{{ user.username }}"></a>
<div class="usercard__container">
<div class="usercard__main">
<div class="avatar avatar--new usercard__avatar"
style="background-image:url('/profile.php?u={{ user.user_id }}&amp;m=avatar')">
</div>
<div class="usercard__details">
<div class="usercard__name"
2018-09-23 14:42:15 +00:00
{% if user.user_colour is defined %}style="{{ user.user_colour|html_colour }}"{% endif %}>
{{ user.username }}
</div>
<div class="usercard__info">
{% if user.user_country is defined %}
<div class="flag flag--{{ user.user_country|lower }} usercard__item usercard__item--country usercard__item--active" title="{{ user.user_country|country_name }}">
{{ user.user_country }}
</div>
{% endif %}
{% if user.user_title is defined %}
<a class="usercard__item usercard__item--title{% if user.role_id is defined %} usercard__item--active{% endif %}"{% if user.role_id is defined %} href="{{ rank_url|default('/members.php?r=%d')|format(user.role_id) }}"{% endif %} title="{{ user.user_title }}">
{{ user.user_title }}
</a>
{% endif %}
</div>
</div>
</div>
{% if actions is iterable %}
<div class="usercard__actions">
{% for action in actions %}
<a class="usercard__action"
{% if action.href is defined %}href="{{ action.href }}"{% endif %}
{% if action.onclick is defined %}onclick="{{ action.onclick }}"{% endif %}>
{{ action.text }}
</a>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endmacro %}