From b20f5e5cef47875b18bb250e4de82727f5aafa60 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Fri, 28 Oct 2022 06:21:38 +0530 Subject: [PATCH] feat: Adds URL validation for domain and home page links (#5761) --- .../dashboard/i18n/locale/en/helpCenter.json | 12 ++++------ .../components/PortalSettingsBasicForm.vue | 18 ++++++++++---- .../PortalSettingsCustomizationForm.vue | 24 +++++++++++++++++-- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json index 1f22ba5bd..801e651c4 100644 --- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json +++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json @@ -160,8 +160,7 @@ } }, "ADD": { - "CREATE_FLOW": [ - { + "CREATE_FLOW": [{ "title": "Help center information", "route": "new_portal_information", "body": "Basic information about portal", @@ -212,20 +211,19 @@ "SLUG": { "LABEL": "Slug", "PLACEHOLDER": "Portal slug for urls", - "ERROR": "Slug is required" }, "DOMAIN": { "LABEL": "Custom Domain", "PLACEHOLDER": "Portal custom domain", - "HELP_TEXT": "Add only If you want to use a custom domain for your portals.", - "ERROR": "Custom Domain is required" + "HELP_TEXT": "Add only If you want to use a custom domain for your portals. Eg: https://example.com", + "ERROR": "Enter a valid domain URL" }, "HOME_PAGE_LINK": { "LABEL": "Home Page Link", "PLACEHOLDER": "Portal home page link", - "HELP_TEXT": "The link used to return from the portal to the home page.", - "ERROR": "Home Page Link is required" + "HELP_TEXT": "The link used to return from the portal to the home page. Eg: https://example.com", + "ERROR": "Enter a valid home page URL" }, "THEME_COLOR": { "LABEL": "Portal theme color", diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue index 796d029d6..e13c60061 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/PortalSettingsBasicForm.vue @@ -35,11 +35,12 @@
@@ -51,15 +52,18 @@ :label="$t('HELP_CENTER.PORTAL.ADD.SLUG.LABEL')" :placeholder="$t('HELP_CENTER.PORTAL.ADD.SLUG.PLACEHOLDER')" :help-text="domainHelpText" - @input="$v.slug.$touch" + @blur="$v.slug.$touch" />
@@ -77,8 +81,8 @@