fix: Add improvements to the Help Center module (#6081)
This commit is contained in:
parent
9106f6278d
commit
82d3398932
7 changed files with 34 additions and 24 deletions
|
@ -40,6 +40,7 @@
|
||||||
:portals="portals"
|
:portals="portals"
|
||||||
:active-portal-slug="selectedPortalSlug"
|
:active-portal-slug="selectedPortalSlug"
|
||||||
:active-locale="selectedLocaleInPortal"
|
:active-locale="selectedLocaleInPortal"
|
||||||
|
@fetch-portal="fetchPortalAndItsCategories"
|
||||||
@close-popover="closePortalPopover"
|
@close-popover="closePortalPopover"
|
||||||
/>
|
/>
|
||||||
<add-category
|
<add-category
|
||||||
|
@ -226,12 +227,6 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
|
||||||
'$route.params.portalSlug'() {
|
|
||||||
this.fetchPortalsAndItsCategories();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', this.handleResize);
|
window.addEventListener('resize', this.handleResize);
|
||||||
this.handleResize();
|
this.handleResize();
|
||||||
|
@ -240,7 +235,7 @@ export default {
|
||||||
const slug = this.$route.params.portalSlug;
|
const slug = this.$route.params.portalSlug;
|
||||||
if (slug) this.lastActivePortalSlug = slug;
|
if (slug) this.lastActivePortalSlug = slug;
|
||||||
|
|
||||||
this.fetchPortalsAndItsCategories();
|
this.fetchPortalAndItsCategories();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
bus.$off(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar);
|
bus.$off(BUS_EVENTS.TOGGLE_SIDEMENU, this.toggleSidebar);
|
||||||
|
@ -267,7 +262,7 @@ export default {
|
||||||
toggleSidebar() {
|
toggleSidebar() {
|
||||||
this.isSidebarOpen = !this.isSidebarOpen;
|
this.isSidebarOpen = !this.isSidebarOpen;
|
||||||
},
|
},
|
||||||
async fetchPortalsAndItsCategories() {
|
async fetchPortalAndItsCategories() {
|
||||||
await this.$store.dispatch('portals/index');
|
await this.$store.dispatch('portals/index');
|
||||||
const selectedPortalParam = {
|
const selectedPortalParam = {
|
||||||
portalSlug: this.selectedPortalSlug,
|
portalSlug: this.selectedPortalSlug,
|
||||||
|
|
|
@ -248,7 +248,7 @@ export default {
|
||||||
this.$emit('open-site', this.portal.slug);
|
this.$emit('open-site', this.portal.slug);
|
||||||
},
|
},
|
||||||
openSettings() {
|
openSettings() {
|
||||||
this.fetchPortalsAndItsCategories();
|
this.fetchPortalAndItsCategories();
|
||||||
this.navigateToPortalEdit();
|
this.navigateToPortalEdit();
|
||||||
},
|
},
|
||||||
onClickOpenDeleteModal(portal) {
|
onClickOpenDeleteModal(portal) {
|
||||||
|
@ -258,12 +258,18 @@ export default {
|
||||||
closeDeletePopup() {
|
closeDeletePopup() {
|
||||||
this.showDeleteConfirmationPopup = false;
|
this.showDeleteConfirmationPopup = false;
|
||||||
},
|
},
|
||||||
fetchPortalsAndItsCategories() {
|
async fetchPortalAndItsCategories() {
|
||||||
this.$store.dispatch('portals/index').then(() => {
|
await this.$store.dispatch('portals/index');
|
||||||
this.$store.dispatch('categories/index', {
|
const {
|
||||||
portalSlug: this.portal.slug,
|
slug,
|
||||||
});
|
config: { allowed_locales: allowedLocales },
|
||||||
});
|
} = this.portal;
|
||||||
|
const selectedPortalParam = {
|
||||||
|
portalSlug: slug,
|
||||||
|
locale: allowedLocales[0].code,
|
||||||
|
};
|
||||||
|
this.$store.dispatch('portals/show', selectedPortalParam);
|
||||||
|
this.$store.dispatch('categories/index', selectedPortalParam);
|
||||||
},
|
},
|
||||||
async onClickDeletePortal() {
|
async onClickDeletePortal() {
|
||||||
const { slug } = this.selectedPortalForDelete;
|
const { slug } = this.selectedPortalForDelete;
|
||||||
|
|
|
@ -36,7 +36,8 @@
|
||||||
:active-portal-slug="activePortalSlug"
|
:active-portal-slug="activePortalSlug"
|
||||||
:active-locale="activeLocale"
|
:active-locale="activeLocale"
|
||||||
:active="portal.slug === activePortalSlug"
|
:active="portal.slug === activePortalSlug"
|
||||||
@open-portal-page="onPortalSelect"
|
@open-portal-page="closePortalPopover"
|
||||||
|
@fetch-portal="fetchPortalAndItsCategories"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,15 +70,15 @@ export default {
|
||||||
closePortalPopover() {
|
closePortalPopover() {
|
||||||
this.$emit('close-popover');
|
this.$emit('close-popover');
|
||||||
},
|
},
|
||||||
onPortalSelect() {
|
|
||||||
this.$emit('close-popover');
|
|
||||||
},
|
|
||||||
openPortalPage() {
|
openPortalPage() {
|
||||||
this.closePortalPopover();
|
this.closePortalPopover();
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'list_all_portals',
|
name: 'list_all_portals',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
fetchPortalAndItsCategories() {
|
||||||
|
this.$emit('fetch-portal');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
{{ $t('HELP_CENTER.PORTAL.ADD.LOGO.LABEL') }}
|
{{ $t('HELP_CENTER.PORTAL.ADD.LOGO.LABEL') }}
|
||||||
</label>
|
</label>
|
||||||
<div class="logo-container">
|
<div class="logo-container">
|
||||||
<thumbnail :username="name" size="56" variant="square" />
|
<thumbnail :username="name" size="56px" variant="square" />
|
||||||
<woot-button
|
<woot-button
|
||||||
v-if="false"
|
v-if="false"
|
||||||
class="upload-button"
|
class="upload-button"
|
||||||
|
|
|
@ -121,6 +121,7 @@ export default {
|
||||||
locale: code,
|
locale: code,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
this.$emit('fetch-portal');
|
||||||
this.$emit('open-portal-page');
|
this.$emit('open-portal-page');
|
||||||
},
|
},
|
||||||
isLocaleActive(code, slug) {
|
isLocaleActive(code, slug) {
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
</header>
|
</header>
|
||||||
<div class="category-list">
|
<div class="category-list">
|
||||||
<category-list-item
|
<category-list-item
|
||||||
:categories="categoryByLocaleCode"
|
:categories="categoriesByLocaleCode"
|
||||||
@delete="deleteCategory"
|
@delete="deleteCategory"
|
||||||
@edit="openEditCategoryModal"
|
@edit="openEditCategoryModal"
|
||||||
/>
|
/>
|
||||||
|
@ -91,7 +91,7 @@ export default {
|
||||||
currentPortalSlug() {
|
currentPortalSlug() {
|
||||||
return this.$route.params.portalSlug;
|
return this.$route.params.portalSlug;
|
||||||
},
|
},
|
||||||
categoryByLocaleCode() {
|
categoriesByLocaleCode() {
|
||||||
return this.$store.getters['categories/categoriesByLocaleCode'](
|
return this.$store.getters['categories/categoriesByLocaleCode'](
|
||||||
this.currentLocaleCode
|
this.currentLocaleCode
|
||||||
);
|
);
|
||||||
|
@ -131,6 +131,12 @@ export default {
|
||||||
closeEditCategoryModal() {
|
closeEditCategoryModal() {
|
||||||
this.showEditCategoryModal = false;
|
this.showEditCategoryModal = false;
|
||||||
},
|
},
|
||||||
|
async fetchCategoriesByPortalSlugAndLocale(localeCode) {
|
||||||
|
await this.$store.dispatch('categories/index', {
|
||||||
|
portalSlug: this.currentPortalSlug,
|
||||||
|
locale: localeCode,
|
||||||
|
});
|
||||||
|
},
|
||||||
async deleteCategory(categoryId) {
|
async deleteCategory(categoryId) {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('categories/delete', {
|
await this.$store.dispatch('categories/delete', {
|
||||||
|
@ -152,6 +158,7 @@ export default {
|
||||||
changeCurrentCategory(event) {
|
changeCurrentCategory(event) {
|
||||||
const localeCode = event.target.value;
|
const localeCode = event.target.value;
|
||||||
this.currentLocaleCode = localeCode;
|
this.currentLocaleCode = localeCode;
|
||||||
|
this.fetchCategoriesByPortalSlugAndLocale(localeCode);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,11 +41,11 @@ export const actions = {
|
||||||
portalSlug,
|
portalSlug,
|
||||||
articleObj,
|
articleObj,
|
||||||
});
|
});
|
||||||
const { id: articleId, portal } = payload;
|
const { id: articleId } = payload;
|
||||||
commit(types.ADD_ARTICLE, payload);
|
commit(types.ADD_ARTICLE, payload);
|
||||||
commit(types.ADD_ARTICLE_ID, articleId);
|
commit(types.ADD_ARTICLE_ID, articleId);
|
||||||
commit(types.ADD_ARTICLE_FLAG, articleId);
|
commit(types.ADD_ARTICLE_FLAG, articleId);
|
||||||
dispatch('portals/updatePortal', portal, { root: true });
|
dispatch('portals/updatePortal', portalSlug, { root: true });
|
||||||
return articleId;
|
return articleId;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return throwErrorMessage(error);
|
return throwErrorMessage(error);
|
||||||
|
|
Loading…
Reference in a new issue