2022-05-04 23:09:46 +00:00
|
|
|
{% extends "settings2.html" %}
|
|
|
|
{% block pagetitle %}Leaderboard{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<pre class="d-none d-md-inline-block"></pre>
|
2022-05-25 05:24:59 +00:00
|
|
|
<div id="leaderboard-contents" style="text-align: center; margin-bottom: 1.5rem; font-size: 1.2rem;">
|
2022-10-28 08:42:02 +00:00
|
|
|
{% for lb in leaderboards %}
|
|
|
|
{% if lb %}
|
|
|
|
<a href="#leaderboard-{{lb.html_id}}">{{lb.header_name}}</a>{% if not loop.last %} •{% endif %}
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2022-05-25 05:24:59 +00:00
|
|
|
</div>
|
|
|
|
|
2022-10-28 06:03:19 +00:00
|
|
|
{% macro format_user_in_table(user, style, position_no, value, user_relative_url) %}
|
2022-10-28 06:42:02 +00:00
|
|
|
{% set value = value | int %}
|
2022-10-28 09:30:24 +00:00
|
|
|
<tr {{style | safe}}>
|
2022-10-28 06:03:19 +00:00
|
|
|
<td>{{position_no}}</td>
|
2022-09-05 03:01:06 +00:00
|
|
|
<td>{% include "user_in_table.html" %}</td>
|
2022-10-28 09:55:17 +00:00
|
|
|
{% if user_relative_url is not none %}
|
2022-10-28 06:03:19 +00:00
|
|
|
<td><a href="/@{{user.username}}/{{user_relative_url}}">{{"{:,}".format(value)}}</a></td>
|
|
|
|
{% else %}
|
|
|
|
<td>{{"{:,}".format(value)}}</td>
|
|
|
|
{% endif %}
|
2022-05-04 23:09:46 +00:00
|
|
|
</tr>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endmacro %}
|
2022-05-04 23:09:46 +00:00
|
|
|
|
2022-10-28 09:30:24 +00:00
|
|
|
{% macro leaderboard_table(lb) %}
|
2022-10-28 23:27:38 +00:00
|
|
|
<h5 class="font-weight-bolder text-center pt-2 pb-3"><span id="leaderboard-{{lb.html_id}}">Top {{lb.limit}} by {{lb.table_header_name}}</span></h5>
|
2022-10-28 08:42:02 +00:00
|
|
|
<div class="overflow-x-auto">
|
|
|
|
<table class="table table-striped mb-5">
|
2022-05-04 23:09:46 +00:00
|
|
|
<thead class="bg-primary text-white">
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th>Name</th>
|
2022-10-28 08:42:02 +00:00
|
|
|
<th>{{lb.table_column_name}}</th>
|
2022-05-04 23:09:46 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2022-09-05 20:43:49 +00:00
|
|
|
<tbody>
|
2022-10-28 08:42:02 +00:00
|
|
|
{% for user in lb.all_users %}
|
2022-11-01 07:43:08 +00:00
|
|
|
{% set user2 = lb.user_func(user) %}
|
|
|
|
{% if v.id == user2.id %}
|
2022-10-28 06:03:19 +00:00
|
|
|
{% set style="class=\"self\"" %}
|
|
|
|
{% endif %}
|
2022-11-01 07:43:08 +00:00
|
|
|
{{format_user_in_table(user2, style, loop.index, lb.value_func(user), lb.user_relative_url)}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endfor %}
|
2022-11-01 07:57:10 +00:00
|
|
|
{% if lb.v_position and not lb.v_appears_in_ranking %}
|
2022-10-28 09:51:41 +00:00
|
|
|
{{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", lb.v_position, lb.v_value, lb.user_relative_url)}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endif %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2022-11-01 07:36:18 +00:00
|
|
|
</div>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
2022-10-28 08:42:02 +00:00
|
|
|
{% for lb in leaderboards %}
|
|
|
|
{% if lb %}
|
2022-10-28 09:30:24 +00:00
|
|
|
{{leaderboard_table(lb)}}
|
2022-10-28 08:42:02 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2022-09-03 18:50:20 +00:00
|
|
|
|
2022-10-28 23:32:31 +00:00
|
|
|
<a id="leader--top-btn" href="#leaderboard-contents"
|
2022-05-25 07:26:33 +00:00
|
|
|
style="position: fixed; bottom: 5rem; right: 2rem; font-size: 3rem;">
|
|
|
|
<i class="fas fa-arrow-alt-circle-up"></i>
|
|
|
|
</a>
|
2022-09-03 23:53:45 +00:00
|
|
|
{% endblock %}
|