use <a> tags for card_badge and trade_offer clickable areas (except for main card_badge row on trade_offers, still uses @click for now because the a tag can't wrap that content for some reason). closes #14
This commit is contained in:
parent
86b061c971
commit
afaa392b2f
22 changed files with 247 additions and 227 deletions
|
|
@ -42,7 +42,7 @@ class TradeOfferCreateView(LoginRequiredMixin, CreateView):
|
|||
context = super().get_context_data(**kwargs)
|
||||
from cards.models import Card
|
||||
# Ensure available_cards is a proper QuerySet
|
||||
context["cards"] = Card.objects.all().order_by("name", "rarity_level")
|
||||
context["cards"] = Card.objects.filter(rarity_level__lte=5).order_by("name", "rarity_level")
|
||||
friend_codes = self.request.user.friend_codes.all()
|
||||
if "initiated_by" in self.request.GET:
|
||||
try:
|
||||
|
|
@ -245,8 +245,8 @@ class TradeOfferSearchView(ListView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
from cards.models import Card
|
||||
# Populate available_cards to re-populate the multiselects.
|
||||
context["cards"] = Card.objects.all().order_by("name")
|
||||
# Populate available_cards to re-populate the multiselects. Exclude cards with rarity level > 5.
|
||||
context["cards"] = Card.objects.filter(rarity_level__lte=5).order_by("name", "rarity_level")
|
||||
if self.request.method == "POST":
|
||||
context["have_cards"] = self.request.POST.getlist("have_cards")
|
||||
context["want_cards"] = self.request.POST.getlist("want_cards")
|
||||
|
|
@ -515,7 +515,7 @@ class TradeOfferPNGView(View):
|
|||
return HttpResponse(trade_offer.image.read(), content_type="image/png")
|
||||
|
||||
tag_context = render_trade_offer_png(
|
||||
{'request': request}, trade_offer, show_friend_code=True
|
||||
{'request': request}, trade_offer, show_friend_code=trade_offer.initiated_by.user.show_friend_code_on_link_previews
|
||||
)
|
||||
image_width = tag_context.get('image_width')
|
||||
image_height = tag_context.get('image_height')
|
||||
|
|
@ -547,7 +547,7 @@ class TradeOfferPNGView(View):
|
|||
page.on("console", lambda msg: print(f"Console {msg.type}: {msg.text}"))
|
||||
page.on("pageerror", lambda err: print(f"Page error: {err}"))
|
||||
page.on("requestfailed", lambda req: print(f"Failed to load: {req.url} - {req.failure.error_text}"))
|
||||
page.set_content(html, wait_until="domcontentloaded")
|
||||
page.set_content(html, wait_until="networkidle")
|
||||
element = page.wait_for_selector(".trade-offer-card-screenshot")
|
||||
screenshot_bytes = element.screenshot(type="png", omit_background=True)
|
||||
browser.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue