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 %} {% 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> <pre class="d-none d-md-inline-block"></pre>
<h5 style="font-weight:bold;">Admins</h5> <h5 style="font-weight:bold;">Admins</h5>
<pre></pre> <pre></pre>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5"> <table class="table table-striped mb-5">
<thead class="bg-primary text-white"> <thead class="bg-primary text-white">
<tr> <tr>
<th>#</th> <th>#</th>
<th>Name</th> <th>Name</th>
<th role="button" onclick="sort_table(2)" style="text-align:right;">Truescore</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> <th role="button" onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
</tr> </tr>
</thead> </thead>
{% for user in admins %}
<tr> {% for user in admins %}
<td>{{loop.index}}</td> <tr>
<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>{{loop.index}}</td>
<td style="text-align:right;">{{user.truecoins}}</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;"><a href="/log?admin={{user.username}}">{{user.modaction_num}}</a></td> <td style="text-align:right;">{{user.truecoins}}</td>
</tr> <td style="text-align:right;"><a href="/log?admin={{user.username}}">{{user.modaction_num}}</a></td>
{% endfor %} </tr>
</table> {% endfor %}
</table>
</div>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "default.html" %} {% extends "default.html" %}
{% block content %} {% block content %}
<script src="/assets/js/sort_table.js?v=242"></script> <script src="/assets/js/sort_table.js?v=243"></script>
<pre> <pre>
@ -12,28 +12,29 @@
</pre> </pre>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5"> <table class="table table-striped mb-5">
<thead class="bg-primary text-white"> <thead class="bg-primary text-white">
<tr> <tr>
<th>#</th> <th>#</th>
<th>Name</th> <th>Name</th>
<th>Image</th> <th>Image</th>
<th>Description</th> <th>Description</th>
<th role="button" onclick="sort_table(4)">#</th> <th role="button" onclick="sort_table(4)">#</th>
<th role="button" onclick="sort_table(4)">Rarity</th> <th role="button" onclick="sort_table(4)">Rarity</th>
</tr> </tr>
</thead> </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>
{% 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 %} {% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "default.html" %} {% extends "default.html" %}
{% block content %} {% block content %}
<script src="/assets/js/sort_table.js?v=242"></script> <script src="/assets/js/sort_table.js?v=243"></script>
<pre> <pre>
@ -9,25 +9,26 @@
<h5>List of {{HOLE_NAME}}s</h5> <h5>List of {{HOLE_NAME}}s</h5>
<pre></pre> <pre></pre>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table id="sortable_table" class="table table-striped mb-5"> <table class="table table-striped mb-5">
<thead class="bg-primary text-white"> <thead class="bg-primary text-white">
<tr> <tr>
<th>#</th> <th>#</th>
<th>Name</th> <th>Name</th>
<th role="button" onclick="sort_table(2)">Posts</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(3)">Followers</th>
<th role="button" onclick="sort_table(4)">Blockers</th> <th role="button" onclick="sort_table(4)">Blockers</th>
</tr> </tr>
</thead> </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>
{% 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 %} {% endblock %}

View File

@ -9,7 +9,7 @@
{% if thing %} {% if thing %}
<script src="/assets/js/sort_table.js?v=242"></script> <script src="/assets/js/sort_table.js?v=243"></script>
<pre> <pre>
@ -23,37 +23,42 @@
<p><b>Downvotes: </b>{{downs | length}}</p> <p><b>Downvotes: </b>{{downs | length}}</p>
<h2>Upvotes</h2> <h2>Upvotes</h2>
<div class="overflow-x-auto"><table class="table table-striped mb-5"> <div class="overflow-x-auto">
<thead class="bg-primary text-white"><tr> <table class="table table-striped mb-5">
<th>User</th> <thead class="bg-primary text-white">
<th role="button" onclick="sort_table(1)">User truescore</th> <tr>
</tr></thead> <th>User</th>
<th role="button" onclick="sort_table(1)">User truescore</th>
</tr>
</thead>
{% for vote in ups %} {% for vote in ups %}
<tr> <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><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> <td>{{vote.user.truecoins}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
<h2>Downvotes</h2> <h2>Downvotes</h2>
<div class="overflow-x-auto"><table class="table table-striped mb-5"> <div class="overflow-x-auto">
<thead class="bg-primary text-white"><tr> <table class="table table-striped mb-5">
<th>User</th> <thead class="bg-primary text-white">
<th>User truescore</th> <tr>
</tr></thead> <th>User</th>
<th>User truescore</th>
{% for vote in downs %} </tr>
<tr> </thead>
<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 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 %} {% endif %}