From 54d0055e8605d2c155495182af5c5fc967f0c1f1 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Tue, 20 Sep 2022 08:10:32 +0530 Subject: [PATCH] chore: Helpcenter routing and UI fixes (#5460) Co-authored-by: Pranav Raj S --- .../dashboard/components/layout/Sidebar.vue | 8 +++++++- .../helpcenter/components/HelpCenterLayout.vue | 2 ++ .../helpcenter/components/Sidebar/Sidebar.vue | 11 +++++++++-- .../helpcenter/pages/articles/EditArticle.vue | 4 ++-- .../helpcenter/pages/articles/NewArticle.vue | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/app/javascript/dashboard/components/layout/Sidebar.vue b/app/javascript/dashboard/components/layout/Sidebar.vue index 372562cd3..314b594d2 100644 --- a/app/javascript/dashboard/components/layout/Sidebar.vue +++ b/app/javascript/dashboard/components/layout/Sidebar.vue @@ -110,13 +110,19 @@ export default { primaryMenuItems() { const menuItems = this.sideMenuConfig.primaryMenu; return menuItems.filter(menuItem => { + const isAvailableForTheUser = menuItem.roles.includes(this.currentRole); + + if (!isAvailableForTheUser) { + return false; + } + if (menuItem.featureFlag) { return this.isFeatureEnabledonAccount( this.accountId, menuItem.featureFlag ); } - return menuItem.roles.includes(this.currentRole); + return true; }); }, activeSecondaryMenu() { diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue index 162e9343e..528b55575 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/HelpCenterLayout.vue @@ -10,6 +10,8 @@ v-if="portals.length" :class="sidebarClassName" :header-title="headerTitle" + :portal-slug="selectedPortalSlug" + :locale-slug="selectedLocaleInPortal" :sub-title="localeName(selectedLocaleInPortal)" :accessible-menu-items="accessibleMenuItems" :additional-secondary-menu-items="additionalSecondaryMenuItems" diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/Sidebar.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/Sidebar.vue index d2e14b6a8..355ffc0a1 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/Sidebar.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Sidebar/Sidebar.vue @@ -48,6 +48,14 @@ export default { type: String, default: '', }, + portalSlug: { + type: String, + default: '', + }, + localeSlug: { + type: String, + default: '', + }, accessibleMenuItems: { type: Array, default: () => [], @@ -68,8 +76,7 @@ export default { ); }, portalLink() { - const slug = this.$route.params.portalSlug; - return `/hc/${slug}`; + return `/hc/${this.portalSlug}/${this.localeSlug}`; }, }, methods: { diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue index 656c8fecf..700574b2e 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue @@ -65,7 +65,7 @@ export default { return { isUpdating: false, isSaved: false, - showArticleSettings: false, + showArticleSettings: true, alertMessage: '', showDeleteConfirmationPopup: false, }; @@ -86,7 +86,7 @@ export default { }, portalLink() { const slug = this.$route.params.portalSlug; - return `/hc/${slug}`; + return `/hc/${slug}/${this.article.category.slug}/${this.article.id}`; }, }, mounted() { diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue index 6d74088b3..7e0fafff0 100644 --- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue +++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/NewArticle.vue @@ -40,7 +40,7 @@ export default { articleTitle: '', articleContent: '', showOpenSidebarButton: false, - showArticleSettings: false, + showArticleSettings: true, article: {}, }; },