People directories, ministries, organization contacts (migrations 062 to 064)

- People tags (062): Data → People tags (Musicians seeded); a person's
  Directories repeater tags them and their Specialty line shows on
  their tile. A People directory section preset shows a tag's first
  12 and links to its full page, /directory/<tag>, with page meta and
  a sitemap entry. Tiles' details panels show a person's links.
- Ministries (063): a new organization kind. A group picks its
  ministry and its page says "Ministry: <name>", linked to the
  ministry's website. Ministries have no public page, list, sitemap
  or timeline entry, and aren't offered where a record links to its
  organization. organizations is rebuilt for the kind CHECK.
- Organization contacts (064): Data → Contact types; a private
  Contacts repeater on each organization (editors and up, readRole on
  a child collection). Tools → Newsletter → Recipients filters them
  by type, kind, region and published and downloads a Mailchimp CSV.
- A trigger refusing a save with a sentence is shown as that message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-03 22:57:34 -05:00
parent 07e56bfd20
commit 0ed7315156
38 changed files with 1108 additions and 29 deletions

View file

@ -0,0 +1,32 @@
/* ── Contact types (064_org_contacts.sql) ────────────────────────
Data → Contact types: the roles an organization's contacts hold,
eg. Minister, General info. Contacts are added on each
organization; Tools → Newsletter → Recipients exports them by
type. A type still in use can't be deleted. Server side:
server/src/admin-schema/contactTypes.js. */
export const contactTypes = {
key: "contact_types",
label: "Contact types",
singular: "contact type",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "sort_order", label: "Order" },
],
filters: [],
},
groups: [
{
legend: "Contact type",
fields: [
{ path: "name", label: "Name", required: true, help: "eg. Minister, General info" },
{ path: "sort_order", label: "Sort order", widget: "number" },
],
},
],
};

View file

@ -20,7 +20,7 @@ export const organizations = {
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "kind", label: "Kind", options: ["national", "region", "group", "partner"] },
{ key: "kind", label: "Kind", options: ["national", "region", "group", "partner", "ministry"] },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
@ -34,9 +34,9 @@ export const organizations = {
path: "kind",
label: "Kind",
widget: "select",
options: ["national", "region", "group", "partner"],
options: ["national", "region", "group", "partner", "ministry"],
required: true,
help: "Changing this swaps which extra fields apply",
help: "Changing this swaps which extra fields apply. A ministry (a Unity church) has no page; its groups name it",
},
{ path: "name", label: "Name", required: true },
{ path: "short_name", label: "Short name" },
@ -70,6 +70,14 @@ export const organizations = {
optionsFrom: "regions",
blankLabel: "Default: none",
},
{
path: "group.ministry_id",
label: "Ministry",
widget: "select",
optionsFrom: "ministries",
blankLabel: "Default: none",
help: "The Unity ministry it belongs to, named on its page (linked to the ministry's website)",
},
{ path: "group.meets", label: "Meets", help: "2nd Sundays, 6:00pm" },
{ path: "group.started", label: "Started", help: "Since 2021" },
],
@ -101,6 +109,25 @@ export const organizations = {
{ path: "note", label: "Note", help: "details to explain why it's half or other note" },
],
},
{
key: "contacts",
label: "Contacts",
note:
"Private: never on the public site, and only editors and up see them. " +
"Tools → Newsletter → Recipients exports them. Types are made under Data → Contact types.",
addLabel: "Add contact",
title: (row, options) =>
[options?.contact_types?.find((t) => t.id === row.type_id)?.label, row.name || row.email]
.filter(Boolean)
.join(" · ") || "New contact",
blank: { type_id: "", name: "", email: "", phone: "" },
fields: [
{ path: "type_id", label: "Type", widget: "select", optionsFrom: "contact_types", required: true },
{ path: "name", label: "Name" },
{ path: "email", label: "Email", help: "An email or a phone is needed" },
{ path: "phone", label: "Phone" },
],
},
linksChild,
blocksChild,
],

View file

@ -32,6 +32,12 @@ export const people = {
{ path: "sort_name", label: "Sort name", help: "Doe, Jane" },
{ path: "pronouns", label: "Pronouns" },
{ path: "tagline", label: "Tagline", full: true },
{
path: "specialty",
label: "Specialty",
full: true,
help: "One line shown in directories, eg. Vocals, piano · Gospel, folk",
},
{ path: "photo", label: "Photo", widget: "image", resolve: mediaUrl, full: true },
{
path: "primary_org_id",
@ -80,6 +86,24 @@ export const people = {
],
children: [
{
key: "tags",
label: "Directories",
note: "Tags that list this person in a directory, eg. Musicians. Tags are made under Data → People tags.",
addLabel: "Add tag",
title: (row, options) =>
options?.person_tag_types?.find((t) => t.id === row.tag_id)?.label ?? "New tag",
blank: { tag_id: "" },
fields: [
{
path: "tag_id",
label: "Tag",
widget: "select",
optionsFrom: "person_tag_types",
required: true,
},
],
},
{
key: "affiliations",
label: "Roles and organizations",

View file

@ -0,0 +1,35 @@
/* ── People tags (062_people_tags.sql) ───────────────────────────
Data → People tags: what a person can be tagged as for a
directory (Musicians first). Which people carry a tag is edited on
the person; a page shows a tag's people with the People directory
preset, and every tag has its full page at /directory/<URL ID>.
Server side: server/src/admin-schema/personTags.js. */
export const personTagTypes = {
key: "person_tag_types",
label: "People tags",
singular: "tag",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "blurb", label: "Intro" },
{ key: "sort_order", label: "Order" },
],
filters: [],
},
groups: [
{
legend: "Tag",
note: "Its full directory is at /directory/ and its URL ID, eg. /directory/musician.",
fields: [
{ path: "name", label: "Name", required: true, help: "The directory's title, eg. Musicians" },
{ path: "blurb", label: "Intro", widget: "textarea", full: true, help: "A line under the full directory's title" },
{ path: "sort_order", label: "Sort order", widget: "number" },
],
},
],
};

View file

@ -18,6 +18,7 @@ const PRESETS = {
partner_list: "Partner organization cards",
events: "Event carousel or grid",
timeline: "Timeline",
people_directory: "People directory (a tag's people)",
};
const ACCENT_OPTIONS = [
@ -99,6 +100,19 @@ const sectionsChild = (presets: string[]) => ({
},
]
: []),
...(presets.includes("people_directory")
? [
{
path: "tag_id",
label: "Directory: tag",
widget: "select",
optionsFrom: "person_tag_types",
blankLabel: "Default: none (shows nothing)",
help: "Shows the first of its people and links to the full directory",
when: { path: "preset", value: "people_directory" },
},
]
: []),
...(presets.includes("group_map")
? [
{
@ -139,7 +153,7 @@ const sitePage = (id: string, label: string, presets: string[], more: Record<str
export const communityPage = sitePage(
"community",
"Community page",
["community_blog", "group_map", "region_list", "partner_list"],
["community_blog", "group_map", "region_list", "partner_list", "people_directory"],
{
groups: [
{
@ -209,6 +223,6 @@ export const communityPage = sitePage(
);
export const retreatsPage = sitePage("retreats", "Retreats page", ["events"]);
export const resourcesPage = sitePage("resources", "Resources page", []);
export const organizationPage = sitePage("organization", "Organization page", []);
export const resourcesPage = sitePage("resources", "Resources page", ["people_directory"]);
export const organizationPage = sitePage("organization", "Organization page", ["people_directory"]);
export const historyPage = sitePage("history", "History page", ["timeline"]);