forked from rDrama/rDrama
1
0
Fork 0

make sorting tables less retarded

master
Aevann1 2022-06-27 04:47:49 +02:00
parent 44c588fce3
commit 26d46a9cb9
4 changed files with 101 additions and 92 deletions

View File

@ -4,28 +4,30 @@
{% block content %}
<script src="/assets/js/sort_table.js?v=242"></script>
<script src="/assets/js/sort_table.js?v=243"></script>
<pre class="d-none d-md-inline-block"></pre>
<h5 style="font-weight:bold;">Admins</h5>
<pre></pre>
<div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)" style="text-align:right;">Truescore</th>
<th role="button" onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
</tr>
</thead>
{% for user in admins %}
<tr>
<td>{{loop.index}}</td>
<td><a style="color:#{{user.namecolor}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
<td style="text-align:right;">{{user.truecoins}}</td>
<td style="text-align:right;"><a href="/log?admin={{user.username}}">{{user.modaction_num}}</a></td>
</tr>
{% endfor %}
</table>
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)" style="text-align:right;">Truescore</th>
<th role="button" onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
</tr>
</thead>
{% for user in admins %}
<tr>
<td>{{loop.index}}</td>
<td><a style="color:#{{user.namecolor}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}}"{% endif %}>{{user.username}}</span></a></td>
<td style="text-align:right;">{{user.truecoins}}</td>
<td style="text-align:right;"><a href="/log?admin={{user.username}}">{{user.modaction_num}}</a></td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "default.html" %}
{% block content %}
<script src="/assets/js/sort_table.js?v=242"></script>
<script src="/assets/js/sort_table.js?v=243"></script>
<pre>
@ -12,28 +12,29 @@
</pre>
<div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th>Image</th>
<th>Description</th>
<th role="button" onclick="sort_table(4)">#</th>
<th role="button" onclick="sort_table(4)">Rarity</th>
</tr>
</thead>
{% for badge in badges %}
<tr>
<td>{{loop.index}}</td>
<td>{{badge.name}}</td>
<td><img alt="{{badge.name}}" loading="lazy" src="{{asset('images/badges/', badge.id|string+'.webp')}}" width=45.83 height=50>
<td>{{badge.description}}</td>
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
<td class="badges-rarity-qty"><a href="/badge_owners/{{badge.id}}">{{ ct[0] }}</a></td>
<td class="badges-rarity-ratio">{{ "{:0.3f}".format(ct[1]) }}%</td>
</tr>
{% endfor %}
</table>
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th>Image</th>
<th>Description</th>
<th role="button" onclick="sort_table(4)">#</th>
<th role="button" onclick="sort_table(4)">Rarity</th>
</tr>
</thead>
{% for badge in badges %}
<tr>
<td>{{loop.index}}</td>
<td>{{badge.name}}</td>
<td><img alt="{{badge.name}}" loading="lazy" src="{{asset('images/badges/', badge.id|string+'.webp')}}" width=45.83 height=50>
<td>{{badge.description}}</td>
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
<td class="badges-rarity-qty"><a href="/badge_owners/{{badge.id}}">{{ ct[0] }}</a></td>
<td class="badges-rarity-ratio">{{ "{:0.3f}".format(ct[1]) }}%</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "default.html" %}
{% block content %}
<script src="/assets/js/sort_table.js?v=242"></script>
<script src="/assets/js/sort_table.js?v=243"></script>
<pre>
@ -9,25 +9,26 @@
<h5>List of {{HOLE_NAME}}s</h5>
<pre></pre>
<div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)">Posts</th>
<th role="button" onclick="sort_table(3)">Followers</th>
<th role="button" onclick="sort_table(4)">Blockers</th>
</tr>
</thead>
{% for sub, count in subs %}
<tr>
<td>{{loop.index}}</td>
<td><a href="/h/{{sub.name}}">{{sub.name}}</a></td>
<td><a href="/h/{{sub.name}}">{{count}}</a></td>
<td><a href="/h/{{sub.name}}/followers">{{sub.follow_num}}</a></td>
<td><a href="/h/{{sub.name}}/blockers">{{sub.block_num}}</a></td>
</tr>
{% endfor %}
</table>
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)">Posts</th>
<th role="button" onclick="sort_table(3)">Followers</th>
<th role="button" onclick="sort_table(4)">Blockers</th>
</tr>
</thead>
{% for sub, count in subs %}
<tr>
<td>{{loop.index}}</td>
<td><a href="/h/{{sub.name}}">{{sub.name}}</a></td>
<td><a href="/h/{{sub.name}}">{{count}}</a></td>
<td><a href="/h/{{sub.name}}/followers">{{sub.follow_num}}</a></td>
<td><a href="/h/{{sub.name}}/blockers">{{sub.block_num}}</a></td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View File

@ -9,7 +9,7 @@
{% if thing %}
<script src="/assets/js/sort_table.js?v=242"></script>
<script src="/assets/js/sort_table.js?v=243"></script>
<pre>
@ -23,37 +23,42 @@
<p><b>Downvotes: </b>{{downs | length}}</p>
<h2>Upvotes</h2>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white"><tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User truescore</th>
</tr></thead>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User truescore</th>
</tr>
</thead>
{% for vote in ups %}
<tr>
<td><a style="color:#{{vote.user.namecolor}};font-weight:bold" href="/@{{vote.user.username}}"><img loading="lazy" src="{{vote.user.profile_url}}" class="pp20"><span {% if vote.user.patron %}class="patron" style="background-color:#{{vote.user.namecolor}}"{% endif %}>{{vote.user.username}}</span></a></td>
<td>{{vote.user.truecoins}}</td>
</tr>
{% endfor %}
</table>
{% for vote in ups %}
<tr>
<td><a style="color:#{{vote.user.namecolor}};font-weight:bold" href="/@{{vote.user.username}}"><img loading="lazy" src="{{vote.user.profile_url}}" class="pp20"><span {% if vote.user.patron %}class="patron" style="background-color:#{{vote.user.namecolor}}"{% endif %}>{{vote.user.username}}</span></a></td>
<td>{{vote.user.truecoins}}</td>
</tr>
{% endfor %}
</table>
</div>
<h2>Downvotes</h2>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white"><tr>
<th>User</th>
<th>User truescore</th>
</tr></thead>
{% for vote in downs %}
<tr>
<td><a style="color:#{{vote.user.namecolor}};font-weight:bold" href="/@{{vote.user.username}}"><img loading="lazy" src="{{vote.user.profile_url}}" class="pp20"><span {% if vote.user.patron %}class="patron" style="background-color:#{{vote.user.namecolor}}"{% endif %}>{{vote.user.username}}</span></a></td>
<td>{{vote.user.truecoins}}</td>
</tr>
{% endfor %}
</table>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th>User truescore</th>
</tr>
</thead>
{% for vote in downs %}
<tr>
<td><a style="color:#{{vote.user.namecolor}};font-weight:bold" href="/@{{vote.user.username}}"><img loading="lazy" src="{{vote.user.profile_url}}" class="pp20"><span {% if vote.user.patron %}class="patron" style="background-color:#{{vote.user.namecolor}}"{% endif %}>{{vote.user.username}}</span></a></td>
<td>{{vote.user.truecoins}}</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}