feat(cms): enhance policy editor with fullscreen mode and date picking

Improve the policy content management experience by adding a dedicated fullscreen editing mode and a structured date picker for effective dates.
- Implement fullscreen toggle in `policies-block-editor.js` with corresponding CSS for an expanded workspace
- Add `date` field type to `sharedFields.js` and integrate it into `policiesConfig.js`
- Implement date parsing and formatting utilities in `editor-script.ejs` to handle "Effective Date" strings
- Update `policiesController.js` to use `updateOne` for more reliable document persistence and state reloading
- Add support for `ICON_OPTIONS` in the policy editor configuration
- Refine editor UI layout and overflow handling for better stability with long content strings
This commit is contained in:
Tống Thành Đạt
2026-04-22 12:02:00 +07:00
parent cdaddddfeb
commit a44d005c13
7 changed files with 620 additions and 25 deletions
+6 -1
View File
@@ -1,5 +1,7 @@
const {
ICON_OPTIONS,
text,
date,
textarea,
icon,
url,
@@ -58,7 +60,9 @@ const baseConfig = {
[
text("navLabel", "Sidebar label", { maxLength: 40 }),
text("title", "Policy title", { maxLength: 70 }),
text("effectiveDate", "Effective date", { maxLength: 50 }),
date("effectiveDate", "Effective date", {
helpText: "Pick a calendar date. It will be saved in the standard policy display format.",
}),
textarea("intro", "Intro text", { maxLength: 260, rows: 4 }),
],
{
@@ -98,6 +102,7 @@ function createPoliciesSectionEditorConfig(policy, allPolicies = []) {
imageType: "policies",
policyId: policy.id,
policyOptions,
iconOptions: ICON_OPTIONS,
};
}
+8
View File
@@ -32,6 +32,13 @@ const text = (key, label, options = {}) => ({
...options,
});
const date = (key, label, options = {}) => ({
key,
label,
type: "date",
...options,
});
const hidden = (key, options = {}) => ({
key,
type: "hidden",
@@ -169,6 +176,7 @@ const linkFields = (prefix = "Link") => [
module.exports = {
ICON_OPTIONS,
text,
date,
hidden,
textarea,
image,