NGU-Web/server/src/admin-schema/organizations.js
Zaldimmar b55b088e16 Group pages: framed facts, tags for organizations and events, every website and email (migration 070)
- Email buttons went to the link's label, not its URL (splitLinks took
  the label); they use the URL now, with or without mailto:.
- Every website and email row is listed, each with its own label,
  instead of only the first.
- The facts at the top of an organization page sit in a framed card:
  City, Part of <name> Region, Ministry, Meets, Since, and its tags.
- Tags (070): Data -> Tags (Online, In-Person to start) replace the
  Online checkbox on organizations and events. Ticked records get the
  Online tag; v_events reads the "online" tag as is_online, so the
  calendar filter and place lines are unchanged. Tags show on the
  record's page and on group entries in the Community map list and
  grid. The map no longer keeps online groups off their state's tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 04:58:56 -05:00

103 lines
2.6 KiB
JavaScript

import { text, int, real, bool, enumeration, placeColumns, timelineExtension, linksChild, blocksChild } from "./columns.js";
import { tagsChild } from "./tags.js";
/* ── Organizations ───────────────────────────────────────────── */
export const organizations = {
key: "organizations",
table: "organizations",
idColumn: "id",
idKind: "slug",
concurrency: "updated_at",
list: {
columns: [
"id",
"kind",
"name",
"short_name",
"locality",
"state_code",
"is_published",
"is_listed",
"sort_order",
"updated_at",
],
filters: ["kind", "is_published", "is_listed"],
search: ["name", "id", "locality"],
order: "kind, sort_order, name",
},
columns: [
enumeration("kind", ["national", "region", "group", "partner", "ministry"], {
required: true,
}),
text("name", { required: true }),
text("short_name"),
text("tagline"),
text("color"),
text("logo"),
...placeColumns,
bool("is_published"),
bool("is_listed"),
int("sort_order"),
bool("in_timeline"),
],
extensions: [
timelineExtension("organization"),
{
key: "region",
table: "regions",
idColumn: "id",
when: { column: "kind", value: "region" },
columns: [
enumeration("scope", ["domestic", "international", "virtual"], {
required: true,
}),
text("map_note"),
],
},
{
key: "group",
table: "groups",
idColumn: "id",
when: { column: "kind", value: "group" },
columns: [text("region_id"), text("ministry_id"), text("meets"), text("started")],
},
],
children: [
tagsChild("organization_tags", "org_id"),
linksChild("organization"),
blocksChild("organization"),
// Who to write to there, by role (064_org_contacts.sql): private,
// for the Newsletter's recipient export.
{
key: "contacts",
table: "organization_contacts",
owner: { column: "org_id" },
order: "sort_order",
readRole: "editor",
columns: [
text("type_id", { required: true }),
text("name"),
text("email"),
text("phone"),
],
},
{
key: "region_areas",
table: "region_areas",
owner: { column: "region_id" },
when: { column: "kind", value: "region" },
order: "area_code",
columns: [
text("area_code", { required: true }),
real("share"),
enumeration("edge", ["top", "bottom"]),
text("note"),
],
},
],
};