Website 1.7.1: move and zoom for ministries', leaders' and events' photos

1.7.0 had Move and zoom in page sections only. Ministries, Leadership
and Events now have it on their photo, in the frame the site uses for
the current template and layouts. Saved with the row as `framing`
({ x, y, zoom }, null for centred; cleared when the photo changes).
Ministries and leaders are drafts until Publish (snapshot, Discard and
Restore carry it); an event's shows once the event is published.
Versions published before this compare unchanged.

One migration: a nullable JSONB `framing` column on Ministry, Leader
and SimpleEvent.

Also: the 1.7.0 e2e test waits for the media library to load before
counting it (it could count an empty list).

Checked: Website backend tests (136) and typecheck, frontend typecheck
and lint, production build, admin e2e suite in Chromium (12).
Lighthouse not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 00:27:54 +02:00
co-authored by Claude Opus 5.5
parent 4897489fb1
commit 0c521ff614
23 changed files with 212 additions and 40 deletions
+21
View File
@@ -212,6 +212,8 @@ test("move and zoom a photo in its frame, then delete a photo nothing uses", asy
// Upload one nothing uses, then delete it; one in use says where instead.
await page.goto("/admin/media");
// Count once the library has loaded (it can still be empty for a moment).
await expect(page.locator("main li").first()).toBeVisible();
const before = await page.locator("main li").count();
const png = Buffer.from("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==", "base64");
await page.locator('input[type="file"]').setInputFiles({ name: "dot.png", mimeType: "image/png", buffer: png });
@@ -224,3 +226,22 @@ test("move and zoom a photo in its frame, then delete a photo nothing uses", asy
await expect(page.getByText("Deleted.")).toBeVisible();
await expect(page.locator("main li")).toHaveCount(before);
});
test("move and zoom a ministry's, a leader's and an event's photo", async ({ page, context }) => {
await signIn(context);
for (const [path, saved] of [["/admin/ministries", "Saved as a draft."], ["/admin/leaders", "Saved as a draft."], ["/admin/events", null]] as const) {
await page.goto(path);
await page.getByRole("button", { name: "Edit", exact: true }).first().click();
await page.getByRole("button", { name: "Move and zoom" }).first().click();
const dialog = page.getByRole("dialog", { name: "Move and zoom the photo" });
await dialog.getByRole("slider").fill("2");
await dialog.getByRole("button", { name: "Done" }).click();
await expect(page.getByText("Moved and zoomed to 200%")).toBeVisible();
await page.getByRole("button", { name: "Save", exact: true }).click();
if (saved) await expect(page.getByText(saved)).toBeVisible();
else await expect(page.getByRole("button", { name: "Save", exact: true })).toHaveCount(0);
// Saved with the row: it's there when the form opens again.
await page.getByRole("button", { name: "Edit", exact: true }).first().click();
await expect(page.getByText("Moved and zoomed to 200%")).toBeVisible();
}
});