From fa4f38301b80dfb0a143b4d30a96da954647c291 Mon Sep 17 00:00:00 2001
From: badbl0cks <4161747+badbl0cks@users.noreply.github.com>
Date: Thu, 3 Apr 2025 20:54:09 -0700
Subject: [PATCH] Reduce size of card badges, and change trade offers to show
all cards by default, but in minimized mode. expand button now toggles
between minimized mode and expanded mode for all cards on the trade offer
---
cards/templatetags/card_badge.py | 6 +-
theme/templates/cards/_card_list.html | 8 +-
theme/templates/cards/_trade_offer_list.html | 6 +-
theme/templates/cards/card_detail.html | 2 -
theme/templates/cards/card_list.html | 4 +-
theme/templates/home/_card_list.html | 14 +-
theme/templates/trades/_trade_offer_list.html | 2 +-
.../trades/trade_acceptance_create.html | 2 +-
.../trades/trade_offer_all_list.html | 2 +-
.../templates/trades/trade_offer_detail.html | 2 +-
theme/templatetags/card_badge.html | 25 ++-
theme/templatetags/trade_acceptance.html | 6 +-
theme/templatetags/trade_offer.html | 158 +++++-------------
theme/templatetags/trade_offer_png.html | 96 +++--------
trades/templatetags/trade_offer_tags.py | 16 +-
trades/views.py | 4 +-
16 files changed, 117 insertions(+), 236 deletions(-)
diff --git a/cards/templatetags/card_badge.py b/cards/templatetags/card_badge.py
index 4d5991b..d679d81 100644
--- a/cards/templatetags/card_badge.py
+++ b/cards/templatetags/card_badge.py
@@ -5,17 +5,18 @@ from django.utils.safestring import mark_safe
register = template.Library()
@register.inclusion_tag("templatetags/card_badge.html")
-def card_badge(card, quantity=1):
+def card_badge(card, quantity=None, static=False):
return {
'quantity': quantity,
'style': card.style,
'name': card.name,
'rarity': card.rarity_icon,
'cardset': card.cardset,
+ 'static': static,
}
@register.filter
-def card_badge_inline(card, quantity=1):
+def card_badge_inline(card, quantity=None):
"""
Renders an inline card badge.
"""
@@ -25,5 +26,6 @@ def card_badge_inline(card, quantity=1):
'name': card.name,
'rarity': card.rarity_icon,
'cardset': card.cardset,
+ 'static': True,
})
return mark_safe(html)
\ No newline at end of file
diff --git a/theme/templates/cards/_card_list.html b/theme/templates/cards/_card_list.html
index 7336637..dcb3728 100644
--- a/theme/templates/cards/_card_list.html
+++ b/theme/templates/cards/_card_list.html
@@ -3,19 +3,19 @@
{% if group_by and groups %}
{% for group in groups %}
{{ group.group }}
-
+
{% endfor %}
{% else %}
-
+
diff --git a/theme/templates/cards/_trade_offer_list.html b/theme/templates/cards/_trade_offer_list.html
index 616c96c..e7f586e 100644
--- a/theme/templates/cards/_trade_offer_list.html
+++ b/theme/templates/cards/_trade_offer_list.html
@@ -1,10 +1,8 @@
{% load trade_offer_tags %}
{% if trade_offers %}
-
+
{% for offer in trade_offers %}
-
- {% render_trade_offer offer %}
-
+ {% render_trade_offer offer %}
{% endfor %}
{% else %}
diff --git a/theme/templates/cards/card_detail.html b/theme/templates/cards/card_detail.html
index b1264fa..53c3310 100644
--- a/theme/templates/cards/card_detail.html
+++ b/theme/templates/cards/card_detail.html
@@ -1,7 +1,6 @@
{% extends "base.html" %}
{% load static card_badge %}
{% block content %}
-
{% endblock %}
\ No newline at end of file
diff --git a/theme/templates/cards/card_list.html b/theme/templates/cards/card_list.html
index 02b1cc4..3afa7bd 100644
--- a/theme/templates/cards/card_list.html
+++ b/theme/templates/cards/card_list.html
@@ -27,13 +27,13 @@
diff --git a/theme/templates/home/_card_list.html b/theme/templates/home/_card_list.html
index 1d7e345..ad4b36e 100644
--- a/theme/templates/home/_card_list.html
+++ b/theme/templates/home/_card_list.html
@@ -1,13 +1,13 @@
{% load card_badge %}
{% if cards %}
+ {% for card in cards %}
+
+ {% card_badge card quantity=card.offer_count static=True %}
+
+ {% endfor %}
+
{% else %}
No cards found
{% endif %}
\ No newline at end of file
diff --git a/theme/templates/trades/_trade_offer_list.html b/theme/templates/trades/_trade_offer_list.html
index 85ec100..8f1ad71 100644
--- a/theme/templates/trades/_trade_offer_list.html
+++ b/theme/templates/trades/_trade_offer_list.html
@@ -4,7 +4,7 @@
For a TradeOffer, we use {% render_trade_offer %}; for a TradeAcceptance, {% render_trade_acceptance %}.
{% endcomment %}
-
+
{% for offer in offers %}
{% if offer.accepted_by %}
diff --git a/theme/templates/trades/trade_acceptance_create.html b/theme/templates/trades/trade_acceptance_create.html
index cfc19fa..f72393b 100644
--- a/theme/templates/trades/trade_acceptance_create.html
+++ b/theme/templates/trades/trade_acceptance_create.html
@@ -8,7 +8,7 @@
{% if form.errors %}
diff --git a/theme/templates/trades/trade_offer_all_list.html b/theme/templates/trades/trade_offer_all_list.html
index 95f0645..c1591df 100644
--- a/theme/templates/trades/trade_offer_all_list.html
+++ b/theme/templates/trades/trade_offer_all_list.html
@@ -4,7 +4,7 @@
{% block title %}Trade Offers{% endblock title %}
{% block content %}
-
{% endif %}
-
+
{% if is_initiator %}
Delete/Close Trade Offer
{% elif request.user.is_authenticated %}
diff --git a/theme/templatetags/card_badge.html b/theme/templatetags/card_badge.html
index e8eaaf4..1447891 100644
--- a/theme/templatetags/card_badge.html
+++ b/theme/templatetags/card_badge.html
@@ -1,8 +1,19 @@
-
-
-
{{ name }}
-
{{ rarity }}
-
{{ cardset }}
+{% if not static %}
+
+
+
{{ name }}
+
{{ rarity }}
+
{{ cardset }}
+ {% if quantity != None %}
{% endif %}
- {% if quantity != "" %}
{{ quantity }} {% endif %}
-
\ No newline at end of file
+
+{% else %}
+
+
+
{{ name }}
+
{{ rarity }}
+
{{ cardset }}
+ {% if quantity != None %}
{% endif %}
+
+
+{% endif %}
\ No newline at end of file
diff --git a/theme/templatetags/trade_acceptance.html b/theme/templatetags/trade_acceptance.html
index 1843b93..6f8f6c2 100644
--- a/theme/templatetags/trade_acceptance.html
+++ b/theme/templatetags/trade_acceptance.html
@@ -1,6 +1,6 @@
{% load gravatar card_badge %}
-
+
@@ -40,11 +40,11 @@
-
+
{{ acceptance.get_state_display }}
-
+
diff --git a/theme/templatetags/trade_offer.html b/theme/templatetags/trade_offer.html
index 528ffcc..d1829c6 100644
--- a/theme/templatetags/trade_offer.html
+++ b/theme/templatetags/trade_offer.html
@@ -2,7 +2,7 @@
{% cache 60 trade_offer offer_pk %}
-
@@ -11,19 +11,19 @@
The rotating element (.flip-inner) now uses CSS Grid to stack its children in a single cell.
Persistent border, shadow, and rounding are applied here and the card rotates entirely.
-->
-