diff --git a/app/javascript/dashboard/components/layout/Sidebar.vue b/app/javascript/dashboard/components/layout/Sidebar.vue index 87100e4b4..80b2486e6 100644 --- a/app/javascript/dashboard/components/layout/Sidebar.vue +++ b/app/javascript/dashboard/components/layout/Sidebar.vue @@ -11,6 +11,7 @@ @open-notification-panel="openNotificationPanel" /> +
+ + + +
+ {{ `Place the help center sidebar here. ` }} +
+ + +
+ + + + +
+
+ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/helpcenter.routes.js b/app/javascript/dashboard/routes/dashboard/helpcenter/helpcenter.routes.js new file mode 100644 index 000000000..d95c8ccb0 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/helpcenter.routes.js @@ -0,0 +1,134 @@ +import HelpCenterLayout from './components/HelpCenterLayout'; +import { getPortalRoute } from './helpers/routeHelper'; + +const ListAllPortals = () => import('./pages/portals/ListAllPortals'); +const NewPortal = () => import('./pages/portals/NewPortal'); +const EditPortal = () => import('./pages/portals/EditPortal'); +const ShowPortal = () => import('./pages/portals/ShowPortal'); + +const ListAllCategories = () => import('./pages/categories/ListAllCategories'); +const NewCategory = () => import('./pages/categories/NewCategory'); +const EditCategory = () => import('./pages/categories/EditCategory'); +const ShowCategory = () => import('./pages/categories/ShowCategory'); +const ListCategoryArticles = () => + import('./pages/articles/ListCategoryArticles'); + +const ListAllArticles = () => import('./pages/articles/ListAllArticles'); +const ListArchivedArticles = () => + import('./pages/articles/ListArchivedArticles'); +const ListDraftArticles = () => import('./pages/articles/ListDraftArticles'); +const ListMyArticles = () => import('./pages/articles/ListMyArticles'); +const NewArticle = () => import('./pages/articles/NewArticle'); +const EditArticle = () => import('./pages/articles/EditArticle'); + +const portalRoutes = [ + { + path: getPortalRoute(''), + name: 'list_all_portals', + roles: ['administrator', 'agent'], + component: ListAllPortals, + }, + { + path: getPortalRoute('new'), + name: 'new_portal', + roles: ['administrator', 'agent'], + component: NewPortal, + }, + { + path: getPortalRoute(':portalSlug'), + name: 'edit_portal', + roles: ['administrator', 'agent'], + component: ShowPortal, + }, + { + path: getPortalRoute(':portalSlug/edit'), + name: 'edit_portal', + roles: ['administrator', 'agent'], + component: EditPortal, + }, +]; + +const articleRoutes = [ + { + path: getPortalRoute(':portalSlug/:locale/articles'), + name: 'list_all_locale_articles', + roles: ['administrator', 'agent'], + component: ListAllArticles, + }, + { + path: getPortalRoute(':portalSlug/:locale/articles/archived'), + name: 'list_archived_articles', + roles: ['administrator', 'agent'], + component: ListArchivedArticles, + }, + + { + path: getPortalRoute(':portalSlug/:locale/articles/draft'), + name: 'list_draft_articles', + roles: ['administrator', 'agent'], + component: ListDraftArticles, + }, + { + path: getPortalRoute(':portalSlug/:locale/articles/mine'), + name: 'list_all_locale_articles', + roles: ['administrator', 'agent'], + component: ListMyArticles, + }, + { + path: getPortalRoute(':portalSlug/:locale/articles/new'), + name: 'new_article', + roles: ['administrator', 'agent'], + component: NewArticle, + }, + { + path: getPortalRoute(':portalSlug/:locale/articles/:articleSlug'), + name: 'edit_article', + roles: ['administrator', 'agent'], + component: EditArticle, + }, +]; + +const categoryRoutes = [ + { + path: getPortalRoute(':portalSlug/:locale/categories'), + name: 'list_all_locale_categories', + roles: ['administrator', 'agent'], + component: ListAllCategories, + }, + { + path: getPortalRoute(':portalSlug/:locale/categories/new'), + name: 'new_category_in_locale', + roles: ['administrator', 'agent'], + component: NewCategory, + }, + { + path: getPortalRoute(':portalSlug/:locale/categories/:categorySlug'), + name: 'show_category', + roles: ['administrator', 'agent'], + component: ShowCategory, + }, + { + path: getPortalRoute( + ':portalSlug/:locale/categories/:categorySlug/articles' + ), + name: 'show_category', + roles: ['administrator', 'agent'], + component: ListCategoryArticles, + }, + { + path: getPortalRoute(':portalSlug/:locale/categories/:categorySlug'), + name: 'edit_category', + roles: ['administrator', 'agent'], + component: EditCategory, + }, +]; + +export default { + routes: [ + { + path: getPortalRoute(), + component: HelpCenterLayout, + children: [...portalRoutes, ...articleRoutes, ...categoryRoutes], + }, + ], +}; diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/routeHelper.js b/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/routeHelper.js new file mode 100644 index 000000000..6afd89d35 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/routeHelper.js @@ -0,0 +1,6 @@ +import { frontendURL } from '../../../../helper/URLHelper'; + +export const getPortalRoute = (path = '') => { + const slugToBeAdded = path ? `/${path}` : ''; + return frontendURL(`accounts/:accountId/portals${slugToBeAdded}`); +}; diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/specs/routeHelper.spec.js b/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/specs/routeHelper.spec.js new file mode 100644 index 000000000..ab1323117 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/helpers/specs/routeHelper.spec.js @@ -0,0 +1,10 @@ +import { getPortalRoute } from '../routeHelper'; + +describe('', () => { + it('returns correct portal URL', () => { + expect(getPortalRoute('')).toEqual('/app/accounts/:accountId/portals'); + expect(getPortalRoute(':portalSlug')).toEqual( + '/app/accounts/:accountId/portals/:portalSlug' + ); + }); +}); diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue new file mode 100644 index 000000000..9e8ec7ecc --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListAllArticles.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListAllArticles.vue new file mode 100644 index 000000000..10c5e87d6 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListAllArticles.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListArchivedArticles.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListArchivedArticles.vue new file mode 100644 index 000000000..9b8b26fa1 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListArchivedArticles.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListCategoryArticles.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListCategoryArticles.vue new file mode 100644 index 000000000..be0673c7e --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListCategoryArticles.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListDraftArticles.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListDraftArticles.vue new file mode 100644 index 000000000..c869f048a --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListDraftArticles.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListMyArticles.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListMyArticles.vue new file mode 100644 index 000000000..1d029cd51 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/ListMyArticles.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue new file mode 100644 index 000000000..7cd0bff8f --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue new file mode 100644 index 000000000..ecd03c1b6 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/EditCategory.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ListAllCategories.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ListAllCategories.vue new file mode 100644 index 000000000..8799add2f --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ListAllCategories.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/NewCategory.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/NewCategory.vue new file mode 100644 index 000000000..722b868a7 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/NewCategory.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ShowCategory.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ShowCategory.vue new file mode 100644 index 000000000..bf5385b34 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/categories/ShowCategory.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortal.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortal.vue new file mode 100644 index 000000000..f05c08381 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/EditPortal.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ListAllPortals.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ListAllPortals.vue new file mode 100644 index 000000000..a47765e8a --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ListAllPortals.vue @@ -0,0 +1,3 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue new file mode 100644 index 000000000..89368ed1b --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/NewPortal.vue @@ -0,0 +1,5 @@ + diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ShowPortal.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ShowPortal.vue new file mode 100644 index 000000000..fd8c02176 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/portals/ShowPortal.vue @@ -0,0 +1,3 @@ +