diff --git a/app/controllers/api/v1/accounts/portals_controller.rb b/app/controllers/api/v1/accounts/portals_controller.rb
index f994f6722..c3d8ad024 100644
--- a/app/controllers/api/v1/accounts/portals_controller.rb
+++ b/app/controllers/api/v1/accounts/portals_controller.rb
@@ -18,8 +18,6 @@ class Api::V1::Accounts::PortalsController < Api::V1::Accounts::BaseController
def create
@portal = Current.account.portals.build(portal_params)
- render json: { error: @portal.errors.messages }, status: :unprocessable_entity and return unless @portal.valid?
-
@portal.save!
process_attached_logo
end
diff --git a/app/javascript/dashboard/helper/commons.js b/app/javascript/dashboard/helper/commons.js
index 346628985..d50080e82 100644
--- a/app/javascript/dashboard/helper/commons.js
+++ b/app/javascript/dashboard/helper/commons.js
@@ -75,3 +75,10 @@ export const convertToCategorySlug = text => {
.replace(/[^\w ]+/g, '')
.replace(/ +/g, '-');
};
+
+export const convertToPortalSlug = text => {
+ return text
+ .toLowerCase()
+ .replace(/[^\w ]+/g, '')
+ .replace(/ +/g, '-');
+};
diff --git a/app/javascript/dashboard/helper/specs/commons.spec.js b/app/javascript/dashboard/helper/specs/commons.spec.js
index 3ab06c02a..85e2beb37 100644
--- a/app/javascript/dashboard/helper/specs/commons.spec.js
+++ b/app/javascript/dashboard/helper/specs/commons.spec.js
@@ -3,6 +3,7 @@ import {
createPendingMessage,
convertToAttributeSlug,
convertToCategorySlug,
+ convertToPortalSlug,
} from '../commons';
describe('#getTypingUsersText', () => {
@@ -104,3 +105,9 @@ describe('convertToCategorySlug', () => {
);
});
});
+
+describe('convertToPortalSlug', () => {
+ it('should convert to slug', () => {
+ expect(convertToPortalSlug('Room rental')).toBe('room-rental');
+ });
+});
diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
index 15792bc97..4e70fc58d 100644
--- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json
+++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
@@ -74,6 +74,54 @@
}
}
}
+ },
+ "ADD": {
+ "TITLE": "Create a portal",
+ "SUB_TITLE": "A Help Center in Chatwoot is known as a portal. You can have multiple portals and can have different locales for each portal.",
+ "NAME": {
+ "LABEL": "Name",
+ "PLACEHOLDER": "Portal name",
+ "HELP_TEXT": "The name will be used in the public facing portal internally",
+ "ERROR": "Name is required"
+ },
+ "PAGE_TITLE": {
+ "LABEL": "Page Title",
+ "PLACEHOLDER": "Portal page title",
+ "HELP_TEXT": "The name will be used in the public facing portal",
+ "ERROR": "Page title is required"
+ },
+ "SLUG": {
+ "LABEL": "Slug",
+ "PLACEHOLDER": "Portal slug for urls",
+ "HELP_TEXT": "app.chatwoot.com/portal/my-portal",
+ "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"
+ },
+ "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"
+ },
+ "HEADER_TEXT": {
+ "LABEL": "Header Text",
+ "PLACEHOLDER": "Portal header text",
+ "HELP_TEXT": "Portal header text",
+ "ERROR": "Portal header text is required"
+ },
+ "BUTTONS": {
+ "CREATE": "Create portal",
+ "CANCEL": "Cancel"
+ },
+ "API": {
+ "SUCCESS_MESSAGE": "Portal created successfully.",
+ "ERROR_MESSAGE": "Couldn't create the portal. Try again."
+ }
}
},
"TABLE": {
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/AddPortal.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/AddPortal.vue
new file mode 100644
index 000000000..aa526fd99
--- /dev/null
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/AddPortal.vue
@@ -0,0 +1,185 @@
+
+