forked from UKSOURCE/cms.hailearning.edu.vn
feat(contact-button): add floating contact widget admin management
Add CMS support for floating contact widget with Facebook/Zalo quick actions. Includes mongoose schema, admin UI tab, image upload with sharp resize presets, deferred form submission with draft persistence, and upload middleware error handling.
This commit is contained in:
@@ -11,6 +11,51 @@ const LinkSchema = new Schema(
|
||||
{ _id: false },
|
||||
);
|
||||
|
||||
const FloatingContactBrandSchema = new Schema(
|
||||
{
|
||||
imageSrc: { type: String, default: "" },
|
||||
imageAlt: { type: String, default: "", maxlength: 60 },
|
||||
},
|
||||
{ _id: false },
|
||||
);
|
||||
|
||||
const FloatingContactTriggerSchema = new Schema(
|
||||
{
|
||||
imageSrc: { type: String, default: "" },
|
||||
icon: { type: String, default: "fa-comments" },
|
||||
},
|
||||
{ _id: false },
|
||||
);
|
||||
|
||||
const FloatingContactActionSchema = new Schema(
|
||||
{
|
||||
id: { type: String, default: "" },
|
||||
platform: { type: String, default: "" },
|
||||
enabled: { type: Boolean, default: true },
|
||||
label: { type: String, default: "", maxlength: 48 },
|
||||
subtitle: { type: String, default: "", maxlength: 48 },
|
||||
href: { type: String, default: "" },
|
||||
iconImage: { type: String, default: "" },
|
||||
iconType: { type: String, default: "iconClass" },
|
||||
iconClass: { type: String, default: "" },
|
||||
iconText: { type: String, default: "", maxlength: 12 },
|
||||
order: { type: Number, default: 0 },
|
||||
},
|
||||
{ _id: false },
|
||||
);
|
||||
|
||||
const FloatingContactSchema = new Schema(
|
||||
{
|
||||
enabled: { type: Boolean, default: true },
|
||||
position: { type: String, default: "bottom-right" },
|
||||
panelTitle: { type: String, default: "", maxlength: 72 },
|
||||
brand: { type: FloatingContactBrandSchema, default: () => ({}) },
|
||||
trigger: { type: FloatingContactTriggerSchema, default: () => ({}) },
|
||||
actions: { type: [FloatingContactActionSchema], default: [] },
|
||||
},
|
||||
{ _id: false },
|
||||
);
|
||||
|
||||
// Hero slide (for multiple hero items in slider)
|
||||
const HeroSlideSchema = new Schema(
|
||||
{
|
||||
@@ -266,6 +311,7 @@ const HomeSchema = new Schema(
|
||||
achievements: { type: AchievementsSchema, default: () => ({}) },
|
||||
partners: { type: PartnersSchema, default: () => ({}) },
|
||||
blogPreview: { type: BlogPreviewSchema, default: () => ({}) },
|
||||
floatingContact: { type: FloatingContactSchema, default: () => ({}) },
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
|
||||
Reference in New Issue
Block a user