forked from retoor/devplacepy
Show a post's image on its card, and show it full size
_attachment_display.html iterates a context variable named `attachments`, so every caller binds it before the include. _post_card.html was the one caller that did not: it guarded on item.attachments but included the partial with nothing bound, so the gallery looped over whatever `attachments` happened to be in the surrounding page context and rendered empty. Every post with an image looked image-less on the feed and on profiles, and on a project page - where project_detail.html sets `attachments` at template scope for the project's own files - a devlog card would have rendered the project's files as its own. With the image actually reaching the card, render a lone one properly: a gallery holding exactly one item gets a `single` class and takes the full content column (max-height 480px, object-fit contain, no hover scale), matching the original DevPlace. That branch serves the stored original rather than thumbnail_url, because a thumbnail is 200px on its longest side and stretching it to the column width is visibly blurry. Animated GIFs needed no change and now have a test proving it: they never had a thumbnail to flatten, so they already took the original-file path and simply render larger. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -344,6 +344,23 @@ def paste_image(page, selector, name="pasted.png"):
|
||||
)
|
||||
|
||||
|
||||
def create_post_with_files(page, content, files, expected_count=1):
|
||||
from playwright.sync_api import expect
|
||||
|
||||
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
|
||||
page.locator(".feed-fab").first.wait_for(state="visible", timeout=10000)
|
||||
page.locator(".feed-fab").first.click()
|
||||
page.fill("#post-content", content)
|
||||
page.locator("#create-post-modal dp-upload .dp-upload-input").first.set_input_files(
|
||||
files
|
||||
)
|
||||
expect(
|
||||
page.locator("#create-post-modal dp-upload .dp-upload-count").first
|
||||
).to_have_text(f"({expected_count})", timeout=15000)
|
||||
page.locator("#create-post-modal button.btn-primary:has-text('Post')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
|
||||
|
||||
def assert_share_copies(page, expected_fragment):
|
||||
from playwright.sync_api import expect
|
||||
|
||||
|
||||
Reference in New Issue
Block a user