forked from MarseyWorld/MarseyWorld
i've done it... i've really done it 🥲
i've made the leaderboard code less crap all around to those who wrote this old code i forgive youmaster
parent
09c3ac2b65
commit
0258bfb356
|
@ -16,6 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% macro format_user_in_table(user, style, position_no, value, user_relative_url) %}
|
{% macro format_user_in_table(user, style, position_no, value, user_relative_url) %}
|
||||||
|
{% set value = value | int %}
|
||||||
<tr {{style}}>
|
<tr {{style}}>
|
||||||
<td>{{position_no}}</td>
|
<td>{{position_no}}</td>
|
||||||
<td>{% include "user_in_table.html" %}</td>
|
<td>{% include "user_in_table.html" %}</td>
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
{% macro leaderboard_table(lb, position, id, total_count, header_name, column_name, attr_name) %}
|
{% 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>
|
<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">
|
<div class="overflow-x-auto">
|
||||||
<# TODO: check at some point if the nesting divs are intentional #>
|
{# TODO: check at some point if the nesting divs are intentional #}
|
||||||
<table class="table table-striped mb-5">
|
<table class="table table-striped mb-5">
|
||||||
{{leaderboard_table_header(column_name)}}
|
{{leaderboard_table_header(column_name)}}
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -78,7 +79,7 @@
|
||||||
{{format_user_in_table(user, style, loop.index, num, user_relative_url)}}
|
{{format_user_in_table(user, style, loop.index, num, user_relative_url)}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if position and (position[0] > total_count or not position[1]) %}
|
{% 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)}}
|
{{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", position[0], position[1], user_relative_url)}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue