Revise 16587cdf7cf5, expand assetcache.

Assetcache: now supports js/userpage.js & js/userpage_v.js.
The three userpage*.html templates now implement it.

Revising gift messages 16587cdf7cf5:
  - routes/users.py: Deduplicate code, more descriptive var name.
  - templates/userpage.html: Move post-tax gift line below reasons
    box. Ultimately just an aesthetic change.
master
Snakes 2022-06-01 00:05:14 -04:00
parent 453d5f57a3
commit 1d49012c16
5 changed files with 20 additions and 16 deletions

View File

@ -418,10 +418,11 @@ def transfer_coins(v, username):
receiver.coins += amount-tax
v.coins -= amount
if reason: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!\n\n> {reason}"
else: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!"
notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount-tax} coins!"
if reason:
notif_text += f"\n\n> {reason}"
send_repeatable_notification(receiver.id, text)
send_repeatable_notification(receiver.id, notif_text)
g.db.add(receiver)
g.db.add(v)
@ -457,10 +458,11 @@ def transfer_bux(v, username):
receiver.procoins += amount
v.procoins -= amount
if reason: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!\n\n> {reason}"
else: text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!"
notif_text = f":marseycapitalistmanlet: @{v.username} has gifted you {amount} bux!"
if reason:
notif_text += f"\n\n> {reason}"
send_repeatable_notification(receiver.id, text)
send_repeatable_notification(receiver.id, notif_text)
g.db.add(receiver)
g.db.add(v)

View File

@ -214,15 +214,15 @@
<div class="d-none mt-3 toggleable" id="coin-transfer">
<input autocomplete="off" id="coin-transfer-amount" class="form-control" name="amount" type="number" oninput="updateTax()">
<div>{{u.username}} will receive <span id="coins-transfer-taxed">0</span> coins</div>
<input autocomplete="off" id="coin-transfer-reason" type="text" class="form-control" name="reason" placeholder="Gift message! (optional)">
<div>{{u.username}} will receive <span id="coins-transfer-taxed">0</span> coins</div>
<button class="btn btn-primary mt-3" onclick="transferCoins()">Gift</button>
</div>
<div class="d-none mt-3 toggleable" id="bux-transfer">
<input autocomplete="off" id="bux-transfer-amount" class="form-control" name="amount" type="number" oninput="updateBux()">
<div>{{u.username}} will receive <span id="bux-transfer-taxed">0</span> marseybux</div>
<input autocomplete="off" id="bux-transfer-reason" type="text" class="form-control" name="reason" placeholder="Gift message! (optional)">
<div>{{u.username}} will receive <span id="bux-transfer-taxed">0</span> marseybux</div>
<button class="btn btn-primary mt-3" onclick="transferBux()">Gift</button>
</div>
@ -524,15 +524,15 @@
<div class="d-none mt-3 toggleable" id="coin-transfer-mobile">
<input autocomplete="off" id="coin-transfer-amount-mobile" class="form-control" name="amount" type="number" oninput="updateTax(true)">
<div>{{u.username}} will receive <span id="coins-transfer-taxed-mobile">0</span> coins</div>
<input autocomplete="off" id="coin-transfer-reason-mobile" type="text" class="form-control" name="reason" placeholder="Gift message! (optional)">
<div>{{u.username}} will receive <span id="coins-transfer-taxed-mobile">0</span> coins</div>
<button class="btn btn-primary mt-2 mb-3" onclick="transferCoins(true)">Gift</button>
</div>
<div class="d-none mt-3 toggleable" id="bux-transfer-mobile">
<input autocomplete="off" id="bux-transfer-amount-mobile" class="form-control" name="amount" type="number" oninput="updateBux(true)">
<div>{{u.username}} will receive <span id="bux-transfer-taxed-mobile">0</span> marseybux</div>
<input autocomplete="off" id="bux-transfer-reason-mobile" type="text" class="form-control" name="reason" placeholder="Gift message! (optional)">
<div>{{u.username}} will receive <span id="bux-transfer-taxed-mobile">0</span> marseybux</div>
<button class="btn btn-primary mt-2 mb-3" onclick="transferBux(true)">Gift</button>
</div>
@ -741,11 +741,11 @@
{% if v %}
<div id='tax' class="d-none">{% if v.patron or u.patron or v.alts_patron or u.alts_patron %}0{% else %}0.03{% endif %}</div>
<script src="/assets/js/userpage_v.js?v=244"></script>
<script src="{{asset('js/userpage_v.js')}}"></script>
<div id="username" class="d-none">{{u.username}}</div>
{% endif %}
<script src="/assets/js/userpage.js?v=241"></script>
<script src="{{asset('js/userpage.js')}}"></script>
{% endblock %}

View File

@ -114,9 +114,9 @@
{% if v %}
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
<script src="/assets/js/userpage_v.js?v=244"></script>
<script src="{{asset('js/userpage_v.js')}}"></script>
<div id="username" class="d-none">{{u.username}}</div>
{% endif %}
<script src="/assets/js/userpage.js?v=241"></script>
<script src="{{asset('js/userpage.js')}}"></script>
{% endblock %}

View File

@ -32,9 +32,9 @@
{% if v %}
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
<script src="/assets/js/userpage_v.js?v=244"></script>
<script src="{{asset('js/userpage_v.js')}}"></script>
<div id="username" class="d-none">{{u.username}}</div>
{% endif %}
<script src="/assets/js/userpage.js?v=241"></script>
<script src="{{asset('js/userpage.js')}}"></script>
{% endblock %}

View File

@ -19,6 +19,8 @@ set CACHE_VER = {
'js/bootstrap.js': 258,
'js/header.js': 269,
'js/lottery.js': 253,
'js/userpage.js': 241,
'js/userpage_v.js': 245,
'images/badges/': 1020,
}