Fix trade offer png generation (fixes #27).

- Updated `card_badge.html` to adjust width properties for better layout consistency.
- Modified `trade_offer_png.html` to change padding for improved visual appearance.
- Enhanced `bubble_up_trade_offer_updates` signal to delete cached images when related instances change, ensuring up-to-date content.
- Updated `TradeOfferPNGView` to pass the request context when rendering the template, improving compatibility with Django's template rendering.
- Refactored `render_trade_offer_png` to use constants for dimensions and improve readability, while also updating context handling for better integration.
This commit is contained in:
badblocks 2025-05-05 21:50:52 -07:00
parent 9c41f63247
commit 9b3b3d099f
5 changed files with 40 additions and 17 deletions

View file

@ -3,8 +3,8 @@
<a href="{{ url }}" @click.stop>
<div class="relative block">
{% if not expanded %}
<div class="flex flex-row items-center h-[32px] p-1.5 w-30 sm:w-40 text-white shadow-lg" style="{{ style }}">
<div class="grow"><div class="truncate text-ellipsis font-semibold leading-tight text-sm marquee-calc w-4/5 sm:w-24">{{ name }}</div></div>
<div class="flex flex-row items-center h-[32px] p-1.5 w-40 text-white shadow-lg" style="{{ style }}">
<div class="grow"><div class="truncate text-ellipsis font-semibold leading-tight text-sm marquee-calc w-24">{{ name }}</div></div>
<div class="grow-0 shrink-0 text-right truncate font-semibold leading-tight text-sm">{{ cardset }}</div>
{% if quantity != None %}
<div class="grow-0 shrink-0 relative w-fit ps-1">
@ -13,7 +13,7 @@
{% endif %}
</div>
{% else %}
<div class="grid grid-rows-2 grid-cols-4 h-[52px] p-1.5 w-30 sm:w-40 text-white shadow-lg" style="{{ style }}">
<div class="grid grid-rows-2 grid-cols-4 h-[52px] p-1.5 w-40 text-white shadow-lg" style="{{ style }}">
<div class="row-start-1 col-start-1 {% if quantity != None %}col-span-3{% else %}col-span-4{% endif %} self-start leading-tight truncate text-ellipsis"><span class="font-semibold text-sm marquee-calc">{{ name }}</span></div>
{% if quantity != None %}
<div class="row-start-1 col-start-4 col-span-1 self-start ms-auto leading-tight relative w-fit ps-1">

View file

@ -9,7 +9,7 @@
</head>
<body style="background-color: transparent !important">
<div
class="trade-offer-card-screenshot p-4 h-full w-auto flex justify-center"
class="trade-offer-card-screenshot p-3 h-full w-auto flex justify-center"
style="background-color: transparent !important"
>
<div class="transition-all duration-500 trade-offer-card my-auto">