Add a Featured Content section to the front page
Front page → Featured cards (migration 030) holds cards of three kinds: a record on the site, whose title, picture and link fill in from the record; a link, with a Fetch preview button that reads the page's title, description and preview image into the media library; and a video, drawn as a thumbnail that loads the player when pressed. A 'featured' section draws them. The cards are shared: featured_cards is owned polymorphically and FeaturedCards.tsx draws them, ready for the Community blog. Deleting a record removes its cards; an unpublished record's card is hidden. The preview fetch only goes to public http(s) addresses on standard ports, pinned to the vetted IP, with each redirect checked again. Along the way: repeater fields can show by another field's value (a hidden one is cleared), a CHECK named as a sentence is shown as the error, and the timeline's record list is now record_refs for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
960c854611
commit
d4f65d93b4
17 changed files with 1140 additions and 50 deletions
|
|
@ -122,6 +122,25 @@ const timelineExtension = (refKind) => ({
|
|||
],
|
||||
});
|
||||
|
||||
/* Featured cards (030_featured_cards.sql): polymorphic like links,
|
||||
so the Community blog can own a set too. */
|
||||
const featuredCardsChild = (ownerKind) => ({
|
||||
key: "featured_cards",
|
||||
table: "featured_cards",
|
||||
owner: { column: "owner_id", kindColumn: "owner_kind", kindValue: ownerKind },
|
||||
order: "sort_order",
|
||||
columns: [
|
||||
enumeration("kind", ["record", "link", "video"], { required: true }),
|
||||
enumeration("ref_kind", ["event", "organization", "person", "team", "award"]),
|
||||
text("ref_id"),
|
||||
text("url"),
|
||||
text("eyebrow"),
|
||||
text("title"),
|
||||
text("blurb"),
|
||||
text("image"),
|
||||
],
|
||||
});
|
||||
|
||||
/* The two polymorphic collections, parameterised by owner_kind. */
|
||||
const linksChild = (ownerKind) => ({
|
||||
key: "links",
|
||||
|
|
@ -725,7 +744,7 @@ const frontPage = {
|
|||
columns: [
|
||||
enumeration(
|
||||
"section",
|
||||
["countdown", "retreats", "calendar", "stats", "timeline", "connect"],
|
||||
["countdown", "retreats", "calendar", "stats", "timeline", "connect", "featured"],
|
||||
{ required: true },
|
||||
),
|
||||
text("title"),
|
||||
|
|
@ -756,6 +775,7 @@ const frontPage = {
|
|||
text("note"),
|
||||
],
|
||||
},
|
||||
featuredCardsChild("front_page"),
|
||||
{
|
||||
key: "paths",
|
||||
table: "front_page_paths",
|
||||
|
|
@ -806,10 +826,11 @@ export const OPTION_QUERIES = {
|
|||
"SELECT id, name AS label, org_id FROM teams ORDER BY org_id, sort_order, name",
|
||||
|
||||
// One flat list the ref picker filters by ref_kind, rather than five
|
||||
// dropdowns of which four are always wrong. `kind` is the discriminator
|
||||
// dropdowns of which four are always wrong. The timeline and the
|
||||
// featured cards both pick from it. `kind` is the discriminator
|
||||
// the client's filterBy matches on; org_kind disambiguates the label,
|
||||
// since a region and a chapter can share a name.
|
||||
timeline_refs: `
|
||||
record_refs: `
|
||||
SELECT 'event' AS kind, id, title AS label FROM events
|
||||
UNION ALL
|
||||
SELECT 'organization', id, name || ' (' || kind || ')' FROM organizations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue