misuzu/templates/forum/leaderboard.twig

57 lines
2.9 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% extends 'forum/master.twig' %}
{% from 'macros.twig' import avatar %}
{% from 'forum/macros.twig' import forum_header %}
{% set title = 'Forum Leaderboard » ' ~ leaderboard_name %}
{% set canonical_url = url('forum-leaderboard', {
'id': leaderboard_id,
'mode': '',
}) %}
{% block content %}
{{ forum_header(title, [], false, canonical_url, [
{
'html': '<i class="fab fa-markdown fa-fw"></i> Markdown',
'url': url('forum-leaderboard', {'id': leaderboard_id, 'mode': 'markdown'}),
'display': leaderboard_mode != 'markdown',
},
{
'html': '<i class="fas fa-table fa-fw"></i> Table',
'url': url('forum-leaderboard', {'id': leaderboard_id}),
'display': leaderboard_mode == 'markdown',
},
]) }}
<div class="container forum__leaderboard__categories">
2023-08-28 01:17:34 +00:00
<a href="{{ url('forum-leaderboard', {'mode': leaderboard_mode}) }}" class="forum__leaderboard__category{% if leaderboard_id == '' %} forum__leaderboard__category--active{% endif %}">All Time</a>
</div>
<div class="container forum__leaderboard__categories">
{% for id, name in leaderboard_years %}
<a href="{{ url('forum-leaderboard', {'id': id, 'mode': leaderboard_mode}) }}" class="forum__leaderboard__category{% if leaderboard_id == id %} forum__leaderboard__category--active{% endif %}">{{ name }}</a>
{% endfor %}
</div>
<div class="container forum__leaderboard__categories">
{% for id, name in leaderboard_months %}
2022-09-13 13:14:49 +00:00
<a href="{{ url('forum-leaderboard', {'id': id, 'mode': leaderboard_mode}) }}" class="forum__leaderboard__category{% if leaderboard_id == id %} forum__leaderboard__category--active{% endif %}">{{ name }}</a>
{% endfor %}
</div>
{% if leaderboard_mode == 'markdown' %}
<textarea class="input__textarea forum__leaderboard__markdown">{{ leaderboard_markdown }}</textarea>
{% else %}
2023-08-28 01:17:34 +00:00
{% for ranking in leaderboard_data %}
<div class="container forum__leaderboard__user forum__leaderboard__user--rank-{{ ranking.position }}">
<a href="{{ url('user-profile', {'user': ranking.user.id|default()}) }}" class="forum__leaderboard__user__background"></a>
2022-09-13 13:14:49 +00:00
<div class="forum__leaderboard__user__content">
2023-08-28 01:17:34 +00:00
<div class="forum__leaderboard__user__rank">{{ ranking.position|number_format }}</div>
<div class="forum__leaderboard__user__avatar">{{ avatar(ranking.user.id|default(), ranking.position == 1 ? 50 : 40, ranking.user.name|default('Deleted User')) }}</div>
<div class="forum__leaderboard__user__username">{{ ranking.user.name|default('Deleted User') }}</div>
<div class="forum__leaderboard__user__posts">{{ ranking.postsCount|number_format }} post{{ ranking.postsCount == 1 ? '' : 's' }}</div>
2022-09-13 13:14:49 +00:00
</div>
</div>
{% endfor %}
{% endif %}
{% endblock %}