diff --git a/app/javascript/dashboard/constants.js b/app/javascript/dashboard/constants.js
index 64ee11e07..c98539152 100644
--- a/app/javascript/dashboard/constants.js
+++ b/app/javascript/dashboard/constants.js
@@ -12,6 +12,11 @@ export default {
SNOOZED: 'snoozed',
ALL: 'all',
},
+ ARTICLE_STATUS_TYPES: {
+ DRAFT: 0,
+ PUBLISH: 1,
+ ARCHIVE: 2,
+ },
LAYOUT_TYPES: {
CONDENSED: 'condensed',
EXPANDED: 'expanded',
diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
index 7e8b6a858..d5ab8c8eb 100644
--- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json
+++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json
@@ -20,6 +20,7 @@
"EDIT_HEADER": {
"ALL_ARTICLES": "All Articles",
"PUBLISH_BUTTON": "Publish",
+ "MOVE_TO_ARCHIVE_BUTTON": "Move to archived",
"PREVIEW": "Preview",
"ADD_TRANSLATION": "Add translation",
"OPEN_SIDEBAR": "Open sidebar",
@@ -143,7 +144,8 @@
}
},
"ADD": {
- "CREATE_FLOW": [{
+ "CREATE_FLOW": [
+ {
"title": "Help center information",
"route": "new_portal_information",
"body": "Basic information about portal",
@@ -286,6 +288,12 @@
"ERROR": "Error while saving article"
}
},
+ "PUBLISH_ARTICLE": {
+ "API": {
+ "ERROR": "Error while publishing article",
+ "SUCCESS": "Article publishied successfully"
+ }
+ },
"ARCHIVE_ARTICLE": {
"API": {
"ERROR": "Error while archiving article",
diff --git a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue
index 72f8f0cd6..98273e464 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/components/Header/EditArticleHeader.vue
@@ -59,19 +59,58 @@
color-scheme="secondary"
@click="closeSidebar"
/>
-
- {{ $t('HELP_CENTER.EDIT_HEADER.PUBLISH_BUTTON') }}
-
+
+
+
+ {{ $t('HELP_CENTER.EDIT_HEADER.PUBLISH_BUTTON') }}
+
+
+
+
+
+
+
+ {{ $t('HELP_CENTER.EDIT_HEADER.MOVE_TO_ARCHIVE_BUTTON') }}
+
+
+
+
+
@@ -149,6 +242,9 @@ export default {
}
.article--buttons {
margin-left: var(--space-smaller);
+ .dropdown-pane {
+ right: var(--space-smaller);
+ }
}
.draft-status {
margin-right: var(--space-smaller);
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 2d6402e62..a757ab921 100644
--- a/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue
+++ b/app/javascript/dashboard/routes/dashboard/helpcenter/pages/articles/EditArticle.vue
@@ -49,6 +49,9 @@ import ArticleSettings from './ArticleSettings.vue';
import Spinner from 'shared/components/Spinner';
import portalMixin from '../../mixins/portalMixin';
import alertMixin from 'shared/mixins/alertMixin';
+import wootConstants from 'dashboard/constants';
+
+const { ARTICLE_STATUS_TYPES } = wootConstants;
export default {
components: {
EditArticleHeader,
@@ -152,7 +155,7 @@ export default {
await this.$store.dispatch('articles/update', {
portalSlug: this.selectedPortalSlug,
articleId: this.articleId,
- status: 2,
+ status: ARTICLE_STATUS_TYPES.ARCHIVE,
});
this.alertMessage = this.$t('HELP_CENTER.ARCHIVE_ARTICLE.API.SUCCESS');
} catch (error) {
diff --git a/app/javascript/dashboard/store/modules/helpCenterArticles/getters.js b/app/javascript/dashboard/store/modules/helpCenterArticles/getters.js
index edffc53c2..2f78ab8ff 100644
--- a/app/javascript/dashboard/store/modules/helpCenterArticles/getters.js
+++ b/app/javascript/dashboard/store/modules/helpCenterArticles/getters.js
@@ -20,6 +20,12 @@ export const getters = {
.filter(article => article !== undefined);
return articles;
},
+ articleStatus: (...getterArguments) => articleId => {
+ const [state] = getterArguments;
+ const article = state.articles.byId[articleId];
+ if (!article) return undefined;
+ return article.status;
+ },
getMeta: state => {
return state.meta;
},
diff --git a/app/javascript/dashboard/store/modules/helpCenterArticles/specs/getters.spec.js b/app/javascript/dashboard/store/modules/helpCenterArticles/specs/getters.spec.js
index 73d703641..b2d462b97 100644
--- a/app/javascript/dashboard/store/modules/helpCenterArticles/specs/getters.spec.js
+++ b/app/javascript/dashboard/store/modules/helpCenterArticles/specs/getters.spec.js
@@ -34,6 +34,10 @@ describe('#getters', () => {
});
});
+ it('articleStatus', () => {
+ expect(getters.articleStatus(state)(1)).toEqual('draft');
+ });
+
it('isFetchingArticles', () => {
expect(getters.isFetching(state)).toEqual(true);
});