Front page: set the featured cards' grid by hand, columns and a size per card (migration 073)
Front page editor: Featured Content > Columns (2, 3 or 4 across on a wide screen) and a Size on each card (normal, wide, tall, large). Blank keeps today's layout: 3 across, the first of three or more large. Regions and the Community blog stay automatic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
910aef78b5
commit
31d9f78120
11 changed files with 130 additions and 23 deletions
|
|
@ -105,6 +105,8 @@ export const featuredCardsChild = (ownerKind) => ({
|
|||
text("title"),
|
||||
text("blurb"),
|
||||
text("image"),
|
||||
// Its shape in the grid (073); only the Front page editor sets it.
|
||||
enumeration("size", ["normal", "wide", "tall", "large"]),
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ export const frontPage = {
|
|||
text("countdown_event_id"),
|
||||
text("countdown_scope_id"),
|
||||
enumeration("countdown_event_type", ["retreat", "class", "workshop", "meeting", "other"]),
|
||||
int("featured_columns"),
|
||||
],
|
||||
|
||||
children: [
|
||||
|
|
|
|||
21
server/src/migrations/073_featured_grid.sql
Normal file
21
server/src/migrations/073_featured_grid.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
-- ═══════════════════════════════════════════════════════════════
|
||||
-- 073 FEATURED GRID
|
||||
--
|
||||
-- The front page's featured cards get a hand-set shape:
|
||||
--
|
||||
-- front_page.featured_columns 2, 3 or 4 across on a wide screen;
|
||||
-- null is 3, as before
|
||||
-- featured_cards.size normal, wide (2 columns), tall
|
||||
-- (2 rows) or large (both); null is
|
||||
-- automatic, as before: the first of
|
||||
-- three or more cards is large
|
||||
--
|
||||
-- Only the Front page editor offers them. A region's or the
|
||||
-- Community blog's cards keep a null size, so they lay out as before.
|
||||
-- ═══════════════════════════════════════════════════════════════
|
||||
|
||||
ALTER TABLE front_page ADD COLUMN featured_columns INTEGER
|
||||
CHECK (featured_columns IN (2, 3, 4));
|
||||
|
||||
ALTER TABLE featured_cards ADD COLUMN size TEXT
|
||||
CHECK (size IN ('normal', 'wide', 'tall', 'large'));
|
||||
|
|
@ -233,6 +233,8 @@ home.get("/front-page", (c) => {
|
|||
stats,
|
||||
paths,
|
||||
featured: loadFeaturedCards(db, "front_page", PAGE_ID),
|
||||
// 2, 3 or 4 across (073); null is the grid's own default.
|
||||
featured_columns: page.featured_columns,
|
||||
countdown: shapeCountdown(next),
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -238,7 +238,8 @@ export function shapeSeries(row) {
|
|||
tables keep bare filenames in different public/ directories,
|
||||
and logoForKind in media.ts knows which is which. The kinds are
|
||||
the ref kinds, plus 'event-photo' and 'featured' (the
|
||||
card's own image). An unpublished
|
||||
card's own image). `size` is its shape in the grid (073), null
|
||||
for automatic. An unpublished
|
||||
record's card is dropped; an unlisted one's stays, since
|
||||
featuring it is attaching it by hand.
|
||||
───────────────────────────────────────────────────────────── */
|
||||
|
|
@ -329,6 +330,7 @@ export function loadFeaturedCardsFor(db, ownerKind, ownerIds) {
|
|||
title: row.title ?? record.title,
|
||||
blurb: row.blurb ?? record.blurb ?? null,
|
||||
image: own(row) ?? FEATURED_REFS[row.ref_kind].image(record),
|
||||
size: row.size,
|
||||
});
|
||||
} else {
|
||||
cards.push({
|
||||
|
|
@ -339,6 +341,7 @@ export function loadFeaturedCardsFor(db, ownerKind, ownerIds) {
|
|||
title: row.title,
|
||||
blurb: row.blurb,
|
||||
image: own(row),
|
||||
size: row.size,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue