mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 12:37:56 +00:00
feat: Article settings sidebar in new article page (#5355)
This commit is contained in:
@@ -225,7 +225,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"CREATE_ARTICLE": {
|
"CREATE_ARTICLE": {
|
||||||
"ERROR_MESSAGE": "Something went wrong. Please try again."
|
"ERROR_MESSAGE": "Please add the article heading and content then only you can update the settings"
|
||||||
},
|
},
|
||||||
"SIDEBAR": {
|
"SIDEBAR": {
|
||||||
"SEARCH": {
|
"SEARCH": {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
variant="hollow"
|
variant="hollow"
|
||||||
size="small"
|
size="small"
|
||||||
color-scheme="secondary"
|
color-scheme="secondary"
|
||||||
|
:is-disabled="enableOpenSidebarButton"
|
||||||
@click="openSidebar"
|
@click="openSidebar"
|
||||||
/>
|
/>
|
||||||
<woot-button
|
<woot-button
|
||||||
@@ -82,6 +83,10 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
enableOpenSidebarButton: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!isEmptyObject(this.article.meta)) {
|
if (!isEmptyObject(this.article.meta || {})) {
|
||||||
const {
|
const {
|
||||||
meta: { title = '', description = '', tags = [] },
|
meta: { title = '', description = '', tags = [] },
|
||||||
} = this.article;
|
} = this.article;
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ export default {
|
|||||||
padding: var(--space-small) var(--space-normal);
|
padding: var(--space-small) var(--space-normal);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: scroll;
|
overflow: auto;
|
||||||
|
|
||||||
.edit-article--container {
|
.edit-article--container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
overflow: scroll;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-sidebar-open {
|
.is-sidebar-open {
|
||||||
|
|||||||
@@ -1,41 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="article-container">
|
<div class="article-container">
|
||||||
|
<div
|
||||||
|
class="new-article--container"
|
||||||
|
:class="{ 'is-sidebar-open': showArticleSettings }"
|
||||||
|
>
|
||||||
<edit-article-header
|
<edit-article-header
|
||||||
:back-button-label="$t('HELP_CENTER.HEADER.TITLES.ALL_ARTICLES')"
|
:back-button-label="$t('HELP_CENTER.HEADER.TITLES.ALL_ARTICLES')"
|
||||||
draft-state="saved"
|
draft-state="saved"
|
||||||
@back="onClickGoBack"
|
@back="onClickGoBack"
|
||||||
|
@open="openArticleSettings"
|
||||||
|
@close="closeArticleSettings"
|
||||||
@save-article="createNewArticle"
|
@save-article="createNewArticle"
|
||||||
/>
|
/>
|
||||||
<article-editor :article="article" @save-article="createNewArticle" />
|
<article-editor :article="newArticle" @save-article="createNewArticle" />
|
||||||
|
</div>
|
||||||
|
<article-settings
|
||||||
|
v-if="showArticleSettings"
|
||||||
|
:article="article"
|
||||||
|
@save-article="saveArticle"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import EditArticleHeader from 'dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader';
|
import EditArticleHeader from 'dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader';
|
||||||
import ArticleEditor from '../../components/ArticleEditor.vue';
|
import ArticleEditor from '../../components/ArticleEditor.vue';
|
||||||
import portalMixin from '../../mixins/portalMixin';
|
import portalMixin from '../../mixins/portalMixin';
|
||||||
import alertMixin from 'shared/mixins/alertMixin.js';
|
import alertMixin from 'shared/mixins/alertMixin.js';
|
||||||
|
import ArticleSettings from './ArticleSettings.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
EditArticleHeader,
|
EditArticleHeader,
|
||||||
ArticleEditor,
|
ArticleEditor,
|
||||||
|
ArticleSettings,
|
||||||
},
|
},
|
||||||
mixins: [portalMixin, alertMixin],
|
mixins: [portalMixin, alertMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
articleTitle: '',
|
articleTitle: '',
|
||||||
articleContent: '',
|
articleContent: '',
|
||||||
|
showOpenSidebarButton: false,
|
||||||
showArticleSettings: false,
|
showArticleSettings: false,
|
||||||
|
article: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
selectedPortal: 'portals/getSelectedPortal',
|
selectedPortal: 'portals/getSelectedPortal',
|
||||||
currentUserID: 'getCurrentUserID',
|
currentUserID: 'getCurrentUserID',
|
||||||
|
articles: 'articles/articles',
|
||||||
categories: 'categories/allCategories',
|
categories: 'categories/allCategories',
|
||||||
}),
|
}),
|
||||||
article() {
|
articleId() {
|
||||||
|
return this.$route.params.articleSlug;
|
||||||
|
},
|
||||||
|
newArticle() {
|
||||||
return { title: this.articleTitle, content: this.articleContent };
|
return { title: this.articleTitle, content: this.articleContent };
|
||||||
},
|
},
|
||||||
selectedPortalSlug() {
|
selectedPortalSlug() {
|
||||||
@@ -79,25 +98,35 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
openArticleSettings() {
|
||||||
|
this.showArticleSettings = true;
|
||||||
|
},
|
||||||
|
closeArticleSettings() {
|
||||||
|
this.showArticleSettings = false;
|
||||||
|
},
|
||||||
|
saveArticle() {
|
||||||
|
this.alertMessage = this.$t('HELP_CENTER.CREATE_ARTICLE.ERROR_MESSAGE');
|
||||||
|
this.showAlert(this.alertMessage);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.article-container {
|
.article-container {
|
||||||
|
display: flex;
|
||||||
padding: var(--space-small) var(--space-normal);
|
padding: var(--space-small) var(--space-normal);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: scroll;
|
overflow: auto;
|
||||||
|
}
|
||||||
.edit-article--container {
|
.new-article--container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
overflow: auto;
|
||||||
|
}
|
||||||
.is-sidebar-open {
|
.is-sidebar-open {
|
||||||
flex: 0.7;
|
flex: 0.7;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user