forked from MarseyWorld/MarseyWorld
Revert "marseys table is way way too large to use javascript for sorting, you would've known that if u had tested"
This reverts commit fe0da05415
.
master
parent
2304876348
commit
bf1da34dae
|
@ -40,25 +40,16 @@ def reddit_post(subreddit, v, path):
|
|||
@app.get("/marseys")
|
||||
@auth_required
|
||||
def marseys(v:User):
|
||||
if SITE == 'rdrama.net':
|
||||
marseys = g.db.query(Marsey, User).join(User, Marsey.author_id == User.id).filter(Marsey.submitter_id==None)
|
||||
sort = request.values.get("sort")
|
||||
if sort == "author":
|
||||
marseys = marseys.order_by(User.username, Marsey.count.desc()).all()
|
||||
elif sort == "added":
|
||||
marseys = marseys.order_by(nullslast(Marsey.created_utc.desc()), User.username).all()
|
||||
else: # implied sort == "usage"
|
||||
marseys = marseys.order_by(Marsey.count.desc(), User.username).all()
|
||||
|
||||
original = os.listdir("/asset_submissions/marseys/original")
|
||||
for marsey, user in marseys:
|
||||
for x in IMAGE_FORMATS:
|
||||
if f'{marsey.name}.{x}' in original:
|
||||
marsey.og = f'{marsey.name}.{x}'
|
||||
break
|
||||
else:
|
||||
marseys = g.db.query(Marsey).filter(Marsey.submitter_id==None).order_by(Marsey.count.desc())
|
||||
|
||||
marseys = get_marseys(g.db)
|
||||
authors = get_accounts_dict([m.author_id for m in marseys], v=v, graceful=True, include_shadowbanned=False)
|
||||
original = os.listdir("/asset_submissions/marseys/original")
|
||||
for marsey in marseys:
|
||||
marsey.user = authors.get(marsey.author_id)
|
||||
for x in IMAGE_FORMATS:
|
||||
if f'{marsey.name}.{x}' in original:
|
||||
marsey.og = f'{marsey.name}.{x}'
|
||||
break
|
||||
return render_template("marseys.html", v=v, marseys=marseys)
|
||||
|
||||
@app.get("/emojis")
|
||||
|
|
|
@ -5,46 +5,41 @@
|
|||
<div class="overflow-x-auto mt-3"><table class="table table-striped mb-5">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th onclick="sort_table(0)">#</th>
|
||||
<th onclick="sort_table(1)">Name</th>
|
||||
<th>Marsey</th>
|
||||
<th href="/marseys">Usage</th>
|
||||
{% if SITE == 'rdrama.net' %}
|
||||
<th><a href="?sort=author">Author</a></th>
|
||||
<th><a href="?sort=added">Added on</a></th>
|
||||
<th onclick="sort_table(3)">Usage</th>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<th onclick="sort_table(4)">Author</th>
|
||||
{% endif %}
|
||||
<th onclick="sort_table(5)">Added on</th>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<th>Original File</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="marseys-table">
|
||||
{% if SITE == 'rdrama.net' %}
|
||||
{% for marsey, user in marseys %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{{marsey.name}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":#{{marsey.name}}:" title=":{{marsey.name}}:" src="/e/{{marsey.name}}.webp"></td>
|
||||
<td>{{marsey.count}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td {% if marsey.created_utc != None %}data-time="{{marsey.created_utc}}"{% endif %}></td>
|
||||
<td>
|
||||
{% if marsey.og %}
|
||||
<a href="/asset_submissions/marseys/original/{{marsey.og}}">{{marsey.og}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for marsey in marseys %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{{marsey.name}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":#{{marsey.name}}:" title=":{{marsey.name}}:" src="/e/{{marsey.name}}.webp"></td>
|
||||
<td>{{marsey.count}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for marsey in marseys %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td data-sort-key="{{marsey.name}}">{{marsey.name}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":#{{marsey.name}}:" title=":{{marsey.name}}:" src="/e/{{marsey.name}}.webp"></td>
|
||||
<td>{{marsey.count}}</td>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
{% set user = marsey.user %}
|
||||
<td data-sort-key="{{user.username.lower() if user else ''}}">{% include "user_in_table.html" %}</td>
|
||||
{% endif %}
|
||||
<td data-sort-key="{{marsey.created_utc or 0}}" {% if marsey.created_utc != None %}data-time="{{marsey.created_utc}}"{% endif %}></td>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<td>
|
||||
{% if marsey.og %}
|
||||
<a href="/asset_submissions/marseys/original/{{marsey.og}}">{{marsey.og}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script defer src="{{'js/sort_table.js' | asset}}"></script>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue