forked from UKSOURCE/cms.lams
Implement a more flexible, configuration-driven approach for CMS editors across accreditation, admissions, and partnerships modules. - Move UI labels, help texts, and field limits from hardcoded views to `editorUi` configurations in config files. - Add server-side and client-side validation to prevent duplicate category tabs in accreditation and partnerships editors. - Refactor partnership and admission views to dynamically render tabs and fields based on the provided configuration. - Update field length constraints and default values across multiple content editors to better align with frontend requirements. - Improve the admissions calculator editor with dynamic field configurations and default value fallbacks.
85 lines
2.4 KiB
JavaScript
85 lines
2.4 KiB
JavaScript
const {
|
|
text,
|
|
textarea,
|
|
image,
|
|
icon,
|
|
select,
|
|
combobox,
|
|
object,
|
|
stringList,
|
|
objectList,
|
|
} = require("./sharedFields");
|
|
|
|
const statusOptions = [
|
|
{ value: "Active", label: "Active" },
|
|
{ value: "Inactive", label: "Inactive" },
|
|
];
|
|
|
|
module.exports = {
|
|
key: "accreditation",
|
|
title: "Accreditation Management",
|
|
subtitle: "Manage the content for the accreditation page",
|
|
routeBase: "/admin/accreditation",
|
|
apiPath: "/api/accreditation",
|
|
previewPath: "/about/accreditation",
|
|
dataFile: "accreditation",
|
|
imageType: "accreditation",
|
|
tabs: [
|
|
{
|
|
key: "hero",
|
|
label: "Hero",
|
|
icon: "fas fa-image",
|
|
schema: object("hero", "Hero", [
|
|
text("badge", "Eyebrow label", { maxLength: 30 }),
|
|
text("title", "Headline", { maxLength: 60 }),
|
|
textarea("description", "Supporting text", { maxLength: 420, rows: 5 }),
|
|
]),
|
|
},
|
|
{
|
|
key: "grid",
|
|
label: "Accreditation Grid",
|
|
icon: "fas fa-table-cells-large",
|
|
schema: object("grid", "Accreditation grid", [
|
|
stringList("tabs", "Category tabs", {
|
|
itemLabel: "Tab",
|
|
maxLength: 30,
|
|
sortable: true,
|
|
helpText: "Add and reorder the category tabs shown on the page.",
|
|
}),
|
|
objectList(
|
|
"items",
|
|
"Accreditation cards",
|
|
[
|
|
icon("icon", "Fallback icon"),
|
|
image("image", "Card image", {
|
|
imageHint: "Recommended 118x58 px minimum visible ratio",
|
|
helpText: "Logo or badge shown at the top of the card.",
|
|
}),
|
|
select("status", "Status", statusOptions),
|
|
combobox("category", "Category", {
|
|
maxLength: 30,
|
|
optionsPath: "grid.tabs",
|
|
}),
|
|
text("title", "Card title", {
|
|
maxLength: 17,
|
|
helpText: "Keep this very short. Around 17 characters fits best in the card title area.",
|
|
}),
|
|
textarea("description", "Card description", {
|
|
maxLength: 300,
|
|
rows: 5,
|
|
helpText: "Keep this concise. Around 300 characters fits best in the card description area.",
|
|
}),
|
|
],
|
|
{
|
|
itemLabel: "Accreditation",
|
|
sortable: true,
|
|
itemTitleKey: "title",
|
|
itemSubtitleKey: "category",
|
|
emptyText: "No accreditation cards yet.",
|
|
},
|
|
),
|
|
]),
|
|
},
|
|
],
|
|
};
|