NGU-Web/src/lib/adminSchema/awards.ts
Zaldimmar 9854da965e Keep uploaded images in folders by what they're for
logos/ for logo and icon fields, thumbnails/ for previews the site
saves (link previews, Drive first pages), images/ for everything else;
each small copy beside its image. Images from before folders are
sorted once at boot by their uses, and every record naming them is
rewritten in one transaction after the files move.

The Media page and image pickers get a tab per folder; a picker opens
on its field's folder and uploads there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 22:29:22 -05:00

54 lines
1.8 KiB
TypeScript

import { mediaUrl } from "../media.ts";
import { PUBLISH_FIELDS } from "./shared.ts";
/* ── Awards ──────────────────────────────────────────────────── */
export const awards = {
key: "awards",
label: "Awards",
singular: "award",
idLabel: "URL ID",
slugFrom: "name",
list: {
columns: [
{ key: "name", label: "Name", primary: true },
{ key: "org_id", label: "Awarded by" },
{ key: "description", label: "Description" },
{ key: "is_published", label: "Live", widget: "bool" },
{ key: "is_listed", label: "Listed", widget: "bool" },
],
filters: [
{ key: "org_id", label: "Awarded by", optionsFrom: "organizations" },
{ key: "is_published", label: "Published", options: [["1", "Live"], ["0", "Hidden"]] },
{ key: "is_listed", label: "Listed", options: [["1", "Listed"], ["0", "Link only"]] },
],
},
groups: [
{
legend: "Identity",
note:
"An award exists whether or not anyone has received it. " +
"Who received it is edited on the person.",
fields: [
{
path: "org_id",
label: "Awarded by",
widget: "select",
optionsFrom: "organizations",
blankLabel: "- unattributed -",
help: "The organization that gives this award",
},
{ path: "name", label: "Name", required: true },
{ path: "description", label: "Description", widget: "textarea", full: true },
{ path: "logo", label: "Logo", widget: "image", folder: "logos", resolve: mediaUrl, full: true },
],
},
{
legend: "Publishing",
note: "An unpublished award is a draft: off the site, and a 404 at its own page.",
fields: PUBLISH_FIELDS,
},
],
};