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.
This commit is contained in:
Tống Thành Đạt
2026-04-21 12:37:19 +07:00
parent 122df1a46e
commit 5d0fae6d51
30 changed files with 2174 additions and 477 deletions
+32 -40
View File
@@ -14,7 +14,7 @@ const {
module.exports = {
key: "admissions",
title: "Admissions Management",
subtitle: "Edit content displayed on the admissions page",
subtitle: "Manage the content for the admissions page",
routeBase: "/admin/admissions",
apiPath: "/api/admissions",
previewPath: "/admissions",
@@ -43,7 +43,6 @@ module.exports = {
label: "Admissions Process",
icon: "fas fa-list-ol",
schema: object("process", "Admissions process", [
text("id", "Section key", { maxLength: 40 }),
text("title", "Section title", { maxLength: 60 }),
textarea("description", "Section description", {
maxLength: 180,
@@ -76,7 +75,6 @@ module.exports = {
label: "Eligibility",
icon: "fas fa-check-circle",
schema: object("eligibility", "Eligibility", [
text("id", "Section key", { maxLength: 40 }),
text("title", "Section title", { maxLength: 60 }),
objectList(
"cards",
@@ -104,7 +102,6 @@ module.exports = {
label: "Tuition",
icon: "fas fa-chart-column",
schema: object("tuition", "Tuition", [
text("id", "Section key", { maxLength: 40 }),
text("title", "Section title", { maxLength: 60 }),
text("chartTitle", "Chart title", { maxLength: 60 }),
textarea("chartDescription", "Chart description", {
@@ -120,6 +117,7 @@ module.exports = {
stringList("values", "Data points", {
itemLabel: "Point",
fieldType: "number",
min: 0,
sortable: true,
}),
],
@@ -137,30 +135,7 @@ module.exports = {
label: "Key Dates",
icon: "fas fa-calendar-days",
schema: object("keyDates", "Key dates", [
text("id", "Section key", { maxLength: 40 }),
text("title", "Section title", { maxLength: 60 }),
stringList("columns", "Table columns", {
itemLabel: "Column",
maxLength: 40,
sortable: true,
}),
objectList(
"rows",
"Table rows",
[
text("term", "Term", { maxLength: 40 }),
text("applicationDeadline", "Application deadline", {
maxLength: 40,
}),
text("classesStart", "Classes start", { maxLength: 40 }),
],
{
itemLabel: "Row",
sortable: true,
itemTitleKey: "term",
emptyText: "No key date rows yet.",
},
),
]),
},
{
@@ -173,20 +148,37 @@ module.exports = {
maxLength: 120,
rows: 3,
}),
stringList("modelOptions", "Model options", {
itemLabel: "Option",
maxLength: 30,
sortable: true,
}),
text("paceLabel", "Pace label", { maxLength: 30 }),
text("minPaceLabel", "Minimum pace label", { maxLength: 20 }),
text("maxPaceLabel", "Maximum pace label", { maxLength: 20 }),
text("resultLabel", "Result label", { maxLength: 40 }),
text("monthlyAmount", "Monthly amount", { maxLength: 20 }),
text("monthlySuffix", "Monthly suffix", { maxLength: 10 }),
icon("noteIcon", "Note icon"),
text("note", "Note text", { maxLength: 60 }),
object("cta", "Button", linkFields("Button")),
objectList(
"options",
"Calculator options",
[
hidden("id"),
text("label", "Option label", { maxLength: 12 }),
text("paceLabel", "Pace label", { maxLength: 30 }),
text("minPaceLabel", "Minimum pace label", { maxLength: 20 }),
text("maxPaceLabel", "Maximum pace label", { maxLength: 20 }),
text("resultLabel", "Result label", { maxLength: 40 }),
text("monthlyAmount", "Monthly amount", { maxLength: 20 }),
text("monthlySuffix", "Monthly suffix", { maxLength: 10 }),
icon("noteIcon", "Note icon"),
text("note", "Note text", { maxLength: 60 }),
],
{
itemLabel: "Option",
sortable: true,
itemTitleKey: "label",
emptyText: "No calculator options yet.",
itemActions: [
{
label: "Edit option",
icon: "fas fa-pen",
className: "btn btn-outline-primary btn-sm",
hrefTemplate: "/admin/admissions/calculator/{id}",
},
],
},
),
]),
},
{