remotes/1693045480750635534/spooky-22
Aevann1 2021-10-21 15:30:05 +02:00
parent 38a7632c25
commit 48d909e015
6 changed files with 115 additions and 11 deletions

View File

@ -146,7 +146,8 @@ def shop(v):
elif v.patron == 4: val["price"] = int(val["price"]*0.75)
else: val["price"] = int(val["price"]*0.70)
return render_template("settings_shop.html", owned=owned, awards=list(AWARDS.values()), v=v)
sales = g.db.query(Vote.id).count() + g.db.query(CommentVote.id).count() - g.db.query(func.sum(User.coins)).scalar()
return render_template("shop.html", owned=owned, awards=list(AWARDS.values()), v=v, sales=sales)
@app.post("/buy/<award>")

View File

@ -268,11 +268,13 @@
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" style="overflow-x: hidden; {% if v and v.background %} background:url(/assets/images/backgrounds/{{v.background}}) no-repeat center center fixed !important; background-size: cover!important; background-color: #000!important;{% endif %} {% if 'rama' in request.host %}margin-top: 29px!important;{% endif %}">
{% if '@' not in request.path %}
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
<img loading="lazy" style="margin-top: -3px;" src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.gif{% else %}cached.gif{% endif %}" width="100%">
</a>
{% endif %}
{% block Banner %}
{% if '@' not in request.path %}
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
<img loading="lazy" style="margin-top: -3px;" src="/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.gif{% else %}cached.gif{% endif %}" width="100%">
</a>
{% endif %}
{% endblock %}
{% include "header.html" %}

View File

@ -98,7 +98,7 @@
</li>
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
<a class="nav-link" href="/settings/shop" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shop"><i class="fas fa-store"></i></a>
<a class="nav-link" href="/shop" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shop"><i class="fas fa-store"></i></a>
</li>
<li class="nav-item d-flex align-items-center justify-content-center text-center">

View File

@ -56,8 +56,8 @@
</button>
{% if v %}
<button type="button" class="col px-0 mr-3 btn btn-dead m-0" style="background: None !important; border: None;">
<a href="/settings/shop" class="text-decoration-none" role="button">
<div class="text-center {% if request.path=='/settings/shop' %}text-primary{% else %}text-muted{% endif %}">
<a href="/shop" class="text-decoration-none" role="button">
<div class="text-center {% if request.path=='/shop' %}text-primary{% else %}text-muted{% endif %}">
<i class="fas fa-store text-lg"></i>
<div class="text-small">Shop</div>
</div>

View File

@ -128,7 +128,7 @@
<a class="nav-link{% if request.path=='/settings/apps' %} active{% endif %}" href="/settings/apps">Apps</a>
</li>
<li class="nav-item">
<a class="nav-link{% if 'shop' in request.path %} active{% endif %}" href="/settings/shop">Shop</a>
<a class="nav-link{% if 'shop' in request.path %} active{% endif %}" href="/shop">Shop</a>
</li>
</ul>
@ -160,7 +160,7 @@
<a class="nav-link{% if request.path=='/settings/apps' %} active{% endif %} navsettings" href="/settings/apps"><i class="fas fa-code text-base mr-0"></i></a>
</li>
<li class="nav-item">
<a class="nav-link{% if 'shop' in request.path %} active{% endif %} navsettings" href="/settings/shop"><i class="fas fa-store text-base mr-0"></i></a>
<a class="nav-link{% if 'shop' in request.path %} active{% endif %} navsettings" href="/shop"><i class="fas fa-store text-base mr-0"></i></a>
</li>
</ul>

View File

@ -0,0 +1,101 @@
{% extends "default.html" %}
{% block title %}
<title>Shop</title>
{% endblock %}
{% block pagetype %}message{% endblock %}
{% block Banner %}
<header class="text-center">
<img src="/assets/images/shop.gif" width="50%">
<h3 class="mt-4">Stir drama. Earn coins.</h3>
<h5 class="mt-4">Total sales: {{sales}} dramacoins</h3>
</header>
{% endblock %}
{% block content %}
{% if error %}
<div class="alert alert-danger alert-dismissible fade show my-3" role="alert">
<i class="fas fa-exclamation-circle my-auto"></i>
<span>
{{error}}
</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
{% if msg %}
<div class="alert alert-success alert-dismissible fade show my-3" role="alert">
<i class="fas fa-check-circle my-auto" aria-hidden="true"></i>
<span>
{{msg}}
</span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
<pre></pre>
<pre></pre>
<h5>Owned Awards</h5>
<table class="table table-striped">
<thead class="bg-primary text-white">
<tr>
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Owned</th>
</tr>
</thead>
<tbody>
{% for a in owned %}
<tr>
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
<td style="font-weight: bold">{{a['title']}}</td>
<td style="font-weight: bold">{{a['description']}}</td>
<td style="font-weight: bold">{{a['owned_num']}}</td>
</tr>
{% endfor %}
</table>
<pre>
</pre>
<h5>Shop</h5>
<table class="table table-striped">
<thead class="bg-primary text-white">
<tr>
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Description</th>
<th scope="col">Price</th>
<th scope="col">Buy</th>
</tr>
</thead>
<tbody>
{% for a in awards %}
<tr>
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
<td style="font-weight: bold">{{a['title']}}</td>
<td style="font-weight: bold">{{a['description']}}</td>
<td style="font-weight: bold">{{a['price']}}</td>
{% set kind = a['kind'] %}
<td style="font-weight: bold"><a class="btn btn-success" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')">Buy</a></td>
</tr>
{% endfor %}
</table>
<pre>
</pre>
{% endblock %}