Schedule tags: a block's own tags, tag tabs, chips, a tag filter and tag slides

A schedule block gets its own tags (content_block_tags, migration 087):
a name, a color and whether it's a tab. Entries and sub-items pick them
from a checklist. Each tag is a tab after the days, gathering what it's
on from every day under the day's name; a tagged entry comes whole and
an untagged block brings only its tagged sub-items. Rows show their tags
as chips. The presentation can show only one tag's entries and adds a
slide per tag after the days.

Entries name a tag by a key the admin makes when the tag is added, so a
rename keeps them, since the block's rows are rewritten on every save.
For that the admin engine gets a function blank (fresh values for every
new row and copy, with a `seeded` column that doesn't count as input),
`lends` (a row's options for the collections nested in it) and a
checklist widget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-11-03 02:04:06 -06:00
parent 7885d10249
commit 71d58318b6
12 changed files with 539 additions and 122 deletions

View file

@ -402,6 +402,17 @@ export const wordFields = (prefix: string, label: string, when?: any) => [
{ path: `${prefix}word_seconds`, label: label ? `${label}seconds per word` : "Seconds per word", widget: "number", help: "1 to 20. Default: the site's", when },
];
/* An entry's or sub-item's tags (087): the block's, lent by
blocksChild. */
const TAGS_FIELD = {
path: "tags",
label: "Tags",
widget: "checklist",
optionsFrom: "scheduleTags",
full: true,
emptyNote: "No tags yet: add them under the block's Tags.",
};
/* A block entry's sub-item (086): an entry's fields, under its
block's day. */
const SUB_ITEM_FIELDS = [
@ -437,6 +448,7 @@ const SUB_ITEM_FIELDS = [
help: "Optional: your own map, shown in place of the Google map and as a slide when presented",
},
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes it stand out" },
TAGS_FIELD,
];
export const blocksChild = {
@ -536,7 +548,27 @@ export const blocksChild = {
},
...wordFields("", "", { path: "type", value: ["heading", "subheading", "paragraph", "callout", "quote"] }),
],
// A schedule's tags, for its entries' and sub-items' Tags (087).
lends: (row) => ({
scheduleTags: (row.tags ?? [])
.filter((tag) => tag.name?.trim())
.map((tag) => ({ id: tag.tag_key, label: tag.name })),
}),
children: [
{
key: "tags",
label: "Tags",
addLabel: "Add tag",
note: "Tag entries with these, eg. Youth or Worship. Each tag is a tab of its own gathering the entries it's on, and can be shown alone or as a slide when the schedule is presented.",
when: { path: "type", value: "schedule" },
title: (row) => row.name || "New tag",
blank: () => ({ tag_key: crypto.randomUUID().slice(0, 8) }),
fields: [
{ path: "name", label: "Name", required: true, help: "eg. Youth" },
{ path: "color", label: "Color", widget: "color", help: "Default: the event's color" },
{ path: "no_tab", label: "No tab", widget: "checkbox", help: "Leave it out of the tabs (it still shows on entries)" },
],
},
{
key: "items",
label: "Items",
@ -653,6 +685,7 @@ export const blocksChild = {
when: SCHEDULE_ENTRY,
},
{ path: "featured", label: "Featured", widget: "checkbox", help: "Makes the row stand out", when: SCHEDULE_ENTRY },
{ ...TAGS_FIELD, when: SCHEDULE_ENTRY },
],
children: [
{