2022-05-04 23:09:46 +00:00
|
|
|
{% extends "settings2.html" %}
|
|
|
|
{% block pagetitle %}Leaderboard{% endblock %}
|
|
|
|
{% block content %}
|
2022-10-28 06:21:05 +00:00
|
|
|
{%- set LEADERBOARDS = [
|
2022-10-28 06:16:51 +00:00
|
|
|
('coins', 'Coins', True, True), ('spent', 'Spent in shop', True, True), ('truescore', 'Truescore', True, True), ('followers', 'Followers', True, True),
|
|
|
|
('posts', 'Posts', True, True), ('comments', 'Comments', True, True), ('awards', 'Awards', True, True), ('badges', 'Badges', True, True),
|
2022-10-28 06:21:05 +00:00
|
|
|
('marseys', 'Marseys', SITE_NAME == 'rDrama', True), ('blocked', 'Blocked', True, True), ('owned-hats', 'Owned hats', True, True), ('designed-hats', 'Designed hats', True, False)
|
2022-10-28 06:03:19 +00:00
|
|
|
] -%}
|
2022-05-04 23:09:46 +00:00
|
|
|
<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 06:16:51 +00:00
|
|
|
{% for lb in LEADERBOARDS %}
|
2022-10-28 06:21:58 +00:00
|
|
|
{% if lb[2] %}
|
2022-10-28 06:16:51 +00:00
|
|
|
<a href="#leaderboard-{{lb[0]}}">{{lb[1]}}</a>{% if lb[3] %} •{% 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) %}
|
|
|
|
<tr {{style}}>
|
|
|
|
<td>{{position_no}}</td>
|
2022-09-05 03:01:06 +00:00
|
|
|
<td>{% include "user_in_table.html" %}</td>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% if user_relative_url %}
|
|
|
|
<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 06:03:19 +00:00
|
|
|
{% macro leaderboard_table_header(column_name) %}
|
2022-05-04 23:09:46 +00:00
|
|
|
<thead class="bg-primary text-white">
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th>Name</th>
|
2022-10-28 06:03:19 +00:00
|
|
|
<th>{{column_name}}</th>
|
2022-05-04 23:09:46 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro leaderboard_table(lb, position, id, total_count, header_name, column_name, attr_name) %}
|
|
|
|
<h5 class="font-weight-bolder text-center pt-2 pb-3"><a id="leaderboard-{{id}}">Top {{total_count}} by {{header_name}}</a></h5>
|
|
|
|
<div class="overflow-x-auto">
|
|
|
|
<# TODO: check at some point if the nesting divs are intentional #>
|
|
|
|
<table class="table table-striped mb-5">
|
|
|
|
{{leaderboard_table_header(column_name)}}
|
2022-09-05 20:43:49 +00:00
|
|
|
<tbody>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% for user in lb %}
|
|
|
|
{% if v.id == user.id %}
|
|
|
|
{% set style="class=\"self\"" %}
|
|
|
|
{% endif %}
|
2022-10-28 06:25:18 +00:00
|
|
|
{{format_user_in_table(user, style, loop.index, user[attr_name])}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endfor %}
|
2022-10-28 06:03:19 +00:00
|
|
|
{% if position %}
|
2022-10-28 06:25:18 +00:00
|
|
|
{{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", position, v[attr_name])}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endif %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{{leaderboard_table(users1, pos1, 'coins', 25, 'coins', 'Coins', 'coins')}}
|
|
|
|
{{leaderboard_table(users7, pos7, 'spent', 25, 'coins spent in shop', 'Coins', 'coins_spent')}}
|
|
|
|
{{leaderboard_table(users10, pos10, 'truescore', 25, 'truescore', 'Truescore', 'truecoins')}}
|
|
|
|
{{leaderboard_table(users2, pos2, 'followers', 25, 'followers', 'Followers', 'stored_subscriber_count')}}
|
|
|
|
{{leaderboard_table(users3, pos3, 'posts', 25, 'post count', 'Posts', 'post_count')}}
|
|
|
|
{{leaderboard_table(users4, pos4, 'comments', 25, 'comment count', 'Comments', 'comment_count')}}
|
|
|
|
{{leaderboard_table(users5, pos5, 'awards', 25, 'received awards', 'Awards', 'awards')}}
|
|
|
|
|
|
|
|
{% macro leaderboard_table_2(lb, position, id, total_count, header_name, column_name, user_relative_url) %}
|
|
|
|
<h5 class="font-weight-bolder text-center pt-2 pb-3"><a id="leaderboard-{{id}}">Top {{total_count}} by {{header_name}}</a></h5>
|
|
|
|
<div class="overflow-x-auto">
|
|
|
|
<table class="table table-striped mb-5">
|
|
|
|
{{leaderboard_table_header(column_name)}}
|
2022-09-05 20:43:49 +00:00
|
|
|
<tbody>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% for user, num in lb %}
|
|
|
|
{% if v.id == user.id %}
|
|
|
|
{% set style="class=\"self\"" %}
|
|
|
|
{% endif %}
|
|
|
|
{{format_user_in_table(user, style, loop.index, num, user_relative_url)}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endfor %}
|
2022-10-28 06:03:19 +00:00
|
|
|
{% if position and (position[0] > total_count or not position[1]) %}
|
|
|
|
{{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", position, position[1], user_relative_url)}}
|
2022-05-04 23:09:46 +00:00
|
|
|
{% endif %}
|
2022-10-28 06:03:19 +00:00
|
|
|
</tbody>
|
2022-05-04 23:09:46 +00:00
|
|
|
</table>
|
2022-10-28 06:03:19 +00:00
|
|
|
{% endmacro %}
|
2022-05-04 23:09:46 +00:00
|
|
|
|
2022-10-28 06:03:19 +00:00
|
|
|
{{leaderboard_table_2(users11, pos11, 'badges', 25, 'badges', 'Badges')}}
|
|
|
|
{% if users12 %}
|
|
|
|
{{leaderboard_table_2(users12, pos12, 'marseys', 25, 'Marseys made', 'Marseys')}}
|
2022-09-06 02:52:03 +00:00
|
|
|
{% endif %}
|
2022-10-28 06:03:19 +00:00
|
|
|
{{leaderboard_table_2(users16, pos16, 'blocked', 25, 'most blocked', 'Blocked By', 'blockers')}}
|
|
|
|
{{leaderboard_table_2(users17, pos17, 'owned-hats', 25, 'owned hats', 'Owned Hats')}}
|
|
|
|
{{leaderboard_table_2(users18, pos18, 'designed-hats', 25, 'designed hats', 'Designed Hats')}}
|
2022-09-03 18:50:20 +00:00
|
|
|
|
2022-05-25 07:26:33 +00:00
|
|
|
<a id="leader--top-btn" href="#leaderboard-contents" role="button"
|
|
|
|
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 %}
|