Add a Schedule content block with day tabs
A schedule block's entries (migration 034) each have a day, time, title, detail, location, person and link, and fold out for a longer description, the person's photo and page, a graphic and a Google map of a place or address. Entries sit in one tab per day, in the order entered; the tab for today's weekday opens first, and a one-day schedule draws no tabs. In the editor, the entry fields show only under a schedule block: repeater `when` can now look at the parent row (scope "parent"), and a field's label can depend on the row. The block preview names an entry's person. The showcase retreat and post each have a schedule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d6477b6d30
commit
71a470b66f
10 changed files with 556 additions and 29 deletions
|
|
@ -98,18 +98,39 @@ export function loadBlocks(db, ownerKind, ids, slot = "body") {
|
|||
|
||||
const itemRows = db
|
||||
.prepare(
|
||||
`SELECT block_id, text, detail, url
|
||||
FROM content_block_items
|
||||
WHERE block_id IN (${placeholders(blockIds.length)})
|
||||
ORDER BY block_id, sort_order`,
|
||||
`SELECT i.block_id, i.text, i.detail, i.url,
|
||||
i.day, i.time, i.location, i.description, i.media, i.map,
|
||||
p.id AS person_id, p.display_name AS person_name,
|
||||
p.photo AS person_photo, p.tagline AS person_tagline
|
||||
FROM content_block_items i
|
||||
LEFT JOIN people p ON p.id = i.person_id AND p.is_published = 1
|
||||
WHERE i.block_id IN (${placeholders(blockIds.length)})
|
||||
ORDER BY i.block_id, i.sort_order`,
|
||||
)
|
||||
.all(...blockIds);
|
||||
|
||||
// The schedule fields are null on a list or link-row item; they
|
||||
// ride along anyway rather than branching on the block's type.
|
||||
// An unpublished person comes back as no person.
|
||||
for (const row of itemRows) {
|
||||
byId.get(row.block_id)?.items.push({
|
||||
text: row.text,
|
||||
detail: row.detail,
|
||||
url: row.url,
|
||||
day: row.day,
|
||||
time: row.time,
|
||||
location: row.location,
|
||||
description: row.description,
|
||||
media: row.media,
|
||||
map: row.map,
|
||||
person: row.person_id
|
||||
? {
|
||||
id: row.person_id,
|
||||
name: row.person_name,
|
||||
photo: row.person_photo,
|
||||
tagline: row.person_tagline,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue