Files
cms.techvanguard.vn/utils/contentEditors/accreditationConfig.js
T
Tống Thành Đạt 5d0fae6d51 feat(cms): enhance content editors and implement automatic ID generation
Improve the CMS administration interface across multiple pages (Accreditation, Admissions, History, Partnerships, and Policies) with a focus on usability and data integrity.
Key changes include:
- Implement `ensureUniqueIds` utility to automatically generate and maintain unique slugs for content items, removing the need for manual ID entry in the UI.
- Refactor the Admissions calculator to support detailed per-option editing via a new dedicated view and routes.
- Replace basic datalists with a custom, searchable icon combobox component for better visual selection.
- Update `_renderSingletonPageView` to handle active tab persistence via query parameters.
- Streamline editor configurations by removing redundant fields and improving help text.
- Enhance the Admissions "Key Dates" editor with a dynamic table interface for managing columns and rows.
- Normalize data payloads in controllers to ensure consistent API responses and internal linking.
2026-04-21 12:37:19 +07:00

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: 40 }),
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.",
},
),
]),
},
],
};