From eaac65c97324acd79883697d32c901f11fc8e7ef Mon Sep 17 00:00:00 2001 From: Gabriel Jablonski Date: Mon, 9 Mar 2026 11:47:41 -0300 Subject: [PATCH] feat: add custom HTML fields for portals (#233) --- .../api/v1/accounts/portals_controller.rb | 3 +- .../PortalSettingsPage/PortalBaseSettings.vue | 54 +++++++++++++++++++ .../dashboard/i18n/locale/en/helpCenter.json | 10 ++++ .../i18n/locale/pt_BR/helpCenter.json | 10 ++++ app/models/portal.rb | 4 ++ .../v1/accounts/portals/_portal.json.jbuilder | 2 + app/views/layouts/portal.html.erb | 6 +++ ...260309131532_add_custom_html_to_portals.rb | 6 +++ db/schema.rb | 4 +- 9 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20260309131532_add_custom_html_to_portals.rb diff --git a/app/controllers/api/v1/accounts/portals_controller.rb b/app/controllers/api/v1/accounts/portals_controller.rb index b12f89c0a..8800d09ff 100644 --- a/app/controllers/api/v1/accounts/portals_controller.rb +++ b/app/controllers/api/v1/accounts/portals_controller.rb @@ -79,7 +79,8 @@ class Api::V1::Accounts::PortalsController < Api::V1::Accounts::BaseController def portal_params params.require(:portal).permit( :id, :color, :custom_domain, :header_text, :homepage_link, - :name, :page_title, :slug, :archived, { config: [:default_locale, :show_author, { allowed_locales: [] }] } + :name, :page_title, :slug, :archived, :custom_head_html, :custom_body_html, + { config: [:default_locale, :show_author, { allowed_locales: [] }] } ) end diff --git a/app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue b/app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue index 3258162dc..c39523882 100644 --- a/app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue +++ b/app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue @@ -47,6 +47,8 @@ const state = reactive({ logoUrl: '', avatarBlobId: '', showAuthor: true, + customHeadHtml: '', + customBodyHtml: '', }); const originalState = reactive({ ...state }); @@ -120,6 +122,8 @@ watch( slug: newVal.slug, liveChatWidgetInboxId: newVal.inbox?.id || '', showAuthor: newVal.config?.show_author !== false, + customHeadHtml: newVal.custom_head_html || '', + customBodyHtml: newVal.custom_body_html || '', }); if (newVal.logo) { const { @@ -153,6 +157,8 @@ const handleUpdatePortal = () => { blob_id: state.avatarBlobId, inbox_id: state.liveChatWidgetInboxId, config: { show_author: state.showAuthor }, + custom_head_html: state.customHeadHtml, + custom_body_html: state.customBodyHtml, }; emit('updatePortal', portal); }; @@ -354,6 +360,54 @@ const handleAvatarDelete = () => { +
+ +
+