more hat shit

master
Aevann1 2022-09-03 05:04:51 +02:00
parent 0839077838
commit 48affb53e6
10 changed files with 32 additions and 17 deletions

View File

@ -4876,7 +4876,7 @@ code {
.noshadow {
box-shadow: none !important;
}
[role="button"] {
[role="button"], [onclick] {
cursor: pointer !important;
}

View File

@ -1,6 +1,8 @@
from sqlalchemy import *
from sqlalchemy.orm import relationship
from files.__main__ import Base
from files.helpers.lazy import lazy
from flask import g
class HatDef(Base):
__tablename__ = "hat_defs"
@ -13,6 +15,11 @@ class HatDef(Base):
author = relationship("User", primaryjoin="HatDef.author_id == User.id")
@property
@lazy
def number_sold(self):
return g.db.query(Hat).filter_by(hat_id=self.id).count()
class Hat(Base):
__tablename__ = "hats"

View File

@ -13,8 +13,8 @@
<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>
<th onclick="sort_table(2)" style="text-align:right;">Truescore</th>
<th onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
</tr>
</thead>

View File

@ -14,12 +14,12 @@
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th role="button" onclick="sort_table(0)">#</th>
<th onclick="sort_table(0)">#</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>
<th onclick="sort_table(4)">#</th>
<th onclick="sort_table(4)">Rarity</th>
</tr>
</thead>

View File

@ -27,8 +27,12 @@
<th scope="col">Description</th>
{% if SITE == 'rdrama.net' %}
<th scope="col">Author</th>
<th scope="col" onclick="sort_table(4)">Number Sold</th>
<th scope="col" onclick="sort_table(5)">Price</th>
{% else %}
<th scope="col" onclick="sort_table(3)">Number Sold</th>
<th scope="col" onclick="sort_table(4)">Price</th>
{% endif %}
<th scope="col">Price</th>
<th scope="col">Actions</th>
</tr>
</thead>
@ -42,6 +46,7 @@
{% if SITE == 'rdrama.net' %}
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
{% endif %}
<td>{{hat.number_sold}}</td>
<td>{{hat.price}}</td>
<td class="shop-table-actions">
{% if hat.id == v.equipped_hat.id %}
@ -61,6 +66,7 @@
{% if SITE == 'rdrama.net' %}
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
{% endif %}
<td>{{hat.number_sold}}</td>
<td>{{hat.price}}</td>
<td class="shop-table-actions">
<a id="buy1-{{hat.id}}" class="btn btn-success {% if v.coins < hat.price %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy1-go-{{hat.id}}').classList.remove('d-none')"><span class="m-auto">Buy</span></a>
@ -84,4 +90,5 @@
</pre>
{% endblock %}
<script src="/assets/js/sort_table.js?v=244"></script>
{% endblock %}

View File

@ -19,8 +19,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>

View File

@ -38,7 +38,7 @@
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Owned</th>
<th scope="col" onclick="sort_table(3)">Owned</th>
<th scope="col">Buy</th>
<th scope="col">Description</th>
</tr>
@ -80,4 +80,5 @@
</pre>
<script src="/assets/js/sort_table.js?v=244"></script>
{% endblock %}

View File

@ -12,7 +12,7 @@
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)">Posts</th>
<th onclick="sort_table(2)">Posts</th>
</tr>
</thead>

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 502,
'css/main.css': 503,
'css/catalog.css': 2,
'css/4chan.css': 61,

View File

@ -31,8 +31,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>
@ -59,8 +59,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>