Add a Listed flag: published records reachable only by their link
is_listed (migration 027) sits beside is_published on organizations, events, people, teams and awards. Unticked, the record's own page still works, but the site's lists leave it out: the list routes, a region's chapters, an organization's events, teams and awards, the QR page's directory, and the front page's counts and countdown. Places where someone attached it by hand (rosters, hosts, billed people, recipients, timeline, a pinned countdown) still show it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3c02eb8971
commit
cd393e4ab2
7 changed files with 120 additions and 38 deletions
|
|
@ -182,7 +182,7 @@ also in `admin-schema.js` and a CHECK):
|
||||||
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
| Front page → Feature | none, livestream, video | **yes** | `HeroStage.tsx` |
|
||||||
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
| Front page → Sections → Section | countdown, retreats, calendar, stats, timeline, connect | **yes**, `FRONT_PAGE_SECTIONS` | `SECTIONS` in `src/pages/Home.tsx`; see [below](#front-page-section-names) |
|
||||||
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
| Front page → Stats → Number Source | manual, years_since, regions, … | **yes**, `STAT_SOURCES` | `STAT_QUERIES` in `server/src/routes/home.js`; see [below](#front-page-stat-sources) |
|
||||||
| Every list → Published / Featured filter | 1, 0 | **yes** | n/a |
|
| Every list → Published / Listed / Featured filter | 1, 0 | **yes** | n/a |
|
||||||
|
|
||||||
"No, shows values" means the dropdown currently shows the raw value,
|
"No, shows values" means the dropdown currently shows the raw value,
|
||||||
so relabelling it is just [adding labels](#renaming-what-a-dropdown-shows).
|
so relabelling it is just [adding labels](#renaming-what-a-dropdown-shows).
|
||||||
|
|
|
||||||
|
|
@ -217,10 +217,11 @@ const organizations = {
|
||||||
"locality",
|
"locality",
|
||||||
"state_code",
|
"state_code",
|
||||||
"is_published",
|
"is_published",
|
||||||
|
"is_listed",
|
||||||
"sort_order",
|
"sort_order",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
],
|
],
|
||||||
filters: ["kind", "is_published"],
|
filters: ["kind", "is_published", "is_listed"],
|
||||||
search: ["name", "id", "locality"],
|
search: ["name", "id", "locality"],
|
||||||
order: "kind, sort_order, name",
|
order: "kind, sort_order, name",
|
||||||
},
|
},
|
||||||
|
|
@ -236,6 +237,7 @@ const organizations = {
|
||||||
text("logo"),
|
text("logo"),
|
||||||
...placeColumns,
|
...placeColumns,
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
|
bool("is_listed"),
|
||||||
int("sort_order"),
|
int("sort_order"),
|
||||||
bool("in_timeline"),
|
bool("in_timeline"),
|
||||||
],
|
],
|
||||||
|
|
@ -305,12 +307,13 @@ const events = {
|
||||||
"starts_on",
|
"starts_on",
|
||||||
"status",
|
"status",
|
||||||
"is_published",
|
"is_published",
|
||||||
|
"is_listed",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
],
|
],
|
||||||
// No host filter: hosts are rows in another table now, and the
|
// No host filter: hosts are rows in another table now, and the
|
||||||
// engine's filters are columns on this one. The events a host
|
// engine's filters are columns on this one. The events a host
|
||||||
// owns are on that host's own page.
|
// owns are on that host's own page.
|
||||||
filters: ["scope_id", "event_type", "status", "is_published"],
|
filters: ["scope_id", "event_type", "status", "is_published", "is_listed"],
|
||||||
search: ["title", "id", "theme"],
|
search: ["title", "id", "theme"],
|
||||||
order: "starts_on IS NULL, starts_on DESC, title",
|
order: "starts_on IS NULL, starts_on DESC, title",
|
||||||
},
|
},
|
||||||
|
|
@ -343,6 +346,7 @@ const events = {
|
||||||
text("color"),
|
text("color"),
|
||||||
text("gradient"),
|
text("gradient"),
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
|
bool("is_listed"),
|
||||||
bool("in_timeline"),
|
bool("in_timeline"),
|
||||||
|
|
||||||
// A repeating schedule. Columns rather than a side table: the
|
// A repeating schedule. Columns rather than a side table: the
|
||||||
|
|
@ -409,9 +413,10 @@ const people = {
|
||||||
"tagline",
|
"tagline",
|
||||||
"locality",
|
"locality",
|
||||||
"is_published",
|
"is_published",
|
||||||
|
"is_listed",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
],
|
],
|
||||||
filters: ["is_published"],
|
filters: ["is_published", "is_listed"],
|
||||||
search: ["display_name", "sort_name", "id"],
|
search: ["display_name", "sort_name", "id"],
|
||||||
order: "sort_name, display_name",
|
order: "sort_name, display_name",
|
||||||
},
|
},
|
||||||
|
|
@ -431,6 +436,7 @@ const people = {
|
||||||
text("country"),
|
text("country"),
|
||||||
text("location_label"),
|
text("location_label"),
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
|
bool("is_listed"),
|
||||||
],
|
],
|
||||||
|
|
||||||
extensions: [
|
extensions: [
|
||||||
|
|
@ -510,8 +516,8 @@ const teams = {
|
||||||
concurrency: "updated_at",
|
concurrency: "updated_at",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
columns: ["id", "org_id", "name", "tagline", "is_published", "sort_order", "updated_at"],
|
columns: ["id", "org_id", "name", "tagline", "is_published", "is_listed", "sort_order", "updated_at"],
|
||||||
filters: ["org_id", "is_published"],
|
filters: ["org_id", "is_published", "is_listed"],
|
||||||
search: ["name", "id", "tagline"],
|
search: ["name", "id", "tagline"],
|
||||||
order: "org_id, sort_order, name",
|
order: "org_id, sort_order, name",
|
||||||
},
|
},
|
||||||
|
|
@ -523,6 +529,7 @@ const teams = {
|
||||||
text("color"),
|
text("color"),
|
||||||
text("logo"),
|
text("logo"),
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
|
bool("is_listed"),
|
||||||
int("sort_order"),
|
int("sort_order"),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -569,8 +576,8 @@ const awards = {
|
||||||
idKind: "slug",
|
idKind: "slug",
|
||||||
|
|
||||||
list: {
|
list: {
|
||||||
columns: ["id", "org_id", "name", "description", "is_published", "sort_order"],
|
columns: ["id", "org_id", "name", "description", "is_published", "is_listed", "sort_order"],
|
||||||
filters: ["org_id", "is_published"],
|
filters: ["org_id", "is_published", "is_listed"],
|
||||||
search: ["name", "id", "description"],
|
search: ["name", "id", "description"],
|
||||||
order: "org_id, sort_order, name",
|
order: "org_id, sort_order, name",
|
||||||
},
|
},
|
||||||
|
|
@ -581,6 +588,7 @@ const awards = {
|
||||||
text("description"),
|
text("description"),
|
||||||
text("logo"),
|
text("logo"),
|
||||||
bool("is_published"),
|
bool("is_published"),
|
||||||
|
bool("is_listed"),
|
||||||
int("sort_order"),
|
int("sort_order"),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
43
server/src/migrations/027_listed.sql
Normal file
43
server/src/migrations/027_listed.sql
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
-- 027 LISTED: PUBLISHED BUT ONLY BY LINK
|
||||||
|
--
|
||||||
|
-- is_published stays the hard gate: 0 is a draft (or, for people,
|
||||||
|
-- private), off the site entirely and a 404 at its own URL.
|
||||||
|
-- is_listed only means anything on a published row. 0 keeps the
|
||||||
|
-- record's own page working but leaves it out of every list the
|
||||||
|
-- site gathers by itself:
|
||||||
|
--
|
||||||
|
-- the /events, /organizations, /teams and /awards lists (and so
|
||||||
|
-- every band, calendar, map and card grid built on them), a
|
||||||
|
-- region's chapters, an organization's events, teams and awards,
|
||||||
|
-- the /directory the QR page reads, and the front page's counts
|
||||||
|
-- and next-event countdown.
|
||||||
|
--
|
||||||
|
-- It still appears wherever someone attached it by hand: rosters,
|
||||||
|
-- billed people, hosts, award recipients, timeline entries, and a
|
||||||
|
-- countdown pinned to it by name. Each of those rows has its own
|
||||||
|
-- is_public (or is_published) to hide it there.
|
||||||
|
--
|
||||||
|
-- Defaults to 1, so every existing row stays listed.
|
||||||
|
--
|
||||||
|
-- Plain ADD COLUMN: NOT NULL with a constant default and a CHECK is
|
||||||
|
-- allowed without a rebuild, STRICT tables included. v_events reads
|
||||||
|
-- e.*, so it picks the column up with no change of its own.
|
||||||
|
--
|
||||||
|
-- PRAGMA user_version; -- reads 26 before this file
|
||||||
|
-- ═══════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
ALTER TABLE organizations ADD COLUMN is_listed INTEGER NOT NULL DEFAULT 1
|
||||||
|
CHECK (is_listed IN (0, 1));
|
||||||
|
|
||||||
|
ALTER TABLE events ADD COLUMN is_listed INTEGER NOT NULL DEFAULT 1
|
||||||
|
CHECK (is_listed IN (0, 1));
|
||||||
|
|
||||||
|
ALTER TABLE people ADD COLUMN is_listed INTEGER NOT NULL DEFAULT 1
|
||||||
|
CHECK (is_listed IN (0, 1));
|
||||||
|
|
||||||
|
ALTER TABLE teams ADD COLUMN is_listed INTEGER NOT NULL DEFAULT 1
|
||||||
|
CHECK (is_listed IN (0, 1));
|
||||||
|
|
||||||
|
ALTER TABLE awards ADD COLUMN is_listed INTEGER NOT NULL DEFAULT 1
|
||||||
|
CHECK (is_listed IN (0, 1));
|
||||||
|
|
@ -15,6 +15,11 @@
|
||||||
`details` rather than as separate routes — that's what lets a
|
`details` rather than as separate routes — that's what lets a
|
||||||
list component be written once and pointed at any kind.
|
list component be written once and pointed at any kind.
|
||||||
|
|
||||||
|
The lists leave out unlisted records (is_listed = 0); the
|
||||||
|
detail routes don't, since reaching one by its link is the
|
||||||
|
point. A region's chapters and an organization's events, teams
|
||||||
|
and awards are lists too. See 027_listed.sql.
|
||||||
|
|
||||||
Responses carry their fallbacks already resolved: an event's
|
Responses carry their fallbacks already resolved: an event's
|
||||||
`color` is its own or its first host's, and `status` is derived
|
`color` is its own or its first host's, and `status` is derived
|
||||||
from the dates when it isn't set. Components read one field and
|
from the dates when it isn't set. Components read one field and
|
||||||
|
|
@ -266,7 +271,7 @@ function attachRegionDetails(db, orgs) {
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo
|
`SELECT c.region_id, o.id, o.name, o.location_label, o.logo
|
||||||
FROM chapters c
|
FROM chapters c
|
||||||
JOIN organizations o ON o.id = c.id AND o.is_published = 1
|
JOIN organizations o ON o.id = c.id AND o.is_published = 1 AND o.is_listed = 1
|
||||||
WHERE c.region_id IN (${marks(ids.length)})
|
WHERE c.region_id IN (${marks(ids.length)})
|
||||||
ORDER BY o.sort_order, o.name`,
|
ORDER BY o.sort_order, o.name`,
|
||||||
)
|
)
|
||||||
|
|
@ -377,7 +382,7 @@ function attachTeams(db, orgs) {
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT id, org_id, name, tagline, color, logo
|
`SELECT id, org_id, name, tagline, color, logo
|
||||||
FROM teams
|
FROM teams
|
||||||
WHERE org_id IN (${marks(ids.length)}) AND is_published = 1
|
WHERE org_id IN (${marks(ids.length)}) AND is_published = 1 AND is_listed = 1
|
||||||
ORDER BY sort_order, name`,
|
ORDER BY sort_order, name`,
|
||||||
)
|
)
|
||||||
.all(...ids);
|
.all(...ids);
|
||||||
|
|
@ -412,7 +417,7 @@ function attachAwards(db, orgs) {
|
||||||
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
||||||
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
||||||
FROM awards a
|
FROM awards a
|
||||||
WHERE a.org_id IN (${marks(ids.length)}) AND a.is_published = 1
|
WHERE a.org_id IN (${marks(ids.length)}) AND a.is_published = 1 AND a.is_listed = 1
|
||||||
ORDER BY a.sort_order, a.name`,
|
ORDER BY a.sort_order, a.name`,
|
||||||
)
|
)
|
||||||
.all(...ids);
|
.all(...ids);
|
||||||
|
|
@ -457,7 +462,7 @@ content.get("/events", (c) => {
|
||||||
const rows = db
|
const rows = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT * FROM v_events
|
`SELECT * FROM v_events
|
||||||
WHERE is_published = 1
|
WHERE is_published = 1 AND is_listed = 1
|
||||||
ORDER BY ${EVENT_ORDER}`,
|
ORDER BY ${EVENT_ORDER}`,
|
||||||
)
|
)
|
||||||
.all();
|
.all();
|
||||||
|
|
@ -538,7 +543,7 @@ content.get("/events/:id", (c) => {
|
||||||
|
|
||||||
|
|
||||||
/* ── Organizations ─────────────────────────────────────────────
|
/* ── Organizations ─────────────────────────────────────────────
|
||||||
GET /organizations every published org
|
GET /organizations every published, listed org
|
||||||
GET /organizations?kind=region one kind
|
GET /organizations?kind=region one kind
|
||||||
GET /organizations?kind=region,chapter
|
GET /organizations?kind=region,chapter
|
||||||
|
|
||||||
|
|
@ -565,7 +570,7 @@ content.get("/organizations", (c) => {
|
||||||
const rows = db
|
const rows = db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT * FROM organizations
|
`SELECT * FROM organizations
|
||||||
WHERE is_published = 1 ${filter}
|
WHERE is_published = 1 AND is_listed = 1 ${filter}
|
||||||
ORDER BY kind, sort_order, name`,
|
ORDER BY kind, sort_order, name`,
|
||||||
)
|
)
|
||||||
.all(...kinds);
|
.all(...kinds);
|
||||||
|
|
@ -627,7 +632,7 @@ content.get("/organizations/:id", (c) => {
|
||||||
e.effective_color AS color
|
e.effective_color AS color
|
||||||
FROM v_events e
|
FROM v_events e
|
||||||
JOIN event_hosts eh ON eh.event_id = e.id AND eh.org_id = ?
|
JOIN event_hosts eh ON eh.event_id = e.id AND eh.org_id = ?
|
||||||
WHERE e.is_published = 1
|
WHERE e.is_published = 1 AND e.is_listed = 1
|
||||||
ORDER BY ${EVENT_ORDER}`,
|
ORDER BY ${EVENT_ORDER}`,
|
||||||
)
|
)
|
||||||
.all(id);
|
.all(id);
|
||||||
|
|
@ -637,7 +642,7 @@ content.get("/organizations/:id", (c) => {
|
||||||
|
|
||||||
|
|
||||||
/* ── Teams ─────────────────────────────────────────────────────
|
/* ── Teams ─────────────────────────────────────────────────────
|
||||||
GET /teams every published team
|
GET /teams every published, listed team
|
||||||
GET /teams?org=mid-atlantic one organization's teams
|
GET /teams?org=mid-atlantic one organization's teams
|
||||||
GET /teams/:id one team's page
|
GET /teams/:id one team's page
|
||||||
|
|
||||||
|
|
@ -655,7 +660,7 @@ content.get("/teams", (c) => {
|
||||||
`SELECT t.*, o.name AS org_name, o.kind AS org_kind
|
`SELECT t.*, o.name AS org_name, o.kind AS org_kind
|
||||||
FROM teams t
|
FROM teams t
|
||||||
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
||||||
WHERE t.is_published = 1 ${org ? "AND t.org_id = ?" : ""}
|
WHERE t.is_published = 1 AND t.is_listed = 1 ${org ? "AND t.org_id = ?" : ""}
|
||||||
ORDER BY o.sort_order, t.sort_order, t.name`,
|
ORDER BY o.sort_order, t.sort_order, t.name`,
|
||||||
)
|
)
|
||||||
.all(...(org ? [org] : []));
|
.all(...(org ? [org] : []));
|
||||||
|
|
@ -720,7 +725,7 @@ content.get("/awards", (c) => {
|
||||||
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
WHERE pa.award_id = a.id AND pa.is_public = 1) AS recipient_count
|
||||||
FROM awards a
|
FROM awards a
|
||||||
LEFT JOIN organizations o ON o.id = a.org_id AND o.is_published = 1
|
LEFT JOIN organizations o ON o.id = a.org_id AND o.is_published = 1
|
||||||
WHERE a.is_published = 1 ${org ? "AND a.org_id = ?" : ""}
|
WHERE a.is_published = 1 AND a.is_listed = 1 ${org ? "AND a.org_id = ?" : ""}
|
||||||
ORDER BY a.sort_order, a.name`,
|
ORDER BY a.sort_order, a.name`,
|
||||||
)
|
)
|
||||||
.all(...(org ? [org] : []));
|
.all(...(org ? [org] : []));
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@
|
||||||
awards published
|
awards published
|
||||||
people published
|
people published
|
||||||
|
|
||||||
|
and each leaves out unlisted records (is_listed = 0): the QR page
|
||||||
|
is public, and listing them here would undo the point of them.
|
||||||
|
|
||||||
The site already serves each of these at its own URL; this only
|
The site already serves each of these at its own URL; this only
|
||||||
lists them in one place.
|
lists them in one place.
|
||||||
═══════════════════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
@ -39,32 +42,32 @@ directory.get("/directory", (c) => {
|
||||||
events: all(
|
events: all(
|
||||||
`SELECT id, title AS name, starts_on
|
`SELECT id, title AS name, starts_on
|
||||||
FROM events
|
FROM events
|
||||||
WHERE is_published = 1
|
WHERE is_published = 1 AND is_listed = 1
|
||||||
ORDER BY starts_on IS NULL, starts_on DESC, title`,
|
ORDER BY starts_on IS NULL, starts_on DESC, title`,
|
||||||
),
|
),
|
||||||
organizations: all(
|
organizations: all(
|
||||||
`SELECT id, name, kind
|
`SELECT id, name, kind
|
||||||
FROM organizations
|
FROM organizations
|
||||||
WHERE is_published = 1
|
WHERE is_published = 1 AND is_listed = 1
|
||||||
ORDER BY kind, name`,
|
ORDER BY kind, name`,
|
||||||
),
|
),
|
||||||
teams: all(
|
teams: all(
|
||||||
`SELECT t.id, t.name, o.name AS org_name
|
`SELECT t.id, t.name, o.name AS org_name
|
||||||
FROM teams t
|
FROM teams t
|
||||||
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
JOIN organizations o ON o.id = t.org_id AND o.is_published = 1
|
||||||
WHERE t.is_published = 1
|
WHERE t.is_published = 1 AND t.is_listed = 1
|
||||||
ORDER BY o.name, t.sort_order, t.name`,
|
ORDER BY o.name, t.sort_order, t.name`,
|
||||||
),
|
),
|
||||||
awards: all(
|
awards: all(
|
||||||
`SELECT id, name
|
`SELECT id, name
|
||||||
FROM awards
|
FROM awards
|
||||||
WHERE is_published = 1
|
WHERE is_published = 1 AND is_listed = 1
|
||||||
ORDER BY name`,
|
ORDER BY name`,
|
||||||
),
|
),
|
||||||
people: all(
|
people: all(
|
||||||
`SELECT id, display_name AS name
|
`SELECT id, display_name AS name
|
||||||
FROM people
|
FROM people
|
||||||
WHERE is_published = 1
|
WHERE is_published = 1 AND is_listed = 1
|
||||||
ORDER BY COALESCE(sort_name, display_name)`,
|
ORDER BY COALESCE(sort_name, display_name)`,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,17 @@
|
||||||
|
|
||||||
── Stats ──
|
── Stats ──
|
||||||
A stat's source picks a query from STAT_QUERIES. Each counts
|
A stat's source picks a query from STAT_QUERIES. Each counts
|
||||||
exactly what the matching public page shows: published rows, and
|
exactly what the matching public page shows: published, listed
|
||||||
for awards only public citations to published people. A count
|
rows, and for awards only public citations to published people
|
||||||
|
(an award's page names its recipients whether they're listed or
|
||||||
|
not, so the count does too). A count
|
||||||
that disagreed with the page it summarises would be worse than
|
that disagreed with the page it summarises would be worse than
|
||||||
none. 'manual' and 'years_since' read the row's own value.
|
none. 'manual' and 'years_since' read the row's own value.
|
||||||
|
|
||||||
── Countdown ──
|
── Countdown ──
|
||||||
The pinned event if it is still published and not over;
|
The pinned event if it is still published and not over, listed
|
||||||
otherwise the next published, non-cancelled event that hasn't
|
or not; otherwise the next published, listed, non-cancelled
|
||||||
ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
event that hasn't ended. "Hasn't ended" is COALESCE(ends_on, starts_on) >= today,
|
||||||
so a running series with a start date in the past still counts.
|
so a running series with a start date in the past still counts.
|
||||||
The client works out the next meeting of a series from `series`.
|
The client works out the next meeting of a series from `series`.
|
||||||
|
|
||||||
|
|
@ -46,15 +48,15 @@ const json = (c, body) => c.json(body, 200, { "Cache-Control": CACHE });
|
||||||
const PAGE_ID = "home";
|
const PAGE_ID = "home";
|
||||||
|
|
||||||
const STAT_QUERIES = {
|
const STAT_QUERIES = {
|
||||||
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1`,
|
regions: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'region' AND is_published = 1 AND is_listed = 1`,
|
||||||
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1`,
|
chapters: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'chapter' AND is_published = 1 AND is_listed = 1`,
|
||||||
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1`,
|
partners: `SELECT COUNT(*) AS n FROM organizations WHERE kind = 'partner' AND is_published = 1 AND is_listed = 1`,
|
||||||
events_held: `SELECT COUNT(*) AS n FROM v_events
|
events_held: `SELECT COUNT(*) AS n FROM v_events
|
||||||
WHERE is_published = 1 AND effective_status = 'past'`,
|
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'`,
|
||||||
retreats_held: `SELECT COUNT(*) AS n FROM v_events
|
retreats_held: `SELECT COUNT(*) AS n FROM v_events
|
||||||
WHERE is_published = 1 AND effective_status = 'past'
|
WHERE is_published = 1 AND is_listed = 1 AND effective_status = 'past'
|
||||||
AND event_type = 'retreat'`,
|
AND event_type = 'retreat'`,
|
||||||
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1`,
|
people: `SELECT COUNT(*) AS n FROM people WHERE is_published = 1 AND is_listed = 1`,
|
||||||
awards_given: `SELECT COUNT(*) AS n
|
awards_given: `SELECT COUNT(*) AS n
|
||||||
FROM person_awards pa
|
FROM person_awards pa
|
||||||
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
JOIN people p ON p.id = pa.person_id AND p.is_published = 1
|
||||||
|
|
@ -166,7 +168,7 @@ home.get("/front-page", (c) => {
|
||||||
db
|
db
|
||||||
.prepare(
|
.prepare(
|
||||||
`SELECT * FROM v_events
|
`SELECT * FROM v_events
|
||||||
WHERE ${notOver} ${filters.join(" ")}
|
WHERE ${notOver} AND is_listed = 1 ${filters.join(" ")}
|
||||||
ORDER BY starts_on, title
|
ORDER BY starts_on, title
|
||||||
LIMIT 1`,
|
LIMIT 1`,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,21 @@ const PLACE_FIELDS = [
|
||||||
|
|
||||||
const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
|
const PUBLISHED_FIELD = { path: "is_published", label: "Published", widget: "checkbox" };
|
||||||
|
|
||||||
|
/* Only means anything on a published record. Unticked, its own page
|
||||||
|
still works but the site's lists, counts and the QR page leave it
|
||||||
|
out. See 027_listed.sql for exactly which. */
|
||||||
|
const LISTED_FIELD = {
|
||||||
|
path: "is_listed",
|
||||||
|
label: "Listed",
|
||||||
|
widget: "checkbox",
|
||||||
|
help: "Unticked: only reachable by its link",
|
||||||
|
};
|
||||||
|
|
||||||
/* For entities whose lists the site orders by hand. Events sort by
|
/* For entities whose lists the site orders by hand. Events sort by
|
||||||
date and people by sort_name, so they take PUBLISHED_FIELD alone. */
|
date and people by sort_name, so they take the first two alone. */
|
||||||
const PUBLISH_FIELDS = [
|
const PUBLISH_FIELDS = [
|
||||||
PUBLISHED_FIELD,
|
PUBLISHED_FIELD,
|
||||||
|
LISTED_FIELD,
|
||||||
{ path: "sort_order", label: "Sort order", widget: "number" },
|
{ path: "sort_order", label: "Sort order", widget: "number" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -252,10 +263,12 @@ const organizations = {
|
||||||
{ key: "locality", label: "City" },
|
{ key: "locality", label: "City" },
|
||||||
{ key: "state_code", label: "State" },
|
{ key: "state_code", label: "State" },
|
||||||
{ key: "is_published", label: "Live", widget: "bool" },
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] },
|
{ key: "kind", label: "Kind", options: ["national", "region", "chapter", "partner"] },
|
||||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -412,6 +425,7 @@ const events = {
|
||||||
{ key: "date_label", label: "Dates" },
|
{ key: "date_label", label: "Dates" },
|
||||||
{ key: "status", label: "Status" },
|
{ key: "status", label: "Status" },
|
||||||
{ key: "is_published", label: "Live", widget: "bool" },
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{ key: "scope_id", label: "Scope", optionsFrom: "event_scopes" },
|
{ key: "scope_id", label: "Scope", optionsFrom: "event_scopes" },
|
||||||
|
|
@ -422,6 +436,7 @@ const events = {
|
||||||
},
|
},
|
||||||
{ key: "status", label: "Status", options: ["upcoming", "past", "cancelled"] },
|
{ key: "status", label: "Status", options: ["upcoming", "past", "cancelled"] },
|
||||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -488,7 +503,7 @@ const events = {
|
||||||
},
|
},
|
||||||
timelineGroup("event"),
|
timelineGroup("event"),
|
||||||
timelineDetailGroup("event"),
|
timelineDetailGroup("event"),
|
||||||
{ legend: "Publishing", fields: [PUBLISHED_FIELD] },
|
{ legend: "Publishing", fields: [PUBLISHED_FIELD, LISTED_FIELD] },
|
||||||
],
|
],
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -546,9 +561,11 @@ const people = {
|
||||||
{ key: "tagline", label: "Tagline" },
|
{ key: "tagline", label: "Tagline" },
|
||||||
{ key: "locality", label: "City" },
|
{ key: "locality", label: "City" },
|
||||||
{ key: "is_published", label: "Live", widget: "bool" },
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -603,7 +620,7 @@ const people = {
|
||||||
{
|
{
|
||||||
legend: "Publishing",
|
legend: "Publishing",
|
||||||
note: "Unpublished people are invisible everywhere.",
|
note: "Unpublished people are invisible everywhere.",
|
||||||
fields: [PUBLISHED_FIELD],
|
fields: [PUBLISHED_FIELD, LISTED_FIELD],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -694,10 +711,12 @@ const teams = {
|
||||||
{ key: "org_id", label: "Organization" },
|
{ key: "org_id", label: "Organization" },
|
||||||
{ key: "tagline", label: "Tagline" },
|
{ key: "tagline", label: "Tagline" },
|
||||||
{ key: "is_published", label: "Live", widget: "bool" },
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{ key: "org_id", label: "Organization", optionsFrom: "organizations" },
|
{ key: "org_id", label: "Organization", optionsFrom: "organizations" },
|
||||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -769,10 +788,12 @@ const awards = {
|
||||||
{ key: "org_id", label: "Awarded by" },
|
{ key: "org_id", label: "Awarded by" },
|
||||||
{ key: "description", label: "Description" },
|
{ key: "description", label: "Description" },
|
||||||
{ key: "is_published", label: "Live", widget: "bool" },
|
{ key: "is_published", label: "Live", widget: "bool" },
|
||||||
|
{ key: "is_listed", label: "Listed", widget: "bool" },
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
|
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
|
||||||
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
|
||||||
|
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue