@tager/admin-blog 0.3.41 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/paths.d.ts +6 -14
- package/dist/constants/routes.d.ts +5 -5
- package/dist/dev/App.vue.d.ts +5 -0
- package/dist/dev/config.d.ts +2 -0
- package/dist/dev/env.d.ts +1 -0
- package/dist/dev/main.d.ts +3 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/useFetchCategories.d.ts +3 -6
- package/dist/hooks/useFetchCategory.d.ts +7 -8
- package/dist/hooks/useFetchModuleConfig.d.ts +3 -6
- package/dist/hooks/useFetchPosts.d.ts +3 -6
- package/dist/index.mjs +2363 -0
- package/dist/locales/apply.d.ts +1 -0
- package/dist/locales/en.d.ts +87 -80
- package/dist/locales/ru.d.ts +3 -3
- package/dist/main.d.ts +3 -4
- package/dist/services/requests.d.ts +59 -57
- package/dist/style.css +1 -0
- package/dist/typings/common.d.ts +1 -1
- package/dist/typings/model.d.ts +106 -104
- package/dist/utils/common.d.ts +2 -2
- package/dist/utils/paths.d.ts +8 -0
- package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +7 -7
- package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +53 -116
- package/dist/views/Categories/CategoryForm/index.d.ts +1 -1
- package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +7 -7
- package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +26 -57
- package/dist/views/Categories/CategoryList/hooks/index.d.ts +1 -1
- package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +19 -16
- package/dist/views/Categories/CategoryList/index.d.ts +1 -1
- package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +32 -30
- package/dist/views/Posts/PostForm/PostForm.vue.d.ts +2768 -9394
- package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +5 -5
- package/dist/views/Posts/PostForm/components/TabList/TabList.vue.d.ts +23 -0
- package/dist/views/Posts/PostForm/components/TabList/index.d.ts +2 -2
- package/dist/views/Posts/PostForm/index.d.ts +1 -1
- package/dist/views/Posts/PostList/PostList.helpers.d.ts +7 -7
- package/dist/views/Posts/PostList/PostList.vue.d.ts +38 -71
- package/dist/views/Posts/PostList/hooks/index.d.ts +1 -1
- package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +27 -24
- package/dist/views/Posts/PostList/index.d.ts +1 -1
- package/package.json +51 -49
- package/src/constants/paths.ts +0 -22
- package/src/constants/routes.ts +9 -9
- package/src/dev/App.vue +56 -0
- package/src/dev/config.ts +23 -0
- package/src/dev/env.ts +17 -0
- package/src/dev/main.ts +49 -0
- package/src/hooks/useFetchCategories.ts +2 -7
- package/src/hooks/useFetchCategory.ts +3 -6
- package/src/hooks/useFetchModuleConfig.ts +2 -7
- package/src/hooks/useFetchPosts.ts +2 -5
- package/src/locales/apply.ts +9 -0
- package/src/locales/en.ts +10 -3
- package/src/locales/ru.ts +11 -2
- package/src/main.ts +3 -8
- package/src/services/requests.ts +2 -0
- package/src/typings/model.ts +2 -0
- package/src/utils/paths.ts +23 -0
- package/src/views/Categories/CategoryForm/CategoryForm.vue +81 -61
- package/src/views/Categories/CategoryList/CategoryList.helpers.ts +1 -1
- package/src/views/Categories/CategoryList/CategoryList.vue +86 -58
- package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +9 -12
- package/src/views/Posts/PostForm/PostForm.helpers.ts +15 -7
- package/src/views/Posts/PostForm/PostForm.vue +191 -112
- package/src/views/Posts/PostForm/components/TabList/TabList.vue +2 -2
- package/src/views/Posts/PostList/PostList.helpers.ts +9 -10
- package/src/views/Posts/PostList/PostList.vue +138 -105
- package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +22 -30
- package/CHANGELOG.md +0 -13
- package/dist/constants/menu.d.ts +0 -5
- package/dist/dev.d.ts +0 -1
- package/dist/index.esm.js +0 -5144
- package/dist/index.umd.js +0 -5171
- package/dist/router/index.d.ts +0 -4
- package/src/constants/menu.ts +0 -31
- package/src/dev.ts +0 -34
- package/src/router/index.ts +0 -40
- package/src/typings/sfc.d.ts +0 -12
- package/src/typings/shims-tsx.d.ts +0 -13
- package/src/typings/shims-vue.d.ts +0 -11
- package/src/typings/translate.d.ts +0 -10
- package/src/views/App.vue +0 -22
- package/src/views/Home.vue +0 -31
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2363 @@
|
|
|
1
|
+
import { i18n, request, useResource, createId, notEmpty, isNotNullish, useI18n, useResourceDelete, useResourceClone, useToast, navigateBack, convertRequestErrorToMap, urlTranslit, getWebsiteOrigin } from "@tager/admin-services";
|
|
2
|
+
import { onMounted, watch, computed, ref, defineComponent, resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode, createCommentVNode, toDisplayString, createElementBlock, createTextVNode, Fragment, renderList, normalizeClass, withModifiers, createSlots } from "vue";
|
|
3
|
+
import isEqual from "lodash.isequal";
|
|
4
|
+
import pick from "lodash.pick";
|
|
5
|
+
import { useRoute, useRouter } from "vue-router";
|
|
6
|
+
import { getFilterParamAsStringArray, getFilterParamAsString, getFilterParams, DeleteIcon, ContentCopyIcon, EditIcon, BaseButton, FormField, FormFieldMultiSelect, AdvancedSearch, DataTable, useDataTable, formatDateTime, SeoFieldGroup, FormFieldFileInput, FormFieldRichTextInput, FormFieldCheckbox, FormFieldUrlAliasInput, FormFieldSelect, ShortCodeConstructor, FormFooter, createTabErrorFinder, SouthIcon, NorthIcon, CountButton } from "@tager/admin-ui";
|
|
7
|
+
import { Page } from "@tager/admin-layout";
|
|
8
|
+
import { universalFieldUtils, DynamicField } from "@tager/admin-dynamic-field";
|
|
9
|
+
import { compile } from "path-to-regexp";
|
|
10
|
+
import "i18next";
|
|
11
|
+
const EN = {
|
|
12
|
+
yes: "Yes",
|
|
13
|
+
no: "no",
|
|
14
|
+
blog: "Blog",
|
|
15
|
+
posts: "Posts",
|
|
16
|
+
categories: "Categories",
|
|
17
|
+
createPost: "Create post",
|
|
18
|
+
createCategory: "Create category",
|
|
19
|
+
home: "Home",
|
|
20
|
+
allPosts: "All posts",
|
|
21
|
+
postForm: "Post Form",
|
|
22
|
+
allCategories: "All categories",
|
|
23
|
+
categoryForm: "Category Form",
|
|
24
|
+
success: "Success",
|
|
25
|
+
error: "Error",
|
|
26
|
+
newPost: "New Post",
|
|
27
|
+
edit: "Edit",
|
|
28
|
+
remove: "Remove",
|
|
29
|
+
postsByCategory: "Posts by category",
|
|
30
|
+
name: "Name",
|
|
31
|
+
image: "Image",
|
|
32
|
+
language: "Language",
|
|
33
|
+
languages: "Languages",
|
|
34
|
+
date: "Date",
|
|
35
|
+
dateOfPublication: "Date of publication",
|
|
36
|
+
dateOfPublicationFrom: "Date of publication - From",
|
|
37
|
+
dateOfPublicationTo: "Date of publication - To",
|
|
38
|
+
from: "from",
|
|
39
|
+
to: "to",
|
|
40
|
+
From: "From",
|
|
41
|
+
To: "To",
|
|
42
|
+
category: "Category",
|
|
43
|
+
actions: "Actions",
|
|
44
|
+
updatePost: "Update post",
|
|
45
|
+
title: "Title",
|
|
46
|
+
link: "Link",
|
|
47
|
+
excerpt: "Excerpt",
|
|
48
|
+
body: "Body",
|
|
49
|
+
defaultCategory: "Default Category",
|
|
50
|
+
coverImage: "Cover Image",
|
|
51
|
+
innerImage: "Post Image",
|
|
52
|
+
innerImageMobile: "Post Image (Mobile)",
|
|
53
|
+
tags: "Tags",
|
|
54
|
+
relatedPosts: "Related posts",
|
|
55
|
+
blogPostWasSuccessfullyCreated: "Blog post was successfully created",
|
|
56
|
+
blogPostWasSuccessfullyUpdated: "Blog post was successfully updated",
|
|
57
|
+
blogPostCreationWasFailed: "Blog post creation was failed",
|
|
58
|
+
blogPostUpdateWasFailed: "Blog post update was failed",
|
|
59
|
+
common: "Common",
|
|
60
|
+
images: "Images",
|
|
61
|
+
relations: "Relations",
|
|
62
|
+
additionalFields: "Additional Fields",
|
|
63
|
+
viewPost: "View Post",
|
|
64
|
+
blogCategories: "Blog Categories",
|
|
65
|
+
newCategory: "New Category",
|
|
66
|
+
moveUp: "Move up",
|
|
67
|
+
moveDown: "Move down",
|
|
68
|
+
createBlogCategory: "Create Blog category",
|
|
69
|
+
updateBlogCategory: "Update Blog category",
|
|
70
|
+
pageTitle: "Page title",
|
|
71
|
+
pageDescription: "Page description",
|
|
72
|
+
openGraphImage: "Open graph image",
|
|
73
|
+
blogCategoryWasSuccessfullyCreated: "Blog category was successfully created",
|
|
74
|
+
blogCategoryWasSuccessfullyUpdated: "Blog category was successfully updated",
|
|
75
|
+
blogCategoryCreationWasFailed: "Blog category creation was failed",
|
|
76
|
+
blogCategoryUpdateWasFailed: "Blog category update was failed",
|
|
77
|
+
clone: "Clone",
|
|
78
|
+
cloneConfirm: "Are you sure you want to clone the page?",
|
|
79
|
+
cloneSuccess: "Page have copied successfully",
|
|
80
|
+
cloneFailure: "Page copy failure",
|
|
81
|
+
tabs: {
|
|
82
|
+
common: "Common",
|
|
83
|
+
seo: "SEO"
|
|
84
|
+
},
|
|
85
|
+
parentCategory: "Parent category",
|
|
86
|
+
noParent: "No parent",
|
|
87
|
+
status: "Status",
|
|
88
|
+
statusPublished: "Published",
|
|
89
|
+
statusDraft: "Draft",
|
|
90
|
+
statusArchived: "Archived",
|
|
91
|
+
scheduleArchive: "Schedule archive",
|
|
92
|
+
schedulePublish: "Schedule publish",
|
|
93
|
+
archiveAt: "Archive at",
|
|
94
|
+
publishAt: "Publish at",
|
|
95
|
+
archiveAtLabel: "Archive at",
|
|
96
|
+
publishAtLabel: "Publish at"
|
|
97
|
+
};
|
|
98
|
+
const RU = {
|
|
99
|
+
yes: "\u0414\u0430",
|
|
100
|
+
no: "\u041D\u0435\u0442",
|
|
101
|
+
blog: "\u0411\u043B\u043E\u0433",
|
|
102
|
+
posts: "\u041F\u043E\u0441\u0442\u044B",
|
|
103
|
+
categories: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",
|
|
104
|
+
createPost: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043F\u043E\u0441\u0442",
|
|
105
|
+
createCategory: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E",
|
|
106
|
+
home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
|
|
107
|
+
allPosts: "\u0412\u0441\u0435 \u043F\u043E\u0441\u0442\u044B",
|
|
108
|
+
postForm: "\u0424\u043E\u0440\u043C\u0430 \u043F\u043E\u0441\u0442\u0430",
|
|
109
|
+
allCategories: "\u0412\u0441\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",
|
|
110
|
+
categoryForm: "\u0424\u043E\u0440\u043C\u0430 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",
|
|
111
|
+
success: "\u0423\u0441\u043F\u0435\u0445",
|
|
112
|
+
error: "\u041E\u0448\u0438\u0431\u043A\u0430",
|
|
113
|
+
newPost: "\u041D\u043E\u0432\u044B\u0439 \u043F\u043E\u0441\u0442",
|
|
114
|
+
edit: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
115
|
+
remove: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C",
|
|
116
|
+
postsByCategory: "\u041F\u043E\u0441\u0442\u044B \u043F\u043E \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F\u043C",
|
|
117
|
+
name: "\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435",
|
|
118
|
+
image: "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435",
|
|
119
|
+
language: "\u042F\u0437\u044B\u043A",
|
|
120
|
+
languages: "\u042F\u0437\u044B\u043A\u0438",
|
|
121
|
+
date: "\u0414\u0430\u0442\u0430",
|
|
122
|
+
dateOfPublication: "\u0414\u0430\u0442\u0430 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438",
|
|
123
|
+
dateOfPublicationFrom: "\u0414\u0430\u0442\u0430 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438 - \u041E\u0442",
|
|
124
|
+
dateOfPublicationTo: "\u0414\u0430\u0442\u0430 \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u0438 - \u0414\u043E",
|
|
125
|
+
from: "\u043E\u0442",
|
|
126
|
+
to: "\u0434\u043E",
|
|
127
|
+
From: "\u041E\u0442",
|
|
128
|
+
To: "\u0414\u043E",
|
|
129
|
+
category: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F",
|
|
130
|
+
actions: "\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044F",
|
|
131
|
+
updatePost: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u043F\u043E\u0441\u0442",
|
|
132
|
+
title: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A",
|
|
133
|
+
link: "\u0421\u0441\u044B\u043B\u043A\u0430",
|
|
134
|
+
excerpt: "\u041A\u0440\u0430\u0442\u043A\u043E\u0435 \u043E\u043F\u0438\u0441\u0430\u043D\u0438\u0435",
|
|
135
|
+
defaultCategory: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043F\u043E-\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
|
|
136
|
+
body: "\u0421\u043E\u0434\u0435\u0440\u0436\u0430\u043D\u0438\u0435",
|
|
137
|
+
coverImage: "\u041E\u0431\u043B\u043E\u0436\u043A\u0430",
|
|
138
|
+
innerImage: "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u043F\u043E\u0441\u0442\u0430",
|
|
139
|
+
innerImageMobile: "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u043F\u043E\u0441\u0442\u0430 (Mobile)",
|
|
140
|
+
tags: "\u0422\u0435\u0433\u0438",
|
|
141
|
+
relatedPosts: "\u041F\u043E\u0445\u043E\u0436\u0438\u0435 \u043F\u043E\u0441\u0442\u044B",
|
|
142
|
+
blogPostWasSuccessfullyCreated: "\u0417\u0430\u043F\u0438\u0441\u044C \u0432 \u0431\u043B\u043E\u0433\u0435 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D\u0430",
|
|
143
|
+
blogPostWasSuccessfullyUpdated: "\u0417\u0430\u043F\u0438\u0441\u044C \u0432 \u0431\u043B\u043E\u0433\u0435 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043E",
|
|
144
|
+
blogPostCreationWasFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u044C \u0432 \u0431\u043B\u043E\u0433\u0435",
|
|
145
|
+
blogPostUpdateWasFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0437\u0430\u043F\u0438\u0441\u044C \u0432 \u0431\u043B\u043E\u0433\u0435",
|
|
146
|
+
common: "\u041E\u0431\u0449\u0438\u0435",
|
|
147
|
+
images: "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0438",
|
|
148
|
+
relations: "\u0421\u0432\u044F\u0437\u0438",
|
|
149
|
+
additionalFields: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u043F\u043E\u043B\u044F",
|
|
150
|
+
viewPost: "\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043F\u043E\u0441\u0442",
|
|
151
|
+
blogCategories: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438",
|
|
152
|
+
newCategory: "\u041D\u043E\u0432\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F",
|
|
153
|
+
moveUp: "\u0414\u0432\u0438\u0433\u0430\u0442\u044C\u0441\u044F \u0432\u0432\u0435\u0440\u0445",
|
|
154
|
+
moveDown: "\u0414\u0432\u0438\u0433\u0430\u0442\u044C\u0441\u044F \u0432\u043D\u0438\u0437",
|
|
155
|
+
createBlogCategory: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0431\u043B\u043E\u0433\u0430",
|
|
156
|
+
updateBlogCategory: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0431\u043B\u043E\u0433\u0430",
|
|
157
|
+
pageTitle: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
|
|
158
|
+
pageDescription: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
|
|
159
|
+
openGraphImage: "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
|
|
160
|
+
blogCategoryWasSuccessfullyCreated: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u0431\u043B\u043E\u0433\u0430 \u0431\u044B\u043B\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D\u0430",
|
|
161
|
+
blogCategoryWasSuccessfullyUpdated: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u0431\u043B\u043E\u0433\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0430",
|
|
162
|
+
blogCategoryCreationWasFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0431\u043B\u043E\u0433\u0430",
|
|
163
|
+
blogCategoryUpdateWasFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0431\u043B\u043E\u0433\u0430",
|
|
164
|
+
clone: "\u041A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
165
|
+
cloneConfirm: "\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0445\u043E\u0442\u0438\u0442\u0435 \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043A\u043E\u043F\u0438\u044E \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B?",
|
|
166
|
+
cloneSuccess: "\u041A\u043E\u043F\u0438\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D\u0430",
|
|
167
|
+
cloneFailure: "\u041E\u0448\u0438\u0431\u043A\u0430 \u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B",
|
|
168
|
+
tabs: {
|
|
169
|
+
common: "\u041E\u0431\u0449\u0438\u0435",
|
|
170
|
+
seo: "SEO"
|
|
171
|
+
},
|
|
172
|
+
parentCategory: "\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F",
|
|
173
|
+
noParent: "\u041D\u0435\u0442 \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u043E\u0439",
|
|
174
|
+
status: "\u0421\u0442\u0430\u0442\u0443\u0441",
|
|
175
|
+
statusPublished: "\u041E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D",
|
|
176
|
+
statusDraft: "\u0427\u0435\u0440\u043D\u043E\u0432\u0438\u043A",
|
|
177
|
+
statusArchived: "\u0412 \u0430\u0440\u0445\u0438\u0432\u0435",
|
|
178
|
+
scheduleArchive: "\u0417\u0430\u043F\u043B\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0435\u0440\u0435\u043D\u043E\u0441 \u0432 \u0430\u0440\u0445\u0438\u0432",
|
|
179
|
+
schedulePublish: "\u0417\u0430\u043F\u043B\u0430\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044E",
|
|
180
|
+
archiveAt: "\u041F\u0435\u0440\u0435\u043D\u0435\u0441\u0442\u0438 \u0432 \u0430\u0440\u0445\u0438\u0432 \u0432",
|
|
181
|
+
publishAt: "\u041E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u0442\u044C \u0432",
|
|
182
|
+
archiveAtLabel: "\u041F\u0435\u0440\u0435\u043D\u043E\u0441 \u0432 \u0430\u0440\u0445\u0438\u0432",
|
|
183
|
+
publishAtLabel: "\u041F\u0443\u0431\u043B\u0438\u043A\u0430\u0446\u0438\u044F"
|
|
184
|
+
};
|
|
185
|
+
function applyTranslations() {
|
|
186
|
+
i18n.addTranslations("en", "blog", EN);
|
|
187
|
+
i18n.addTranslations("ru", "blog", RU);
|
|
188
|
+
}
|
|
189
|
+
function getPosts(params) {
|
|
190
|
+
return request.get({ path: "/admin/blog/posts", params });
|
|
191
|
+
}
|
|
192
|
+
function getBlogPostCount() {
|
|
193
|
+
return request.get({ path: "/admin/blog/posts/count" });
|
|
194
|
+
}
|
|
195
|
+
function getPost(postId) {
|
|
196
|
+
return request.get({ path: `/admin/blog/posts/${postId}` });
|
|
197
|
+
}
|
|
198
|
+
function clonePost(postId) {
|
|
199
|
+
return request.post({ path: `/admin/blog/posts/${postId}/clone` });
|
|
200
|
+
}
|
|
201
|
+
function createBlogPost(payload) {
|
|
202
|
+
return request.post({ path: "/admin/blog/posts", body: payload });
|
|
203
|
+
}
|
|
204
|
+
function updateBlogPost(postId, payload) {
|
|
205
|
+
return request.put({ path: `/admin/blog/posts/${postId}`, body: payload });
|
|
206
|
+
}
|
|
207
|
+
function deleteBlogPost(postId) {
|
|
208
|
+
return request.delete({ path: `/admin/blog/posts/${postId}` });
|
|
209
|
+
}
|
|
210
|
+
function getCategories(params) {
|
|
211
|
+
return request.get({ path: "/admin/blog/categories", params });
|
|
212
|
+
}
|
|
213
|
+
function getCategory(categoryId) {
|
|
214
|
+
return request.get({ path: `/admin/blog/categories/${categoryId}` });
|
|
215
|
+
}
|
|
216
|
+
function createCategory(payload) {
|
|
217
|
+
return request.post({ path: "/admin/blog/categories", body: payload });
|
|
218
|
+
}
|
|
219
|
+
function updateCategory(categoryId, payload) {
|
|
220
|
+
return request.put({
|
|
221
|
+
path: `/admin/blog/categories/${categoryId}`,
|
|
222
|
+
body: payload
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function deleteCategory(categoryId) {
|
|
226
|
+
return request.delete({
|
|
227
|
+
path: `/admin/blog/categories/${categoryId}`
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function moveCategory(categoryId, direction) {
|
|
231
|
+
return request.post({
|
|
232
|
+
path: `/admin/blog/categories/move/${categoryId}/${direction}`
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function getModuleConfig() {
|
|
236
|
+
return request.get({
|
|
237
|
+
path: `/admin/blog/module-info`
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function useFetchPosts() {
|
|
241
|
+
const [fetchPosts, resource] = useResource({
|
|
242
|
+
fetchResource: () => getPosts({ pageNumber: 1, pageSize: 99999 }),
|
|
243
|
+
initialValue: [],
|
|
244
|
+
resourceName: "Blog posts"
|
|
245
|
+
});
|
|
246
|
+
onMounted(() => {
|
|
247
|
+
fetchPosts();
|
|
248
|
+
});
|
|
249
|
+
return resource;
|
|
250
|
+
}
|
|
251
|
+
function useFetchCategory({
|
|
252
|
+
categoryId,
|
|
253
|
+
isCreation
|
|
254
|
+
}) {
|
|
255
|
+
const [fetchCategory, resource] = useResource({
|
|
256
|
+
fetchResource: () => getCategory(categoryId.value),
|
|
257
|
+
initialValue: null,
|
|
258
|
+
resourceName: "Blog category"
|
|
259
|
+
});
|
|
260
|
+
onMounted(() => {
|
|
261
|
+
if (isCreation.value || !categoryId.value) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
fetchCategory();
|
|
265
|
+
});
|
|
266
|
+
watch(categoryId, () => {
|
|
267
|
+
if (isCreation.value || !categoryId.value) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
fetchCategory();
|
|
271
|
+
});
|
|
272
|
+
return resource;
|
|
273
|
+
}
|
|
274
|
+
function useFetchCategories() {
|
|
275
|
+
const [fetchCategories, resource] = useResource({
|
|
276
|
+
fetchResource: getCategories,
|
|
277
|
+
initialValue: [],
|
|
278
|
+
resourceName: "Blog categories"
|
|
279
|
+
});
|
|
280
|
+
onMounted(() => {
|
|
281
|
+
fetchCategories();
|
|
282
|
+
});
|
|
283
|
+
return resource;
|
|
284
|
+
}
|
|
285
|
+
function useFetchModuleConfig() {
|
|
286
|
+
const [fetchModuleConfig, resource] = useResource({
|
|
287
|
+
fetchResource: getModuleConfig,
|
|
288
|
+
initialValue: null,
|
|
289
|
+
resourceName: "Module configuration"
|
|
290
|
+
});
|
|
291
|
+
onMounted(() => {
|
|
292
|
+
fetchModuleConfig();
|
|
293
|
+
});
|
|
294
|
+
return resource;
|
|
295
|
+
}
|
|
296
|
+
const BLOG_ROUTE_PATHS = {
|
|
297
|
+
POST_LIST: "/blog/posts",
|
|
298
|
+
POST_FORM: "/blog/posts/:postId",
|
|
299
|
+
CATEGORY_LIST: "/blog/categories",
|
|
300
|
+
CATEGORY_FORM: "/blog/categories/:categoryId"
|
|
301
|
+
};
|
|
302
|
+
function getBlogPostListUrl() {
|
|
303
|
+
return BLOG_ROUTE_PATHS.POST_LIST;
|
|
304
|
+
}
|
|
305
|
+
function getBlogPostFormUrl(params) {
|
|
306
|
+
return compile(BLOG_ROUTE_PATHS.POST_FORM)({ postId: params.postId });
|
|
307
|
+
}
|
|
308
|
+
function getBlogCategoryListUrl() {
|
|
309
|
+
return BLOG_ROUTE_PATHS.CATEGORY_LIST;
|
|
310
|
+
}
|
|
311
|
+
function getBlogCategoryFormUrl(params) {
|
|
312
|
+
return compile(BLOG_ROUTE_PATHS.CATEGORY_FORM)({
|
|
313
|
+
categoryId: params.categoryId
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function generateNumberArray(length) {
|
|
317
|
+
return Array.from({ length }, (_, index) => index);
|
|
318
|
+
}
|
|
319
|
+
function getNameWithDepth(name, depth) {
|
|
320
|
+
return generateNumberArray(depth).map(() => "\u2014").join(" ") + " " + name;
|
|
321
|
+
}
|
|
322
|
+
const getStatusOptions = (t) => [
|
|
323
|
+
{ label: t("blog:statusPublished"), value: "PUBLISHED" },
|
|
324
|
+
{ label: t("blog:statusDraft"), value: "DRAFT" },
|
|
325
|
+
{ label: t("blog:statusArchived"), value: "ARCHIVED" }
|
|
326
|
+
];
|
|
327
|
+
function convertPostToFormValues(post, languageOptionList, postOptionList, additionalFieldList, statusOptions) {
|
|
328
|
+
var _a, _b, _c;
|
|
329
|
+
if (!post) {
|
|
330
|
+
return {
|
|
331
|
+
title: "",
|
|
332
|
+
excerpt: "",
|
|
333
|
+
body: "",
|
|
334
|
+
datetime: "",
|
|
335
|
+
coverImage: null,
|
|
336
|
+
image: null,
|
|
337
|
+
imageMobile: null,
|
|
338
|
+
pageTitle: "",
|
|
339
|
+
pageDescription: "",
|
|
340
|
+
openGraphImage: null,
|
|
341
|
+
urlAlias: "",
|
|
342
|
+
categories: [],
|
|
343
|
+
language: null,
|
|
344
|
+
relatedPosts: [],
|
|
345
|
+
tags: "",
|
|
346
|
+
additionalFields: additionalFieldList.map(
|
|
347
|
+
(fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
|
|
348
|
+
),
|
|
349
|
+
status: statusOptions[0],
|
|
350
|
+
statusDateEnabled: false,
|
|
351
|
+
statusDate: null
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const currentLangOption = languageOptionList.find(
|
|
355
|
+
(option) => option.value === post.language
|
|
356
|
+
);
|
|
357
|
+
const selectedPostOptionList = postOptionList.filter(
|
|
358
|
+
(option) => post.relatedPosts.some((relatedPost) => relatedPost.id === option.value)
|
|
359
|
+
);
|
|
360
|
+
const foundStatus = (_a = statusOptions.find(({ value }) => value === post.status)) != null ? _a : statusOptions[0];
|
|
361
|
+
return {
|
|
362
|
+
title: post.title,
|
|
363
|
+
excerpt: post.excerpt,
|
|
364
|
+
body: post.body,
|
|
365
|
+
datetime: post.datetime ? post.datetime.substr(0, 10) : "",
|
|
366
|
+
coverImage: post.coverImage ? { id: createId(), file: post.coverImage } : null,
|
|
367
|
+
image: post.image ? { id: createId(), file: post.image } : null,
|
|
368
|
+
imageMobile: post.imageMobile ? { id: createId(), file: post.imageMobile } : null,
|
|
369
|
+
pageTitle: (_b = post.pageTitle) != null ? _b : "",
|
|
370
|
+
pageDescription: (_c = post.pageDescription) != null ? _c : "",
|
|
371
|
+
openGraphImage: post.openGraphImage ? { id: createId(), file: post.openGraphImage } : null,
|
|
372
|
+
urlAlias: post.urlAlias,
|
|
373
|
+
categories: post.categories.map((category) => ({
|
|
374
|
+
value: category.id,
|
|
375
|
+
label: category.name
|
|
376
|
+
})),
|
|
377
|
+
language: currentLangOption != null ? currentLangOption : null,
|
|
378
|
+
relatedPosts: selectedPostOptionList,
|
|
379
|
+
tags: post.tags.join(","),
|
|
380
|
+
additionalFields: additionalFieldList.map((fieldConfig) => {
|
|
381
|
+
const postAdditionalField = post.additionalFields.find(
|
|
382
|
+
({ name }) => name === fieldConfig.name
|
|
383
|
+
);
|
|
384
|
+
return universalFieldUtils.createFormField(
|
|
385
|
+
fieldConfig,
|
|
386
|
+
postAdditionalField == null ? void 0 : postAdditionalField.value
|
|
387
|
+
);
|
|
388
|
+
}),
|
|
389
|
+
status: foundStatus,
|
|
390
|
+
statusDateEnabled: post.status === "PUBLISHED" ? !!post.archiveAt : post.status === "DRAFT" ? !!post.publishAt : false,
|
|
391
|
+
statusDate: post.status === "PUBLISHED" && post.archiveAt ? post.archiveAt.substr(0, 10) : post.status === "DRAFT" && post.publishAt ? post.publishAt.substr(0, 10) : null
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function convertFormValuesToCreationPayload(values) {
|
|
395
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
396
|
+
return {
|
|
397
|
+
title: values.title,
|
|
398
|
+
excerpt: values.excerpt,
|
|
399
|
+
urlAlias: values.urlAlias,
|
|
400
|
+
body: values.body,
|
|
401
|
+
datetime: values.datetime,
|
|
402
|
+
coverImage: (_b = (_a = values.coverImage) == null ? void 0 : _a.file.id) != null ? _b : null,
|
|
403
|
+
image: (_d = (_c = values.image) == null ? void 0 : _c.file.id) != null ? _d : null,
|
|
404
|
+
imageMobile: (_f = (_e = values.imageMobile) == null ? void 0 : _e.file.id) != null ? _f : null,
|
|
405
|
+
pageTitle: values.pageTitle,
|
|
406
|
+
pageDescription: values.pageDescription,
|
|
407
|
+
openGraphImage: (_h = (_g = values.openGraphImage) == null ? void 0 : _g.file.id) != null ? _h : null,
|
|
408
|
+
categories: values.categories.map((option) => option.value),
|
|
409
|
+
language: (_j = (_i = values.language) == null ? void 0 : _i.value) != null ? _j : null,
|
|
410
|
+
relatedPosts: values.relatedPosts.map(
|
|
411
|
+
(relatedPostOption) => relatedPostOption.value
|
|
412
|
+
),
|
|
413
|
+
tags: values.tags.split(",").filter((tag) => tag.trim().length > 0),
|
|
414
|
+
additionalFields: values.additionalFields.map((field) => ({
|
|
415
|
+
name: field.config.name,
|
|
416
|
+
value: universalFieldUtils.getOutgoingValue(field)
|
|
417
|
+
})),
|
|
418
|
+
status: values.status.value,
|
|
419
|
+
archiveAt: values.status.value === "PUBLISHED" && values.statusDateEnabled && values.statusDate ? values.statusDate : null,
|
|
420
|
+
publishAt: values.status.value === "DRAFT" && values.statusDateEnabled && values.statusDate ? values.statusDate : null
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function convertFormValuesToUpdatePayload(values) {
|
|
424
|
+
return {
|
|
425
|
+
...convertFormValuesToCreationPayload(values),
|
|
426
|
+
urlAlias: values.urlAlias
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function convertCategoryListToOptions$1(categoryList, languageId) {
|
|
430
|
+
return categoryList.filter(({ language }) => languageId ? language === languageId : true).map(({ id, name, depth }) => ({
|
|
431
|
+
value: id,
|
|
432
|
+
label: getNameWithDepth(name, depth)
|
|
433
|
+
}));
|
|
434
|
+
}
|
|
435
|
+
function convertPostList(postList, selectedCategory, languages) {
|
|
436
|
+
return postList.filter(
|
|
437
|
+
(post) => selectedCategory ? post.categories.some(({ id }) => id === selectedCategory.id) : true
|
|
438
|
+
).map((post) => {
|
|
439
|
+
if (languages.length > 0) {
|
|
440
|
+
const foundLanguage = languages.find(({ id }) => id === post.language);
|
|
441
|
+
return {
|
|
442
|
+
...post,
|
|
443
|
+
language: foundLanguage ? foundLanguage.name : post.language
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
return post;
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function getStatuses(t) {
|
|
450
|
+
return {
|
|
451
|
+
PUBLISHED: t("blog:statusPublished"),
|
|
452
|
+
DRAFT: t("blog:statusDraft"),
|
|
453
|
+
ARCHIVED: t("blog:statusArchived")
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function getPostTableColumnDefs(moduleConfig, t) {
|
|
457
|
+
const isLangSpecific = moduleConfig ? moduleConfig.languages.length > 0 : false;
|
|
458
|
+
const COLUMN_DEFS = [
|
|
459
|
+
{
|
|
460
|
+
id: 1,
|
|
461
|
+
name: "ID",
|
|
462
|
+
field: "id",
|
|
463
|
+
style: { width: "50px", textAlign: "center" },
|
|
464
|
+
headStyle: { width: "50px", textAlign: "center" }
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
id: 2,
|
|
468
|
+
name: t("blog:status"),
|
|
469
|
+
field: "status",
|
|
470
|
+
style: { width: "140px" },
|
|
471
|
+
headStyle: { width: "140px" }
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
id: 3,
|
|
475
|
+
name: t("blog:name"),
|
|
476
|
+
field: "name",
|
|
477
|
+
type: "name",
|
|
478
|
+
format: ({ row }) => ({
|
|
479
|
+
adminLink: {
|
|
480
|
+
text: row.title,
|
|
481
|
+
url: getBlogPostFormUrl({ postId: row.id })
|
|
482
|
+
},
|
|
483
|
+
websiteLink: {
|
|
484
|
+
text: row.url,
|
|
485
|
+
url: [
|
|
486
|
+
{}.VUE_APP_WEBSITE_URL || window.location.origin,
|
|
487
|
+
row.url
|
|
488
|
+
].join("")
|
|
489
|
+
}
|
|
490
|
+
})
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
id: 4,
|
|
494
|
+
name: t("blog:image"),
|
|
495
|
+
field: "image",
|
|
496
|
+
type: "image",
|
|
497
|
+
style: { width: "250px" },
|
|
498
|
+
headStyle: { width: "250px" }
|
|
499
|
+
},
|
|
500
|
+
isLangSpecific ? { id: 5, name: t("blog:language"), field: "language" } : null,
|
|
501
|
+
{
|
|
502
|
+
id: 6,
|
|
503
|
+
name: t("blog:date"),
|
|
504
|
+
field: "datetime",
|
|
505
|
+
type: "datetime",
|
|
506
|
+
options: { ignoreStartOfDayTime: true }
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: 7,
|
|
510
|
+
name: t("blog:categories"),
|
|
511
|
+
field: "categories",
|
|
512
|
+
format: ({ row }) => row.categories.map((category) => category.name).join(", ")
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: 8,
|
|
516
|
+
name: t("blog:actions"),
|
|
517
|
+
field: "actions",
|
|
518
|
+
style: { whiteSpace: "nowrap", width: "120px" },
|
|
519
|
+
headStyle: { whiteSpace: "nowrap", width: "120px" }
|
|
520
|
+
}
|
|
521
|
+
];
|
|
522
|
+
return COLUMN_DEFS.filter(notEmpty);
|
|
523
|
+
}
|
|
524
|
+
const dateFormat = (date) => date.split("-").reverse().join(".");
|
|
525
|
+
function useAdvancedSearch$1({
|
|
526
|
+
t,
|
|
527
|
+
route,
|
|
528
|
+
categoryList,
|
|
529
|
+
languageList,
|
|
530
|
+
statusOptionList
|
|
531
|
+
}) {
|
|
532
|
+
const categoryOptionList = computed(
|
|
533
|
+
() => categoryList.value.map(({ id, name, depth }) => ({
|
|
534
|
+
value: String(id),
|
|
535
|
+
label: getNameWithDepth(name, depth)
|
|
536
|
+
}))
|
|
537
|
+
);
|
|
538
|
+
const initialCategoryFilter = computed(() => {
|
|
539
|
+
const queryValue = getFilterParamAsStringArray(
|
|
540
|
+
route.query,
|
|
541
|
+
"category"
|
|
542
|
+
);
|
|
543
|
+
return categoryOptionList.value.filter(
|
|
544
|
+
({ value }) => queryValue.some((selected) => selected === value)
|
|
545
|
+
);
|
|
546
|
+
});
|
|
547
|
+
const categoryFilter = ref(initialCategoryFilter.value);
|
|
548
|
+
watch(initialCategoryFilter, () => {
|
|
549
|
+
categoryFilter.value = initialCategoryFilter.value;
|
|
550
|
+
});
|
|
551
|
+
const languageOptionList = computed(
|
|
552
|
+
() => languageList.value.map(({ id, name }) => ({ value: id, label: name }))
|
|
553
|
+
);
|
|
554
|
+
const initialLanguageFilter = computed(() => {
|
|
555
|
+
const queryValue = getFilterParamAsStringArray(
|
|
556
|
+
route.query,
|
|
557
|
+
"language"
|
|
558
|
+
);
|
|
559
|
+
return languageOptionList.value.filter(
|
|
560
|
+
({ value }) => queryValue.some((selected) => selected === value)
|
|
561
|
+
);
|
|
562
|
+
});
|
|
563
|
+
const languageFilter = ref(initialLanguageFilter.value);
|
|
564
|
+
watch(initialLanguageFilter, () => {
|
|
565
|
+
languageFilter.value = initialLanguageFilter.value;
|
|
566
|
+
});
|
|
567
|
+
const initialFromDateFilter = computed(
|
|
568
|
+
() => {
|
|
569
|
+
var _a;
|
|
570
|
+
return (_a = getFilterParamAsString(route.query, "from-date")) != null ? _a : "";
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
const fromDateFilter = ref(initialFromDateFilter.value);
|
|
574
|
+
watch(initialFromDateFilter, () => {
|
|
575
|
+
fromDateFilter.value = initialFromDateFilter.value;
|
|
576
|
+
});
|
|
577
|
+
const initialToDateFilter = computed(
|
|
578
|
+
() => {
|
|
579
|
+
var _a;
|
|
580
|
+
return (_a = getFilterParamAsString(route.query, "to-date")) != null ? _a : "";
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
const toDateFilter = ref(initialToDateFilter.value);
|
|
584
|
+
watch(initialToDateFilter, () => {
|
|
585
|
+
toDateFilter.value = initialToDateFilter.value;
|
|
586
|
+
});
|
|
587
|
+
const date = computed(() => {
|
|
588
|
+
if (!fromDateFilter.value && !toDateFilter.value) {
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
let label = "";
|
|
592
|
+
if (fromDateFilter.value && toDateFilter.value) {
|
|
593
|
+
label = `${dateFormat(fromDateFilter.value)} - ${dateFormat(
|
|
594
|
+
toDateFilter.value
|
|
595
|
+
)}`;
|
|
596
|
+
}
|
|
597
|
+
if (fromDateFilter.value && !toDateFilter.value) {
|
|
598
|
+
label = `${t("blog:from")} ${dateFormat(fromDateFilter.value)}`;
|
|
599
|
+
}
|
|
600
|
+
if (!fromDateFilter.value && toDateFilter.value) {
|
|
601
|
+
label = `${t("blog:to")} ${dateFormat(toDateFilter.value)}`;
|
|
602
|
+
}
|
|
603
|
+
return {
|
|
604
|
+
value: "",
|
|
605
|
+
label,
|
|
606
|
+
name: "from-date",
|
|
607
|
+
title: t("blog:dateOfPublication")
|
|
608
|
+
};
|
|
609
|
+
});
|
|
610
|
+
const initialStatusFilter = computed(() => {
|
|
611
|
+
const queryValue = getFilterParamAsStringArray(
|
|
612
|
+
route.query,
|
|
613
|
+
"status"
|
|
614
|
+
);
|
|
615
|
+
return statusOptionList.value.filter(
|
|
616
|
+
({ value }) => queryValue.some((selected) => selected === value)
|
|
617
|
+
);
|
|
618
|
+
});
|
|
619
|
+
const statusFilter = ref(initialStatusFilter.value);
|
|
620
|
+
watch(initialStatusFilter, () => {
|
|
621
|
+
statusFilter.value = initialStatusFilter.value;
|
|
622
|
+
});
|
|
623
|
+
const filterParams = computed(() => {
|
|
624
|
+
const filters = {
|
|
625
|
+
["category"]: categoryFilter.value.map(({ value }) => value),
|
|
626
|
+
["language"]: languageFilter.value.map(({ value }) => value),
|
|
627
|
+
["status"]: statusFilter.value.map(({ value }) => value)
|
|
628
|
+
};
|
|
629
|
+
if (fromDateFilter.value) {
|
|
630
|
+
filters["from-date"] = fromDateFilter.value;
|
|
631
|
+
}
|
|
632
|
+
if (toDateFilter.value) {
|
|
633
|
+
filters["to-date"] = toDateFilter.value;
|
|
634
|
+
}
|
|
635
|
+
return getFilterParams(filters);
|
|
636
|
+
});
|
|
637
|
+
function tagRemovalHandler(event) {
|
|
638
|
+
if (event.name === "category") {
|
|
639
|
+
categoryFilter.value = categoryFilter.value.filter(
|
|
640
|
+
({ value }) => value !== event.value
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
if (event.name === "language") {
|
|
644
|
+
languageFilter.value = languageFilter.value.filter(
|
|
645
|
+
({ value }) => value !== event.value
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
if (event.name === "from-date") {
|
|
649
|
+
fromDateFilter.value = "";
|
|
650
|
+
toDateFilter.value = "";
|
|
651
|
+
}
|
|
652
|
+
if (event.name === "status") {
|
|
653
|
+
statusFilter.value = statusFilter.value.filter(
|
|
654
|
+
({ value }) => value !== event.value
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
const tags = computed(
|
|
659
|
+
() => [
|
|
660
|
+
...categoryFilter.value.map(({ value, label }) => ({
|
|
661
|
+
value,
|
|
662
|
+
label,
|
|
663
|
+
name: "category",
|
|
664
|
+
title: t("blog:category")
|
|
665
|
+
})),
|
|
666
|
+
...languageFilter.value.map(({ value, label }) => ({
|
|
667
|
+
value,
|
|
668
|
+
label,
|
|
669
|
+
name: "language",
|
|
670
|
+
title: t("blog:language")
|
|
671
|
+
})),
|
|
672
|
+
date.value,
|
|
673
|
+
...statusFilter.value.map(({ value, label }) => ({
|
|
674
|
+
value,
|
|
675
|
+
label,
|
|
676
|
+
name: "status",
|
|
677
|
+
title: t("blog:status")
|
|
678
|
+
}))
|
|
679
|
+
].filter(isNotNullish)
|
|
680
|
+
);
|
|
681
|
+
const selectedCategoryOptionList = computed(() => {
|
|
682
|
+
if (languageFilter.value.length === 0) {
|
|
683
|
+
return categoryOptionList.value;
|
|
684
|
+
}
|
|
685
|
+
const selectedList = categoryList.value.filter(
|
|
686
|
+
({ language }) => languageFilter.value.some(({ value }) => value === language)
|
|
687
|
+
);
|
|
688
|
+
return selectedList.map(({ id, name, depth }) => ({
|
|
689
|
+
value: String(id),
|
|
690
|
+
label: getNameWithDepth(name, depth)
|
|
691
|
+
}));
|
|
692
|
+
});
|
|
693
|
+
return {
|
|
694
|
+
categoryFilter,
|
|
695
|
+
categoryOptionList: selectedCategoryOptionList,
|
|
696
|
+
languageFilter,
|
|
697
|
+
languageOptionList,
|
|
698
|
+
fromDateFilter,
|
|
699
|
+
toDateFilter,
|
|
700
|
+
statusFilter,
|
|
701
|
+
tagRemovalHandler,
|
|
702
|
+
tags,
|
|
703
|
+
filterParams
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
var PostList_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
707
|
+
var _export_sfc = (sfc, props) => {
|
|
708
|
+
const target = sfc.__vccOpts || sfc;
|
|
709
|
+
for (const [key, val] of props) {
|
|
710
|
+
target[key] = val;
|
|
711
|
+
}
|
|
712
|
+
return target;
|
|
713
|
+
};
|
|
714
|
+
const _sfc_main$4 = defineComponent({
|
|
715
|
+
name: "PostList",
|
|
716
|
+
components: {
|
|
717
|
+
DeleteIcon,
|
|
718
|
+
ContentCopyIcon,
|
|
719
|
+
EditIcon,
|
|
720
|
+
BaseButton,
|
|
721
|
+
FormField,
|
|
722
|
+
FormFieldMultiSelect,
|
|
723
|
+
AdvancedSearch,
|
|
724
|
+
Page,
|
|
725
|
+
DataTable
|
|
726
|
+
},
|
|
727
|
+
setup() {
|
|
728
|
+
const { t } = useI18n();
|
|
729
|
+
const route = useRoute();
|
|
730
|
+
const router = useRouter();
|
|
731
|
+
const categoryId = computed(() => {
|
|
732
|
+
var _a;
|
|
733
|
+
return Array.isArray(route.query.category) ? (_a = route.query.category[0]) != null ? _a : "" : route.query.category;
|
|
734
|
+
});
|
|
735
|
+
const statusOptionList = computed(() => getStatusOptions(t));
|
|
736
|
+
const { data: moduleConfig, loading: isModuleConfigLoading } = useFetchModuleConfig();
|
|
737
|
+
const languageList = computed(
|
|
738
|
+
() => {
|
|
739
|
+
var _a, _b;
|
|
740
|
+
return (_b = (_a = moduleConfig.value) == null ? void 0 : _a.languages) != null ? _b : [];
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
const { data: categoryList, loading: isCategoryListLoading } = useFetchCategories();
|
|
744
|
+
const selectedCategory = computed(
|
|
745
|
+
() => {
|
|
746
|
+
var _a;
|
|
747
|
+
return categoryId.value ? (_a = categoryList.value.find(
|
|
748
|
+
({ id }) => String(id) === String(categoryId.value)
|
|
749
|
+
)) != null ? _a : null : null;
|
|
750
|
+
}
|
|
751
|
+
);
|
|
752
|
+
const pageTitle = computed(() => {
|
|
753
|
+
return selectedCategory.value ? `${t("blog:postsByCategory")} "${selectedCategory.value.name}"` : t("blog:posts");
|
|
754
|
+
});
|
|
755
|
+
const isLangSpecific = computed(
|
|
756
|
+
() => languageOptionList.value.length > 1
|
|
757
|
+
);
|
|
758
|
+
const {
|
|
759
|
+
categoryFilter,
|
|
760
|
+
categoryOptionList,
|
|
761
|
+
languageFilter,
|
|
762
|
+
languageOptionList,
|
|
763
|
+
fromDateFilter,
|
|
764
|
+
toDateFilter,
|
|
765
|
+
filterParams,
|
|
766
|
+
tags,
|
|
767
|
+
tagRemovalHandler,
|
|
768
|
+
statusFilter
|
|
769
|
+
} = useAdvancedSearch$1({
|
|
770
|
+
t,
|
|
771
|
+
route,
|
|
772
|
+
categoryList,
|
|
773
|
+
languageList,
|
|
774
|
+
statusOptionList
|
|
775
|
+
});
|
|
776
|
+
const {
|
|
777
|
+
fetchEntityList: fetchPostList,
|
|
778
|
+
isLoading: isPostLoading,
|
|
779
|
+
rowData: postList,
|
|
780
|
+
errorMessage,
|
|
781
|
+
searchQuery,
|
|
782
|
+
handleChange,
|
|
783
|
+
pageNumber,
|
|
784
|
+
pageCount,
|
|
785
|
+
pageSize
|
|
786
|
+
} = useDataTable({
|
|
787
|
+
fetchEntityList: (params) => getPosts({
|
|
788
|
+
query: params.searchQuery,
|
|
789
|
+
pageNumber: params.pageNumber,
|
|
790
|
+
pageSize: params.pageSize,
|
|
791
|
+
...filterParams.value
|
|
792
|
+
}),
|
|
793
|
+
initialValue: [],
|
|
794
|
+
resourceName: "Blog post list",
|
|
795
|
+
pageSize: 100
|
|
796
|
+
});
|
|
797
|
+
watch(filterParams, () => {
|
|
798
|
+
if (isModuleConfigLoading.value || isCategoryListLoading.value) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
const newQuery = {
|
|
802
|
+
...pick(route.query, ["query", "pageNumber"]),
|
|
803
|
+
...filterParams.value
|
|
804
|
+
};
|
|
805
|
+
if (!isEqual(route.query, newQuery)) {
|
|
806
|
+
router.replace({ query: newQuery });
|
|
807
|
+
fetchPostList();
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
const displayedPostList = computed(
|
|
811
|
+
() => {
|
|
812
|
+
var _a, _b;
|
|
813
|
+
return convertPostList(
|
|
814
|
+
postList.value,
|
|
815
|
+
selectedCategory.value,
|
|
816
|
+
(_b = (_a = moduleConfig.value) == null ? void 0 : _a.languages) != null ? _b : []
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
const isRowDataLoading = computed(
|
|
821
|
+
() => isCategoryListLoading.value || isPostLoading.value || isModuleConfigLoading.value
|
|
822
|
+
);
|
|
823
|
+
const { isDeleting, handleResourceDelete } = useResourceDelete({
|
|
824
|
+
deleteResource: deleteBlogPost,
|
|
825
|
+
resourceName: "Post",
|
|
826
|
+
onSuccess: fetchPostList
|
|
827
|
+
});
|
|
828
|
+
const { isCloning, handleResourceClone } = useResourceClone({
|
|
829
|
+
cloneResource: clonePost,
|
|
830
|
+
confirmMessage: t("blog:cloneConfirm"),
|
|
831
|
+
successMessage: t("blog:cloneSuccess"),
|
|
832
|
+
failureMessage: t("blog:cloneFailure"),
|
|
833
|
+
onSuccessRedirectTo: (data) => `/blog/posts/${data.id}`
|
|
834
|
+
});
|
|
835
|
+
function isBusy(postId) {
|
|
836
|
+
return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;
|
|
837
|
+
}
|
|
838
|
+
const columnDefs = computed(
|
|
839
|
+
() => getPostTableColumnDefs(moduleConfig.value, t)
|
|
840
|
+
);
|
|
841
|
+
return {
|
|
842
|
+
t,
|
|
843
|
+
formatDateTime,
|
|
844
|
+
columnDefs,
|
|
845
|
+
rowData: displayedPostList,
|
|
846
|
+
handleResourceDelete,
|
|
847
|
+
isDeleting,
|
|
848
|
+
categoryList,
|
|
849
|
+
isRowDataLoading,
|
|
850
|
+
errorMessage,
|
|
851
|
+
getBlogPostFormUrl,
|
|
852
|
+
pageTitle,
|
|
853
|
+
searchQuery,
|
|
854
|
+
handleChange,
|
|
855
|
+
pageNumber,
|
|
856
|
+
pageCount,
|
|
857
|
+
pageSize,
|
|
858
|
+
categoryFilter,
|
|
859
|
+
categoryOptionList,
|
|
860
|
+
isLangSpecific,
|
|
861
|
+
languageFilter,
|
|
862
|
+
languageOptionList,
|
|
863
|
+
fromDateFilter,
|
|
864
|
+
toDateFilter,
|
|
865
|
+
statusFilter,
|
|
866
|
+
statusOptionList,
|
|
867
|
+
tags,
|
|
868
|
+
tagRemovalHandler,
|
|
869
|
+
getStatuses,
|
|
870
|
+
handleResourceClone,
|
|
871
|
+
isBusy
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
const _hoisted_1$3 = { class: "filters" };
|
|
876
|
+
const _hoisted_2$2 = { class: "filters" };
|
|
877
|
+
const _hoisted_3$2 = { class: "status" };
|
|
878
|
+
const _hoisted_4$1 = { key: 0 };
|
|
879
|
+
const _hoisted_5 = { key: 1 };
|
|
880
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
881
|
+
const _component_FormFieldMultiSelect = resolveComponent("FormFieldMultiSelect");
|
|
882
|
+
const _component_FormField = resolveComponent("FormField");
|
|
883
|
+
const _component_AdvancedSearch = resolveComponent("AdvancedSearch");
|
|
884
|
+
const _component_EditIcon = resolveComponent("EditIcon");
|
|
885
|
+
const _component_BaseButton = resolveComponent("BaseButton");
|
|
886
|
+
const _component_ContentCopyIcon = resolveComponent("ContentCopyIcon");
|
|
887
|
+
const _component_DeleteIcon = resolveComponent("DeleteIcon");
|
|
888
|
+
const _component_DataTable = resolveComponent("DataTable");
|
|
889
|
+
const _component_Page = resolveComponent("Page");
|
|
890
|
+
return openBlock(), createBlock(_component_Page, {
|
|
891
|
+
title: _ctx.pageTitle,
|
|
892
|
+
"header-buttons": [
|
|
893
|
+
{
|
|
894
|
+
text: _ctx.$i18n.t("blog:newPost"),
|
|
895
|
+
href: _ctx.getBlogPostFormUrl({ postId: "create" })
|
|
896
|
+
}
|
|
897
|
+
]
|
|
898
|
+
}, {
|
|
899
|
+
content: withCtx(() => [
|
|
900
|
+
createVNode(_component_DataTable, {
|
|
901
|
+
"column-defs": _ctx.columnDefs,
|
|
902
|
+
"row-data": _ctx.rowData,
|
|
903
|
+
loading: _ctx.isRowDataLoading,
|
|
904
|
+
"error-message": _ctx.errorMessage,
|
|
905
|
+
"search-query": _ctx.searchQuery,
|
|
906
|
+
pagination: {
|
|
907
|
+
pageNumber: _ctx.pageNumber,
|
|
908
|
+
pageCount: _ctx.pageCount,
|
|
909
|
+
pageSize: _ctx.pageSize,
|
|
910
|
+
disabled: _ctx.isRowDataLoading
|
|
911
|
+
},
|
|
912
|
+
"data-table": "blog-post",
|
|
913
|
+
onChange: _ctx.handleChange
|
|
914
|
+
}, {
|
|
915
|
+
filters: withCtx(() => [
|
|
916
|
+
createVNode(_component_AdvancedSearch, {
|
|
917
|
+
tags: _ctx.tags,
|
|
918
|
+
"onClick:tag": _ctx.tagRemovalHandler
|
|
919
|
+
}, {
|
|
920
|
+
default: withCtx(() => [
|
|
921
|
+
createElementVNode("div", _hoisted_1$3, [
|
|
922
|
+
createVNode(_component_FormFieldMultiSelect, {
|
|
923
|
+
"selected-options": _ctx.categoryFilter,
|
|
924
|
+
"onUpdate:selected-options": _cache[0] || (_cache[0] = ($event) => _ctx.categoryFilter = $event),
|
|
925
|
+
options: _ctx.categoryOptionList,
|
|
926
|
+
name: "categoryFilter",
|
|
927
|
+
searchable: true,
|
|
928
|
+
label: _ctx.$i18n.t("blog:category"),
|
|
929
|
+
class: "filter"
|
|
930
|
+
}, null, 8, ["selected-options", "options", "label"]),
|
|
931
|
+
_ctx.isLangSpecific ? (openBlock(), createBlock(_component_FormFieldMultiSelect, {
|
|
932
|
+
key: 0,
|
|
933
|
+
"selected-options": _ctx.languageFilter,
|
|
934
|
+
"onUpdate:selected-options": _cache[1] || (_cache[1] = ($event) => _ctx.languageFilter = $event),
|
|
935
|
+
options: _ctx.languageOptionList,
|
|
936
|
+
name: "languageFilter",
|
|
937
|
+
searchable: true,
|
|
938
|
+
label: _ctx.$i18n.t("blog:language"),
|
|
939
|
+
class: "filter"
|
|
940
|
+
}, null, 8, ["selected-options", "options", "label"])) : createCommentVNode("", true),
|
|
941
|
+
createVNode(_component_FormFieldMultiSelect, {
|
|
942
|
+
"selected-options": _ctx.statusFilter,
|
|
943
|
+
"onUpdate:selected-options": _cache[2] || (_cache[2] = ($event) => _ctx.statusFilter = $event),
|
|
944
|
+
options: _ctx.statusOptionList,
|
|
945
|
+
name: "statusFilter",
|
|
946
|
+
searchable: true,
|
|
947
|
+
label: _ctx.$i18n.t("blog:status"),
|
|
948
|
+
class: "filter"
|
|
949
|
+
}, null, 8, ["selected-options", "options", "label"])
|
|
950
|
+
]),
|
|
951
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
952
|
+
createVNode(_component_FormField, {
|
|
953
|
+
value: _ctx.fromDateFilter,
|
|
954
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.fromDateFilter = $event),
|
|
955
|
+
label: _ctx.$i18n.t("blog:dateOfPublicationFrom"),
|
|
956
|
+
name: "fromDateFilter",
|
|
957
|
+
type: "date",
|
|
958
|
+
max: _ctx.toDateFilter
|
|
959
|
+
}, null, 8, ["value", "label", "max"]),
|
|
960
|
+
createVNode(_component_FormField, {
|
|
961
|
+
value: _ctx.toDateFilter,
|
|
962
|
+
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => _ctx.toDateFilter = $event),
|
|
963
|
+
label: _ctx.$i18n.t("blog:dateOfPublicationTo"),
|
|
964
|
+
name: "toDateFilter",
|
|
965
|
+
type: "date",
|
|
966
|
+
min: _ctx.fromDateFilter
|
|
967
|
+
}, null, 8, ["value", "label", "min"])
|
|
968
|
+
])
|
|
969
|
+
]),
|
|
970
|
+
_: 1
|
|
971
|
+
}, 8, ["tags", "onClick:tag"])
|
|
972
|
+
]),
|
|
973
|
+
"cell(status)": withCtx(({ row }) => [
|
|
974
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
975
|
+
createElementVNode("span", null, toDisplayString(_ctx.getStatuses(_ctx.$i18n.t)[row.status]), 1),
|
|
976
|
+
row.status === "PUBLISHED" && row.archiveAt ? (openBlock(), createElementBlock("span", _hoisted_4$1, [
|
|
977
|
+
createTextVNode(toDisplayString(_ctx.$i18n.t("blog:archiveAtLabel")) + ": ", 1),
|
|
978
|
+
createElementVNode("i", null, toDisplayString(_ctx.formatDateTime(new Date(row.archiveAt), true)), 1)
|
|
979
|
+
])) : createCommentVNode("", true),
|
|
980
|
+
row.status === "DRAFT" && row.publishAt ? (openBlock(), createElementBlock("span", _hoisted_5, [
|
|
981
|
+
createTextVNode(toDisplayString(_ctx.$i18n.t("blog:publishAtLabel")) + ": ", 1),
|
|
982
|
+
createElementVNode("i", null, toDisplayString(_ctx.formatDateTime(new Date(row.publishAt), true)), 1)
|
|
983
|
+
])) : createCommentVNode("", true)
|
|
984
|
+
])
|
|
985
|
+
]),
|
|
986
|
+
"cell(actions)": withCtx(({ row }) => [
|
|
987
|
+
createVNode(_component_BaseButton, {
|
|
988
|
+
variant: "icon",
|
|
989
|
+
title: _ctx.$i18n.t("blog:edit"),
|
|
990
|
+
disabled: _ctx.isBusy(row.id),
|
|
991
|
+
href: _ctx.getBlogPostFormUrl({ postId: row.id })
|
|
992
|
+
}, {
|
|
993
|
+
default: withCtx(() => [
|
|
994
|
+
createVNode(_component_EditIcon)
|
|
995
|
+
]),
|
|
996
|
+
_: 2
|
|
997
|
+
}, 1032, ["title", "disabled", "href"]),
|
|
998
|
+
createVNode(_component_BaseButton, {
|
|
999
|
+
variant: "icon",
|
|
1000
|
+
title: _ctx.$i18n.t("blog:clone"),
|
|
1001
|
+
disabled: _ctx.isBusy(row.id),
|
|
1002
|
+
onClick: ($event) => _ctx.handleResourceClone(row.id)
|
|
1003
|
+
}, {
|
|
1004
|
+
default: withCtx(() => [
|
|
1005
|
+
createVNode(_component_ContentCopyIcon)
|
|
1006
|
+
]),
|
|
1007
|
+
_: 2
|
|
1008
|
+
}, 1032, ["title", "disabled", "onClick"]),
|
|
1009
|
+
createVNode(_component_BaseButton, {
|
|
1010
|
+
variant: "icon",
|
|
1011
|
+
title: _ctx.$i18n.t("blog:remove"),
|
|
1012
|
+
disabled: _ctx.isBusy(row.id),
|
|
1013
|
+
onClick: ($event) => _ctx.handleResourceDelete(row.id)
|
|
1014
|
+
}, {
|
|
1015
|
+
default: withCtx(() => [
|
|
1016
|
+
createVNode(_component_DeleteIcon)
|
|
1017
|
+
]),
|
|
1018
|
+
_: 2
|
|
1019
|
+
}, 1032, ["title", "disabled", "onClick"])
|
|
1020
|
+
]),
|
|
1021
|
+
_: 1
|
|
1022
|
+
}, 8, ["column-defs", "row-data", "loading", "error-message", "search-query", "pagination", "onChange"])
|
|
1023
|
+
]),
|
|
1024
|
+
_: 1
|
|
1025
|
+
}, 8, ["title", "header-buttons"]);
|
|
1026
|
+
}
|
|
1027
|
+
var BlogPostList = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-2ee9b750"]]);
|
|
1028
|
+
var TabList_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1029
|
+
const _sfc_main$3 = defineComponent({
|
|
1030
|
+
name: "TabList",
|
|
1031
|
+
props: {
|
|
1032
|
+
tabList: {
|
|
1033
|
+
type: Array,
|
|
1034
|
+
required: true
|
|
1035
|
+
},
|
|
1036
|
+
selectedTabId: {
|
|
1037
|
+
type: String,
|
|
1038
|
+
required: true
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
setup(props, context) {
|
|
1042
|
+
function handleTabClick(tabId) {
|
|
1043
|
+
if (props.selectedTabId === tabId)
|
|
1044
|
+
return;
|
|
1045
|
+
context.emit("tab:update", { tabId });
|
|
1046
|
+
}
|
|
1047
|
+
return {
|
|
1048
|
+
handleTabClick
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
const _hoisted_1$2 = { class: "tab-list" };
|
|
1053
|
+
const _hoisted_2$1 = ["onClick"];
|
|
1054
|
+
const _hoisted_3$1 = { key: 0 };
|
|
1055
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1056
|
+
return openBlock(), createElementBlock("ul", _hoisted_1$2, [
|
|
1057
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabList, (tab) => {
|
|
1058
|
+
return openBlock(), createElementBlock("li", {
|
|
1059
|
+
key: tab.id,
|
|
1060
|
+
class: normalizeClass([
|
|
1061
|
+
"tab",
|
|
1062
|
+
{ active: _ctx.selectedTabId === tab.id, invalid: tab.hasErrors }
|
|
1063
|
+
])
|
|
1064
|
+
}, [
|
|
1065
|
+
createElementVNode("button", {
|
|
1066
|
+
class: "tab-button",
|
|
1067
|
+
type: "button",
|
|
1068
|
+
onClick: ($event) => _ctx.handleTabClick(tab.id)
|
|
1069
|
+
}, [
|
|
1070
|
+
createTextVNode(toDisplayString(tab.label) + " ", 1),
|
|
1071
|
+
tab.hasErrors ? (openBlock(), createElementBlock("span", _hoisted_3$1, "*")) : createCommentVNode("", true)
|
|
1072
|
+
], 8, _hoisted_2$1)
|
|
1073
|
+
], 2);
|
|
1074
|
+
}), 128))
|
|
1075
|
+
]);
|
|
1076
|
+
}
|
|
1077
|
+
var TabList = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-6a295e80"]]);
|
|
1078
|
+
var PostForm_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
1079
|
+
const _sfc_main$2 = defineComponent({
|
|
1080
|
+
name: "BlogPostForm",
|
|
1081
|
+
components: {
|
|
1082
|
+
SeoFieldGroup,
|
|
1083
|
+
FormFieldMultiSelect,
|
|
1084
|
+
FormFieldFileInput,
|
|
1085
|
+
FormFieldRichTextInput,
|
|
1086
|
+
FormFieldCheckbox,
|
|
1087
|
+
FormFieldUrlAliasInput,
|
|
1088
|
+
FormField,
|
|
1089
|
+
FormFieldSelect,
|
|
1090
|
+
TabList,
|
|
1091
|
+
Page,
|
|
1092
|
+
DynamicField,
|
|
1093
|
+
ShortCodeConstructor,
|
|
1094
|
+
FormFooter
|
|
1095
|
+
},
|
|
1096
|
+
setup() {
|
|
1097
|
+
var _a, _b;
|
|
1098
|
+
const route = useRoute();
|
|
1099
|
+
const router = useRouter();
|
|
1100
|
+
const toast = useToast();
|
|
1101
|
+
const { t } = useI18n();
|
|
1102
|
+
const postId = computed(() => route.params.postId);
|
|
1103
|
+
const isCreation = computed(() => postId.value === "create");
|
|
1104
|
+
const urlAliasChanged = ref(false);
|
|
1105
|
+
const statusOptions = computed(() => getStatusOptions(t));
|
|
1106
|
+
const { data: moduleConfig, loading: isModuleConfigLoading } = useFetchModuleConfig();
|
|
1107
|
+
const languageList = computed(
|
|
1108
|
+
() => {
|
|
1109
|
+
var _a2, _b2;
|
|
1110
|
+
return (_b2 = (_a2 = moduleConfig.value) == null ? void 0 : _a2.languages) != null ? _b2 : [];
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
const languageOptionList = computed(
|
|
1114
|
+
() => languageList.value.map(({ id, name }) => ({
|
|
1115
|
+
value: id,
|
|
1116
|
+
label: name
|
|
1117
|
+
}))
|
|
1118
|
+
);
|
|
1119
|
+
const isLangSpecific = computed(() => languageOptionList.value.length > 0);
|
|
1120
|
+
const { data: categoryList, loading: isCategoryListLoading } = useFetchCategories();
|
|
1121
|
+
const [fetchPost, { data: post, loading: isPostLoading }] = useResource({
|
|
1122
|
+
fetchResource: () => postId.value ? getPost(postId.value) : new Promise(() => null),
|
|
1123
|
+
initialValue: null,
|
|
1124
|
+
resourceName: "Post"
|
|
1125
|
+
});
|
|
1126
|
+
onMounted(() => {
|
|
1127
|
+
if (isCreation.value)
|
|
1128
|
+
return;
|
|
1129
|
+
fetchPost();
|
|
1130
|
+
});
|
|
1131
|
+
watch(postId, () => {
|
|
1132
|
+
if (isCreation.value)
|
|
1133
|
+
return;
|
|
1134
|
+
fetchPost();
|
|
1135
|
+
});
|
|
1136
|
+
const { data: postList, loading: isPostListLoading } = useFetchPosts();
|
|
1137
|
+
const postOptionList = computed(
|
|
1138
|
+
() => postList.value.filter((relatedPost) => {
|
|
1139
|
+
var _a2;
|
|
1140
|
+
return relatedPost.id !== ((_a2 = post.value) == null ? void 0 : _a2.id);
|
|
1141
|
+
}).map((post2) => ({
|
|
1142
|
+
value: post2.id,
|
|
1143
|
+
label: post2.title
|
|
1144
|
+
}))
|
|
1145
|
+
);
|
|
1146
|
+
const isSubmitting = ref(false);
|
|
1147
|
+
const values = ref(
|
|
1148
|
+
convertPostToFormValues(
|
|
1149
|
+
post.value,
|
|
1150
|
+
languageOptionList.value,
|
|
1151
|
+
postOptionList.value,
|
|
1152
|
+
(_b = (_a = moduleConfig.value) == null ? void 0 : _a.fields) != null ? _b : [],
|
|
1153
|
+
statusOptions.value
|
|
1154
|
+
)
|
|
1155
|
+
);
|
|
1156
|
+
const errors = ref({});
|
|
1157
|
+
watch([post, languageOptionList, postOptionList, moduleConfig], () => {
|
|
1158
|
+
var _a2, _b2;
|
|
1159
|
+
values.value = convertPostToFormValues(
|
|
1160
|
+
post.value,
|
|
1161
|
+
languageOptionList.value,
|
|
1162
|
+
postOptionList.value,
|
|
1163
|
+
(_b2 = (_a2 = moduleConfig.value) == null ? void 0 : _a2.fields) != null ? _b2 : [],
|
|
1164
|
+
statusOptions.value
|
|
1165
|
+
);
|
|
1166
|
+
});
|
|
1167
|
+
function submitForm(event) {
|
|
1168
|
+
isSubmitting.value = true;
|
|
1169
|
+
const creationBody = convertFormValuesToCreationPayload(values.value);
|
|
1170
|
+
const updateBody = convertFormValuesToUpdatePayload(values.value);
|
|
1171
|
+
const requestPromise = isCreation.value ? createBlogPost(creationBody) : updateBlogPost(postId.value, updateBody);
|
|
1172
|
+
requestPromise.then(({ data }) => {
|
|
1173
|
+
var _a2, _b2;
|
|
1174
|
+
errors.value = {};
|
|
1175
|
+
if (event.type === "create") {
|
|
1176
|
+
router.push(getBlogPostFormUrl({ postId: String(data.id) }));
|
|
1177
|
+
}
|
|
1178
|
+
if (event.type === "create_exit" || event.type === "save_exit") {
|
|
1179
|
+
navigateBack(router, getBlogPostListUrl());
|
|
1180
|
+
}
|
|
1181
|
+
if (event.type === "create_create-another") {
|
|
1182
|
+
values.value = convertPostToFormValues(
|
|
1183
|
+
null,
|
|
1184
|
+
languageOptionList.value,
|
|
1185
|
+
postOptionList.value,
|
|
1186
|
+
(_b2 = (_a2 = moduleConfig.value) == null ? void 0 : _a2.fields) != null ? _b2 : [],
|
|
1187
|
+
statusOptions.value
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
toast.show({
|
|
1191
|
+
variant: "success",
|
|
1192
|
+
title: t("blog:success"),
|
|
1193
|
+
body: isCreation.value ? t("blog:blogPostWasSuccessfullyCreated") : t("blog:blogPostWasSuccessfullyUpdated")
|
|
1194
|
+
});
|
|
1195
|
+
}).catch((error) => {
|
|
1196
|
+
console.error(error);
|
|
1197
|
+
errors.value = convertRequestErrorToMap(error);
|
|
1198
|
+
toast.show({
|
|
1199
|
+
variant: "danger",
|
|
1200
|
+
title: t("blog:error"),
|
|
1201
|
+
body: isCreation.value ? t("blog:blogPostCreationWasFailed") : t("blog:blogPostUpdateWasFailed")
|
|
1202
|
+
});
|
|
1203
|
+
}).finally(() => {
|
|
1204
|
+
isSubmitting.value = false;
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
const categoryOptionList = computed(
|
|
1208
|
+
() => {
|
|
1209
|
+
var _a2, _b2;
|
|
1210
|
+
return convertCategoryListToOptions$1(
|
|
1211
|
+
categoryList.value,
|
|
1212
|
+
(_b2 = (_a2 = values.value.language) == null ? void 0 : _a2.value) != null ? _b2 : null
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
);
|
|
1216
|
+
watch([categoryOptionList, moduleConfig], () => {
|
|
1217
|
+
var _a2;
|
|
1218
|
+
function isOptionExist(selectedCategoryOption) {
|
|
1219
|
+
return categoryOptionList.value.some(
|
|
1220
|
+
(option) => option.value === selectedCategoryOption.value
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
if (isCreation.value) {
|
|
1224
|
+
if ((_a2 = moduleConfig == null ? void 0 : moduleConfig.value) == null ? void 0 : _a2.defaultCategories) {
|
|
1225
|
+
const defaultIds = moduleConfig.value.defaultCategories.map(
|
|
1226
|
+
(item) => item.id
|
|
1227
|
+
);
|
|
1228
|
+
values.value.categories = categoryOptionList.value.filter(
|
|
1229
|
+
(item) => {
|
|
1230
|
+
return defaultIds.indexOf(item.value) !== -1;
|
|
1231
|
+
}
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
values.value.categories = values.value.categories.filter(isOptionExist);
|
|
1236
|
+
});
|
|
1237
|
+
const isContentLoading = computed(
|
|
1238
|
+
() => isPostLoading.value || isCategoryListLoading.value || isPostListLoading.value || isModuleConfigLoading.value
|
|
1239
|
+
);
|
|
1240
|
+
function getUploadAdapterOptions() {
|
|
1241
|
+
var _a2;
|
|
1242
|
+
return { uploadScenario: (_a2 = moduleConfig.value) == null ? void 0 : _a2.fileScenarios.content };
|
|
1243
|
+
}
|
|
1244
|
+
const blogPagePath = computed(() => {
|
|
1245
|
+
var _a2, _b2;
|
|
1246
|
+
const origin = {}.VUE_APP_WEBSITE_URL || window.location.origin;
|
|
1247
|
+
return origin + ((_b2 = (_a2 = post.value) == null ? void 0 : _a2.urlTemplate) != null ? _b2 : "");
|
|
1248
|
+
});
|
|
1249
|
+
const tabList = computed(() => {
|
|
1250
|
+
const hasErrors = createTabErrorFinder(errors.value);
|
|
1251
|
+
return [
|
|
1252
|
+
{
|
|
1253
|
+
id: "common",
|
|
1254
|
+
label: t("blog:common"),
|
|
1255
|
+
hasErrors: hasErrors([
|
|
1256
|
+
"title",
|
|
1257
|
+
"language",
|
|
1258
|
+
"urlAlias",
|
|
1259
|
+
"excerpt",
|
|
1260
|
+
"body",
|
|
1261
|
+
"date"
|
|
1262
|
+
])
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
id: "images",
|
|
1266
|
+
label: t("blog:images"),
|
|
1267
|
+
hasErrors: hasErrors(["coverImage", "image"])
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
id: "relations",
|
|
1271
|
+
label: t("blog:relations"),
|
|
1272
|
+
hasErrors: hasErrors(["categories", "relatedPosts", "tags"])
|
|
1273
|
+
},
|
|
1274
|
+
values.value.additionalFields.length > 0 ? {
|
|
1275
|
+
id: "additional",
|
|
1276
|
+
label: t("blog:additionalFields"),
|
|
1277
|
+
hasErrors: hasErrors([])
|
|
1278
|
+
} : null,
|
|
1279
|
+
{
|
|
1280
|
+
id: "seo",
|
|
1281
|
+
label: "SEO",
|
|
1282
|
+
hasErrors: hasErrors([
|
|
1283
|
+
"pageTitle",
|
|
1284
|
+
"pageDescription",
|
|
1285
|
+
"openGraphImage"
|
|
1286
|
+
])
|
|
1287
|
+
}
|
|
1288
|
+
].filter(isNotNullish);
|
|
1289
|
+
});
|
|
1290
|
+
const selectedTabId = ref(tabList.value[0].id);
|
|
1291
|
+
const headerButtonList = computed(
|
|
1292
|
+
() => [
|
|
1293
|
+
post.value ? {
|
|
1294
|
+
text: t("blog:viewPost"),
|
|
1295
|
+
href: {}.VUE_APP_WEBSITE_URL + post.value.url,
|
|
1296
|
+
target: "_blank"
|
|
1297
|
+
} : null
|
|
1298
|
+
].filter(isNotNullish)
|
|
1299
|
+
);
|
|
1300
|
+
function handleSeoFieldGroupChange({
|
|
1301
|
+
title,
|
|
1302
|
+
description,
|
|
1303
|
+
image
|
|
1304
|
+
}) {
|
|
1305
|
+
values.value.pageTitle = title;
|
|
1306
|
+
values.value.pageDescription = description;
|
|
1307
|
+
values.value.openGraphImage = image;
|
|
1308
|
+
}
|
|
1309
|
+
function handleTitleChange(value) {
|
|
1310
|
+
if (isCreation.value && urlAliasChanged.value === false) {
|
|
1311
|
+
values.value.urlAlias = urlTranslit(value);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
function handleAliasChange() {
|
|
1315
|
+
urlAliasChanged.value = true;
|
|
1316
|
+
}
|
|
1317
|
+
const urlAliasTemplate = computed(() => {
|
|
1318
|
+
if (!moduleConfig.value || !moduleConfig.value.urlPostTemplate) {
|
|
1319
|
+
return "";
|
|
1320
|
+
}
|
|
1321
|
+
let result = moduleConfig.value.urlPostTemplate;
|
|
1322
|
+
if (values.value.language) {
|
|
1323
|
+
result = result.replace("{language}", values.value.language.value);
|
|
1324
|
+
}
|
|
1325
|
+
if (postId.value !== "create") {
|
|
1326
|
+
result = result.replace("{id}", postId.value);
|
|
1327
|
+
}
|
|
1328
|
+
return result;
|
|
1329
|
+
});
|
|
1330
|
+
const handleCategoriesChange = (selectedOptions) => {
|
|
1331
|
+
const newSelectedOptions = [];
|
|
1332
|
+
selectedOptions.forEach((selectedOption) => {
|
|
1333
|
+
const findTreeSelectedCategory = (categoryId) => {
|
|
1334
|
+
const foundSelectedCategory = categoryList.value.find(
|
|
1335
|
+
({ id }) => id === categoryId
|
|
1336
|
+
);
|
|
1337
|
+
if (!foundSelectedCategory) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
const newSelectedOption = {
|
|
1341
|
+
value: foundSelectedCategory.id,
|
|
1342
|
+
label: foundSelectedCategory.name
|
|
1343
|
+
};
|
|
1344
|
+
if (!newSelectedOptions.some(
|
|
1345
|
+
({ value }) => value === newSelectedOption.value
|
|
1346
|
+
)) {
|
|
1347
|
+
newSelectedOptions.push(newSelectedOption);
|
|
1348
|
+
}
|
|
1349
|
+
if (foundSelectedCategory.parent) {
|
|
1350
|
+
findTreeSelectedCategory(foundSelectedCategory.parent.id);
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
findTreeSelectedCategory(selectedOption.value);
|
|
1354
|
+
});
|
|
1355
|
+
values.value.categories = newSelectedOptions;
|
|
1356
|
+
};
|
|
1357
|
+
return {
|
|
1358
|
+
isCreation,
|
|
1359
|
+
postId,
|
|
1360
|
+
pagePath: blogPagePath,
|
|
1361
|
+
categoryOptionList,
|
|
1362
|
+
values,
|
|
1363
|
+
errors,
|
|
1364
|
+
isContentLoading,
|
|
1365
|
+
postListUrl: getBlogPostListUrl(),
|
|
1366
|
+
submitForm,
|
|
1367
|
+
isLangSpecific,
|
|
1368
|
+
languageOptionList,
|
|
1369
|
+
isSubmitting,
|
|
1370
|
+
moduleConfig,
|
|
1371
|
+
postOptionList,
|
|
1372
|
+
getUploadAdapterOptions,
|
|
1373
|
+
tabList,
|
|
1374
|
+
selectedTabId,
|
|
1375
|
+
headerButtonList,
|
|
1376
|
+
handleSeoFieldGroupChange,
|
|
1377
|
+
handleTitleChange,
|
|
1378
|
+
handleAliasChange,
|
|
1379
|
+
urlAliasTemplate,
|
|
1380
|
+
handleCategoriesChange,
|
|
1381
|
+
statusOptions
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
const _hoisted_1$1 = { class: "status" };
|
|
1386
|
+
const _hoisted_2 = { class: "status-value" };
|
|
1387
|
+
const _hoisted_3 = {
|
|
1388
|
+
key: 0,
|
|
1389
|
+
class: "status-checkbox"
|
|
1390
|
+
};
|
|
1391
|
+
const _hoisted_4 = {
|
|
1392
|
+
key: 1,
|
|
1393
|
+
class: "status-date"
|
|
1394
|
+
};
|
|
1395
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1396
|
+
const _component_TabList = resolveComponent("TabList");
|
|
1397
|
+
const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
|
|
1398
|
+
const _component_FormField = resolveComponent("FormField");
|
|
1399
|
+
const _component_FormFieldUrlAliasInput = resolveComponent("FormFieldUrlAliasInput");
|
|
1400
|
+
const _component_FormFieldCheckbox = resolveComponent("FormFieldCheckbox");
|
|
1401
|
+
const _component_FormFieldRichTextInput = resolveComponent("FormFieldRichTextInput");
|
|
1402
|
+
const _component_ShortCodeConstructor = resolveComponent("ShortCodeConstructor");
|
|
1403
|
+
const _component_FormFieldFileInput = resolveComponent("FormFieldFileInput");
|
|
1404
|
+
const _component_FormFieldMultiSelect = resolveComponent("FormFieldMultiSelect");
|
|
1405
|
+
const _component_DynamicField = resolveComponent("DynamicField");
|
|
1406
|
+
const _component_SeoFieldGroup = resolveComponent("SeoFieldGroup");
|
|
1407
|
+
const _component_FormFooter = resolveComponent("FormFooter");
|
|
1408
|
+
const _component_Page = resolveComponent("Page");
|
|
1409
|
+
return openBlock(), createBlock(_component_Page, {
|
|
1410
|
+
title: _ctx.isCreation ? _ctx.$i18n.t("blog:createPost") : _ctx.$i18n.t("blog:updatePost"),
|
|
1411
|
+
"is-content-loading": _ctx.isContentLoading,
|
|
1412
|
+
"header-buttons": _ctx.headerButtonList,
|
|
1413
|
+
footer: {
|
|
1414
|
+
backHref: _ctx.postListUrl,
|
|
1415
|
+
onSubmit: _ctx.submitForm,
|
|
1416
|
+
isSubmitting: _ctx.isSubmitting
|
|
1417
|
+
}
|
|
1418
|
+
}, {
|
|
1419
|
+
content: withCtx(() => [
|
|
1420
|
+
createElementVNode("form", {
|
|
1421
|
+
novalidate: "",
|
|
1422
|
+
onSubmit: _cache[16] || (_cache[16] = withModifiers((...args) => _ctx.submitForm && _ctx.submitForm(...args), ["prevent"]))
|
|
1423
|
+
}, [
|
|
1424
|
+
createVNode(_component_TabList, {
|
|
1425
|
+
"tab-list": _ctx.tabList,
|
|
1426
|
+
"selected-tab-id": _ctx.selectedTabId,
|
|
1427
|
+
"onTab:update": _cache[0] || (_cache[0] = ($event) => _ctx.selectedTabId = $event.tabId)
|
|
1428
|
+
}, null, 8, ["tab-list", "selected-tab-id"]),
|
|
1429
|
+
_ctx.selectedTabId === "common" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1430
|
+
_ctx.isCreation && _ctx.isLangSpecific ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
1431
|
+
key: 0,
|
|
1432
|
+
value: _ctx.values.language,
|
|
1433
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.language = $event),
|
|
1434
|
+
name: "language",
|
|
1435
|
+
label: _ctx.$i18n.t("blog:language"),
|
|
1436
|
+
options: _ctx.languageOptionList,
|
|
1437
|
+
error: _ctx.errors.language
|
|
1438
|
+
}, null, 8, ["value", "label", "options", "error"])) : createCommentVNode("", true),
|
|
1439
|
+
createVNode(_component_FormField, {
|
|
1440
|
+
value: _ctx.values.title,
|
|
1441
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.title = $event),
|
|
1442
|
+
name: "title",
|
|
1443
|
+
label: _ctx.$i18n.t("blog:title"),
|
|
1444
|
+
error: _ctx.errors.title,
|
|
1445
|
+
onInput: _ctx.handleTitleChange
|
|
1446
|
+
}, null, 8, ["value", "label", "error", "onInput"]),
|
|
1447
|
+
createVNode(_component_FormFieldUrlAliasInput, {
|
|
1448
|
+
id: "urlAlias",
|
|
1449
|
+
value: _ctx.values.urlAlias,
|
|
1450
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.urlAlias = $event),
|
|
1451
|
+
name: "urlAlias",
|
|
1452
|
+
label: _ctx.$i18n.t("blog:link"),
|
|
1453
|
+
"url-template": _ctx.urlAliasTemplate,
|
|
1454
|
+
error: _ctx.errors.urlAlias,
|
|
1455
|
+
onChange: _ctx.handleAliasChange
|
|
1456
|
+
}, null, 8, ["value", "label", "url-template", "error", "onChange"]),
|
|
1457
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
1458
|
+
createElementVNode("div", _hoisted_2, [
|
|
1459
|
+
createVNode(_component_FormFieldSelect, {
|
|
1460
|
+
value: _ctx.values.status,
|
|
1461
|
+
"onUpdate:value": _cache[4] || (_cache[4] = ($event) => _ctx.values.status = $event),
|
|
1462
|
+
name: "status",
|
|
1463
|
+
error: _ctx.errors.status,
|
|
1464
|
+
label: _ctx.$i18n.t("blog:status"),
|
|
1465
|
+
"no-options-message": _ctx.$i18n.t("blog:noTemplates"),
|
|
1466
|
+
options: _ctx.statusOptions
|
|
1467
|
+
}, null, 8, ["value", "error", "label", "no-options-message", "options"])
|
|
1468
|
+
]),
|
|
1469
|
+
_ctx.values.status.value === "PUBLISHED" || _ctx.values.status.value === "DRAFT" ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
1470
|
+
createVNode(_component_FormFieldCheckbox, {
|
|
1471
|
+
checked: _ctx.values.statusDateEnabled,
|
|
1472
|
+
"onUpdate:checked": _cache[5] || (_cache[5] = ($event) => _ctx.values.statusDateEnabled = $event),
|
|
1473
|
+
name: "statusDateEnabled",
|
|
1474
|
+
label: _ctx.$i18n.t(
|
|
1475
|
+
_ctx.values.status.value === "PUBLISHED" ? "blog:scheduleArchive" : "blog:schedulePublish"
|
|
1476
|
+
),
|
|
1477
|
+
error: _ctx.errors.status
|
|
1478
|
+
}, null, 8, ["checked", "label", "error"])
|
|
1479
|
+
])) : createCommentVNode("", true),
|
|
1480
|
+
_ctx.values.statusDateEnabled && (_ctx.values.status.value === "PUBLISHED" || _ctx.values.status.value === "DRAFT") ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
1481
|
+
createVNode(_component_FormField, {
|
|
1482
|
+
value: _ctx.values.statusDate,
|
|
1483
|
+
"onUpdate:value": _cache[6] || (_cache[6] = ($event) => _ctx.values.statusDate = $event),
|
|
1484
|
+
name: "statusDate",
|
|
1485
|
+
type: "date",
|
|
1486
|
+
label: _ctx.$i18n.t(
|
|
1487
|
+
_ctx.values.status.value === "PUBLISHED" ? "blog:archiveAt" : "blog:publishAt"
|
|
1488
|
+
),
|
|
1489
|
+
error: _ctx.errors.statusDate
|
|
1490
|
+
}, null, 8, ["value", "label", "error"])
|
|
1491
|
+
])) : createCommentVNode("", true)
|
|
1492
|
+
]),
|
|
1493
|
+
createVNode(_component_FormField, {
|
|
1494
|
+
value: _ctx.values.datetime,
|
|
1495
|
+
"onUpdate:value": _cache[7] || (_cache[7] = ($event) => _ctx.values.datetime = $event),
|
|
1496
|
+
name: "datetime",
|
|
1497
|
+
label: _ctx.$i18n.t("blog:date"),
|
|
1498
|
+
type: "date",
|
|
1499
|
+
error: _ctx.errors.datetime
|
|
1500
|
+
}, null, 8, ["value", "label", "error"]),
|
|
1501
|
+
createVNode(_component_FormField, {
|
|
1502
|
+
value: _ctx.values.excerpt,
|
|
1503
|
+
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => _ctx.values.excerpt = $event),
|
|
1504
|
+
name: "excerpt",
|
|
1505
|
+
label: _ctx.$i18n.t("blog:excerpt"),
|
|
1506
|
+
type: "textarea",
|
|
1507
|
+
error: _ctx.errors.excerpt
|
|
1508
|
+
}, null, 8, ["value", "label", "error"]),
|
|
1509
|
+
createVNode(_component_FormFieldRichTextInput, {
|
|
1510
|
+
value: _ctx.values.body,
|
|
1511
|
+
"onUpdate:value": _cache[9] || (_cache[9] = ($event) => _ctx.values.body = $event),
|
|
1512
|
+
name: "body",
|
|
1513
|
+
label: _ctx.$i18n.t("blog:body"),
|
|
1514
|
+
error: _ctx.errors.body,
|
|
1515
|
+
"get-upload-adapter-options": _ctx.getUploadAdapterOptions
|
|
1516
|
+
}, null, 8, ["value", "label", "error", "get-upload-adapter-options"]),
|
|
1517
|
+
createVNode(_component_ShortCodeConstructor, {
|
|
1518
|
+
"short-code-config-list": _ctx.moduleConfig ? _ctx.moduleConfig.shortcodes : []
|
|
1519
|
+
}, null, 8, ["short-code-config-list"])
|
|
1520
|
+
], 64)) : createCommentVNode("", true),
|
|
1521
|
+
_ctx.selectedTabId === "images" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1522
|
+
createVNode(_component_FormFieldFileInput, {
|
|
1523
|
+
value: _ctx.values.coverImage,
|
|
1524
|
+
"onUpdate:value": _cache[10] || (_cache[10] = ($event) => _ctx.values.coverImage = $event),
|
|
1525
|
+
label: _ctx.$i18n.t("blog:coverImage"),
|
|
1526
|
+
name: "coverImage",
|
|
1527
|
+
"file-type": "image",
|
|
1528
|
+
scenario: _ctx.moduleConfig ? _ctx.moduleConfig.fileScenarios.cover : null
|
|
1529
|
+
}, null, 8, ["value", "label", "scenario"]),
|
|
1530
|
+
createVNode(_component_FormFieldFileInput, {
|
|
1531
|
+
value: _ctx.values.image,
|
|
1532
|
+
"onUpdate:value": _cache[11] || (_cache[11] = ($event) => _ctx.values.image = $event),
|
|
1533
|
+
name: "image",
|
|
1534
|
+
label: _ctx.$i18n.t("blog:innerImage"),
|
|
1535
|
+
"file-type": "image",
|
|
1536
|
+
scenario: _ctx.moduleConfig ? _ctx.moduleConfig.fileScenarios.image : null
|
|
1537
|
+
}, null, 8, ["value", "label", "scenario"]),
|
|
1538
|
+
createVNode(_component_FormFieldFileInput, {
|
|
1539
|
+
value: _ctx.values.imageMobile,
|
|
1540
|
+
"onUpdate:value": _cache[12] || (_cache[12] = ($event) => _ctx.values.imageMobile = $event),
|
|
1541
|
+
name: "imageMobile",
|
|
1542
|
+
label: _ctx.$i18n.t("blog:innerImageMobile"),
|
|
1543
|
+
"file-type": "image",
|
|
1544
|
+
scenario: _ctx.moduleConfig ? _ctx.moduleConfig.fileScenarios.imageMobile : null
|
|
1545
|
+
}, null, 8, ["value", "label", "scenario"])
|
|
1546
|
+
], 64)) : createCommentVNode("", true),
|
|
1547
|
+
_ctx.selectedTabId === "relations" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
1548
|
+
createVNode(_component_FormField, {
|
|
1549
|
+
value: _ctx.values.tags,
|
|
1550
|
+
"onUpdate:value": _cache[13] || (_cache[13] = ($event) => _ctx.values.tags = $event),
|
|
1551
|
+
name: "tags",
|
|
1552
|
+
label: _ctx.$i18n.t("blog:tags"),
|
|
1553
|
+
error: _ctx.errors.tags
|
|
1554
|
+
}, null, 8, ["value", "label", "error"]),
|
|
1555
|
+
createVNode(_component_FormFieldMultiSelect, {
|
|
1556
|
+
"selected-options": _ctx.values.categories,
|
|
1557
|
+
"onUpdate:selected-options": _cache[14] || (_cache[14] = ($event) => _ctx.values.categories = $event),
|
|
1558
|
+
name: "categories",
|
|
1559
|
+
label: _ctx.$i18n.t("blog:categories"),
|
|
1560
|
+
options: _ctx.categoryOptionList,
|
|
1561
|
+
error: _ctx.errors.categories,
|
|
1562
|
+
onChange: _ctx.handleCategoriesChange
|
|
1563
|
+
}, null, 8, ["selected-options", "label", "options", "error", "onChange"]),
|
|
1564
|
+
createVNode(_component_FormFieldMultiSelect, {
|
|
1565
|
+
"selected-options": _ctx.values.relatedPosts,
|
|
1566
|
+
"onUpdate:selected-options": _cache[15] || (_cache[15] = ($event) => _ctx.values.relatedPosts = $event),
|
|
1567
|
+
name: "relatedPosts",
|
|
1568
|
+
label: _ctx.$i18n.t("blog:relatedPosts"),
|
|
1569
|
+
options: _ctx.postOptionList,
|
|
1570
|
+
error: _ctx.errors.relatedPosts,
|
|
1571
|
+
searchable: true
|
|
1572
|
+
}, null, 8, ["selected-options", "label", "options", "error"])
|
|
1573
|
+
], 64)) : createCommentVNode("", true),
|
|
1574
|
+
_ctx.selectedTabId === "additional" ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.values.additionalFields, (field) => {
|
|
1575
|
+
return openBlock(), createBlock(_component_DynamicField, {
|
|
1576
|
+
key: field.name,
|
|
1577
|
+
field
|
|
1578
|
+
}, null, 8, ["field"]);
|
|
1579
|
+
}), 128)) : createCommentVNode("", true),
|
|
1580
|
+
_ctx.selectedTabId === "seo" ? (openBlock(), createBlock(_component_SeoFieldGroup, {
|
|
1581
|
+
key: 4,
|
|
1582
|
+
title: _ctx.values.pageTitle,
|
|
1583
|
+
"title-error-message": _ctx.errors.pageTitle,
|
|
1584
|
+
"title-label": _ctx.$i18n.t("blog:pageTitle"),
|
|
1585
|
+
description: _ctx.values.pageDescription,
|
|
1586
|
+
"description-error-message": _ctx.errors.pageDescription,
|
|
1587
|
+
"description-label": _ctx.$i18n.t("blog:pageDescription"),
|
|
1588
|
+
image: _ctx.values.openGraphImage,
|
|
1589
|
+
"image-error-message": _ctx.errors.openGraphImage,
|
|
1590
|
+
"image-label": _ctx.$i18n.t("blog:openGraphImage"),
|
|
1591
|
+
"image-scenario": _ctx.moduleConfig ? _ctx.moduleConfig.fileScenarios.openGraph : null,
|
|
1592
|
+
onChange: _ctx.handleSeoFieldGroupChange
|
|
1593
|
+
}, null, 8, ["title", "title-error-message", "title-label", "description", "description-error-message", "description-label", "image", "image-error-message", "image-label", "image-scenario", "onChange"])) : createCommentVNode("", true)
|
|
1594
|
+
], 32)
|
|
1595
|
+
]),
|
|
1596
|
+
footer: withCtx(() => [
|
|
1597
|
+
createVNode(_component_FormFooter, {
|
|
1598
|
+
"back-href": _ctx.postListUrl,
|
|
1599
|
+
"is-submitting": _ctx.isSubmitting,
|
|
1600
|
+
"is-creation": _ctx.isCreation,
|
|
1601
|
+
"can-create-another": _ctx.isCreation,
|
|
1602
|
+
onSubmit: _ctx.submitForm
|
|
1603
|
+
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
1604
|
+
]),
|
|
1605
|
+
_: 1
|
|
1606
|
+
}, 8, ["title", "is-content-loading", "header-buttons", "footer"]);
|
|
1607
|
+
}
|
|
1608
|
+
var BlogPostForm = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-f83e0146"]]);
|
|
1609
|
+
function convertCategoryList(categoryList, languages) {
|
|
1610
|
+
return categoryList.map((category) => {
|
|
1611
|
+
if (languages.length > 0) {
|
|
1612
|
+
const foundLanguage = languages.find(
|
|
1613
|
+
({ id }) => category.language === id
|
|
1614
|
+
);
|
|
1615
|
+
return {
|
|
1616
|
+
...category,
|
|
1617
|
+
language: foundLanguage ? foundLanguage.name : category.language
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
return category;
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
function getCategoryTableColumnDefs(moduleConfig, t) {
|
|
1624
|
+
const isLangSpecific = moduleConfig ? moduleConfig.languages.length > 0 : false;
|
|
1625
|
+
const COLUMN_DEFS = [
|
|
1626
|
+
{
|
|
1627
|
+
id: 1,
|
|
1628
|
+
name: t("blog:name"),
|
|
1629
|
+
field: "name",
|
|
1630
|
+
type: "name",
|
|
1631
|
+
format: ({ row }) => ({
|
|
1632
|
+
adminLink: {
|
|
1633
|
+
url: getBlogCategoryFormUrl({ categoryId: row.id }),
|
|
1634
|
+
text: getNameWithDepth(row.name, row.depth)
|
|
1635
|
+
},
|
|
1636
|
+
paramList: row.isDefault ? [{ name: t("blog:defaultCategory"), value: t("blog:yes") }] : []
|
|
1637
|
+
})
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
id: 2,
|
|
1641
|
+
name: t("blog:link"),
|
|
1642
|
+
field: "path",
|
|
1643
|
+
type: "link",
|
|
1644
|
+
format: ({ row }) => ({
|
|
1645
|
+
url: `${getWebsiteOrigin()}${row.url}`,
|
|
1646
|
+
text: row.url
|
|
1647
|
+
}),
|
|
1648
|
+
options: {
|
|
1649
|
+
shouldOpenNewTab: true
|
|
1650
|
+
}
|
|
1651
|
+
},
|
|
1652
|
+
isLangSpecific ? { id: 3, name: t("blog:language"), field: "language" } : null,
|
|
1653
|
+
{
|
|
1654
|
+
id: 4,
|
|
1655
|
+
name: t("blog:posts"),
|
|
1656
|
+
field: "linkToPosts",
|
|
1657
|
+
style: { whiteSpace: "nowrap", width: "130px" }
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
id: 5,
|
|
1661
|
+
name: t("blog:actions"),
|
|
1662
|
+
field: "actions",
|
|
1663
|
+
style: { whiteSpace: "nowrap", width: "170px" },
|
|
1664
|
+
headStyle: { whiteSpace: "nowrap", width: "170px" },
|
|
1665
|
+
class: "actions-cell"
|
|
1666
|
+
}
|
|
1667
|
+
];
|
|
1668
|
+
return COLUMN_DEFS.filter(notEmpty);
|
|
1669
|
+
}
|
|
1670
|
+
function getLinkToPostsByCategory(categoryId) {
|
|
1671
|
+
return `${getBlogPostListUrl()}?filter[category]=${categoryId}`;
|
|
1672
|
+
}
|
|
1673
|
+
function useAdvancedSearch({ languageList, route, t }) {
|
|
1674
|
+
const languageOptionList = computed(
|
|
1675
|
+
() => languageList.value.map(({ id, name }) => ({ value: id, label: name }))
|
|
1676
|
+
);
|
|
1677
|
+
const initialLanguageFilter = computed(() => {
|
|
1678
|
+
const queryValue = getFilterParamAsStringArray(
|
|
1679
|
+
route.query,
|
|
1680
|
+
"language"
|
|
1681
|
+
);
|
|
1682
|
+
return languageOptionList.value.filter(
|
|
1683
|
+
({ value }) => queryValue.some((selected) => selected === value)
|
|
1684
|
+
);
|
|
1685
|
+
});
|
|
1686
|
+
const languageFilter = ref(initialLanguageFilter.value);
|
|
1687
|
+
watch(initialLanguageFilter, () => {
|
|
1688
|
+
languageFilter.value = initialLanguageFilter.value;
|
|
1689
|
+
});
|
|
1690
|
+
const filterParams = computed(
|
|
1691
|
+
() => getFilterParams({
|
|
1692
|
+
["language"]: languageFilter.value.map(({ value }) => value)
|
|
1693
|
+
})
|
|
1694
|
+
);
|
|
1695
|
+
function tagRemovalHandler(event) {
|
|
1696
|
+
if (event.name === "language") {
|
|
1697
|
+
languageFilter.value = languageFilter.value.filter(
|
|
1698
|
+
({ value }) => value !== event.value
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
const tags = computed(() => [
|
|
1703
|
+
...languageFilter.value.map(({ value, label }) => ({
|
|
1704
|
+
value,
|
|
1705
|
+
label,
|
|
1706
|
+
name: "language",
|
|
1707
|
+
title: t("blog:language")
|
|
1708
|
+
}))
|
|
1709
|
+
]);
|
|
1710
|
+
return {
|
|
1711
|
+
languageFilter,
|
|
1712
|
+
languageOptionList,
|
|
1713
|
+
tagRemovalHandler,
|
|
1714
|
+
tags,
|
|
1715
|
+
filterParams
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
const _sfc_main$1 = defineComponent({
|
|
1719
|
+
name: "BlogCategoryList",
|
|
1720
|
+
components: {
|
|
1721
|
+
DeleteIcon,
|
|
1722
|
+
SouthIcon,
|
|
1723
|
+
NorthIcon,
|
|
1724
|
+
EditIcon,
|
|
1725
|
+
BaseButton,
|
|
1726
|
+
CountButton,
|
|
1727
|
+
FormFieldMultiSelect,
|
|
1728
|
+
AdvancedSearch,
|
|
1729
|
+
Page,
|
|
1730
|
+
DataTable
|
|
1731
|
+
},
|
|
1732
|
+
setup() {
|
|
1733
|
+
const { t } = useI18n();
|
|
1734
|
+
const route = useRoute();
|
|
1735
|
+
const router = useRouter();
|
|
1736
|
+
const { data: moduleConfig, loading: isModuleConfigLoading } = useFetchModuleConfig();
|
|
1737
|
+
const languageList = computed(
|
|
1738
|
+
() => {
|
|
1739
|
+
var _a, _b;
|
|
1740
|
+
return (_b = (_a = moduleConfig.value) == null ? void 0 : _a.languages) != null ? _b : [];
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1743
|
+
const {
|
|
1744
|
+
languageFilter,
|
|
1745
|
+
languageOptionList,
|
|
1746
|
+
filterParams,
|
|
1747
|
+
tags,
|
|
1748
|
+
tagRemovalHandler
|
|
1749
|
+
} = useAdvancedSearch({ languageList, route, t });
|
|
1750
|
+
const isLangSpecific = computed(
|
|
1751
|
+
() => languageOptionList.value.length > 1
|
|
1752
|
+
);
|
|
1753
|
+
const {
|
|
1754
|
+
fetchEntityList: fetchCategoryList,
|
|
1755
|
+
isLoading: isCategoryListLoading,
|
|
1756
|
+
rowData: categoryList,
|
|
1757
|
+
errorMessage,
|
|
1758
|
+
searchQuery,
|
|
1759
|
+
handleChange,
|
|
1760
|
+
pageNumber,
|
|
1761
|
+
pageCount,
|
|
1762
|
+
pageSize
|
|
1763
|
+
} = useDataTable({
|
|
1764
|
+
fetchEntityList: (params) => getCategories({
|
|
1765
|
+
query: params.searchQuery,
|
|
1766
|
+
pageNumber: params.pageNumber,
|
|
1767
|
+
pageSize: params.pageSize,
|
|
1768
|
+
...filterParams.value
|
|
1769
|
+
}),
|
|
1770
|
+
initialValue: [],
|
|
1771
|
+
resourceName: "Blog categories",
|
|
1772
|
+
pageSize: 100
|
|
1773
|
+
});
|
|
1774
|
+
watch(filterParams, () => {
|
|
1775
|
+
var _a;
|
|
1776
|
+
if (isModuleConfigLoading.value || isCategoryListLoading.value) {
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
if (route.path !== BLOG_ROUTE_PATHS.CATEGORY_LIST) {
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
const newQuery = {
|
|
1783
|
+
...filterParams.value,
|
|
1784
|
+
query: (_a = route.query.query) != null ? _a : ""
|
|
1785
|
+
};
|
|
1786
|
+
if (!isEqual(route.query, newQuery)) {
|
|
1787
|
+
router.replace({ query: newQuery });
|
|
1788
|
+
fetchCategoryList();
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
const { isDeleting, handleResourceDelete: handleCategoryDelete } = useResourceDelete({
|
|
1792
|
+
deleteResource: deleteCategory,
|
|
1793
|
+
resourceName: "Post",
|
|
1794
|
+
onSuccess: fetchCategoryList
|
|
1795
|
+
});
|
|
1796
|
+
const isCategoryMoving = ref(false);
|
|
1797
|
+
function startMoveCategory(categoryId, direction) {
|
|
1798
|
+
isCategoryMoving.value = true;
|
|
1799
|
+
moveCategory(categoryId, direction).then((response) => {
|
|
1800
|
+
if (response.success) {
|
|
1801
|
+
return fetchCategoryList();
|
|
1802
|
+
}
|
|
1803
|
+
}).catch(console.error).finally(() => {
|
|
1804
|
+
isCategoryMoving.value = false;
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
const isRowDataLoading = computed(
|
|
1808
|
+
() => isCategoryListLoading.value || isModuleConfigLoading.value
|
|
1809
|
+
);
|
|
1810
|
+
const displayedCategoryList = computed(
|
|
1811
|
+
() => convertCategoryList(categoryList.value, languageList.value)
|
|
1812
|
+
);
|
|
1813
|
+
const columnDefs = computed(
|
|
1814
|
+
() => getCategoryTableColumnDefs(moduleConfig.value, t)
|
|
1815
|
+
);
|
|
1816
|
+
return {
|
|
1817
|
+
columnDefs,
|
|
1818
|
+
rowData: displayedCategoryList,
|
|
1819
|
+
isRowDataLoading,
|
|
1820
|
+
errorMessage,
|
|
1821
|
+
isLangSpecific,
|
|
1822
|
+
handleCategoryDelete,
|
|
1823
|
+
isDeleting,
|
|
1824
|
+
getBlogCategoryFormUrl,
|
|
1825
|
+
getLinkToPostsByCategory,
|
|
1826
|
+
startMoveCategory,
|
|
1827
|
+
isCategoryMoving,
|
|
1828
|
+
searchQuery,
|
|
1829
|
+
handleChange,
|
|
1830
|
+
pageNumber,
|
|
1831
|
+
pageCount,
|
|
1832
|
+
pageSize,
|
|
1833
|
+
languageFilter,
|
|
1834
|
+
languageOptionList,
|
|
1835
|
+
tags,
|
|
1836
|
+
tagRemovalHandler
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
const _hoisted_1 = { class: "filters" };
|
|
1841
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1842
|
+
const _component_FormFieldMultiSelect = resolveComponent("FormFieldMultiSelect");
|
|
1843
|
+
const _component_AdvancedSearch = resolveComponent("AdvancedSearch");
|
|
1844
|
+
const _component_CountButton = resolveComponent("CountButton");
|
|
1845
|
+
const _component_EditIcon = resolveComponent("EditIcon");
|
|
1846
|
+
const _component_BaseButton = resolveComponent("BaseButton");
|
|
1847
|
+
const _component_NorthIcon = resolveComponent("NorthIcon");
|
|
1848
|
+
const _component_SouthIcon = resolveComponent("SouthIcon");
|
|
1849
|
+
const _component_DeleteIcon = resolveComponent("DeleteIcon");
|
|
1850
|
+
const _component_DataTable = resolveComponent("DataTable");
|
|
1851
|
+
const _component_Page = resolveComponent("Page");
|
|
1852
|
+
return openBlock(), createBlock(_component_Page, {
|
|
1853
|
+
title: _ctx.$i18n.t("blog:blogCategories"),
|
|
1854
|
+
"header-buttons": [
|
|
1855
|
+
{
|
|
1856
|
+
text: _ctx.$i18n.t("blog:newCategory"),
|
|
1857
|
+
href: _ctx.getBlogCategoryFormUrl({ categoryId: "create" })
|
|
1858
|
+
}
|
|
1859
|
+
]
|
|
1860
|
+
}, {
|
|
1861
|
+
content: withCtx(() => [
|
|
1862
|
+
createVNode(_component_DataTable, {
|
|
1863
|
+
"column-defs": _ctx.columnDefs,
|
|
1864
|
+
"row-data": _ctx.rowData,
|
|
1865
|
+
loading: _ctx.isRowDataLoading,
|
|
1866
|
+
"error-message": _ctx.errorMessage,
|
|
1867
|
+
"search-query": _ctx.searchQuery,
|
|
1868
|
+
pagination: {
|
|
1869
|
+
pageNumber: _ctx.pageNumber,
|
|
1870
|
+
pageCount: _ctx.pageCount,
|
|
1871
|
+
pageSize: _ctx.pageSize,
|
|
1872
|
+
disabled: _ctx.isRowDataLoading
|
|
1873
|
+
},
|
|
1874
|
+
"data-table": "blog-category",
|
|
1875
|
+
onChange: _ctx.handleChange
|
|
1876
|
+
}, createSlots({
|
|
1877
|
+
"cell(link-to-posts)": withCtx(({ row }) => [
|
|
1878
|
+
createVNode(_component_CountButton, {
|
|
1879
|
+
href: _ctx.getLinkToPostsByCategory(row.id),
|
|
1880
|
+
variant: "outline-secondary",
|
|
1881
|
+
count: row.postsCount
|
|
1882
|
+
}, {
|
|
1883
|
+
default: withCtx(() => [
|
|
1884
|
+
createTextVNode(toDisplayString(_ctx.$i18n.t("blog:posts")), 1)
|
|
1885
|
+
]),
|
|
1886
|
+
_: 2
|
|
1887
|
+
}, 1032, ["href", "count"])
|
|
1888
|
+
]),
|
|
1889
|
+
"cell(actions)": withCtx(({ row, rowIndex }) => [
|
|
1890
|
+
createVNode(_component_BaseButton, {
|
|
1891
|
+
variant: "icon",
|
|
1892
|
+
title: _ctx.$i18n.t("blog:edit"),
|
|
1893
|
+
disabled: _ctx.isDeleting(row.id),
|
|
1894
|
+
href: _ctx.getBlogCategoryFormUrl({ categoryId: row.id })
|
|
1895
|
+
}, {
|
|
1896
|
+
default: withCtx(() => [
|
|
1897
|
+
createVNode(_component_EditIcon)
|
|
1898
|
+
]),
|
|
1899
|
+
_: 2
|
|
1900
|
+
}, 1032, ["title", "disabled", "href"]),
|
|
1901
|
+
createVNode(_component_BaseButton, {
|
|
1902
|
+
variant: "icon",
|
|
1903
|
+
title: _ctx.$i18n.t("blog:moveUp"),
|
|
1904
|
+
disabled: rowIndex === 0 || _ctx.isCategoryMoving,
|
|
1905
|
+
onClick: ($event) => _ctx.startMoveCategory(row.id, "up")
|
|
1906
|
+
}, {
|
|
1907
|
+
default: withCtx(() => [
|
|
1908
|
+
createVNode(_component_NorthIcon)
|
|
1909
|
+
]),
|
|
1910
|
+
_: 2
|
|
1911
|
+
}, 1032, ["title", "disabled", "onClick"]),
|
|
1912
|
+
createVNode(_component_BaseButton, {
|
|
1913
|
+
variant: "icon",
|
|
1914
|
+
title: _ctx.$i18n.t("blog:moveDown"),
|
|
1915
|
+
disabled: rowIndex === _ctx.rowData.length - 1 || _ctx.isCategoryMoving,
|
|
1916
|
+
onClick: ($event) => _ctx.startMoveCategory(row.id, "down")
|
|
1917
|
+
}, {
|
|
1918
|
+
default: withCtx(() => [
|
|
1919
|
+
createVNode(_component_SouthIcon)
|
|
1920
|
+
]),
|
|
1921
|
+
_: 2
|
|
1922
|
+
}, 1032, ["title", "disabled", "onClick"]),
|
|
1923
|
+
createVNode(_component_BaseButton, {
|
|
1924
|
+
variant: "icon",
|
|
1925
|
+
title: _ctx.$i18n.t("blog:remove"),
|
|
1926
|
+
disabled: _ctx.isDeleting(row.id) || row.postsCount > 0,
|
|
1927
|
+
onClick: ($event) => _ctx.handleCategoryDelete(row.id)
|
|
1928
|
+
}, {
|
|
1929
|
+
default: withCtx(() => [
|
|
1930
|
+
createVNode(_component_DeleteIcon)
|
|
1931
|
+
]),
|
|
1932
|
+
_: 2
|
|
1933
|
+
}, 1032, ["title", "disabled", "onClick"])
|
|
1934
|
+
]),
|
|
1935
|
+
_: 2
|
|
1936
|
+
}, [
|
|
1937
|
+
_ctx.isLangSpecific ? {
|
|
1938
|
+
name: "filters",
|
|
1939
|
+
fn: withCtx(() => [
|
|
1940
|
+
createVNode(_component_AdvancedSearch, {
|
|
1941
|
+
tags: _ctx.tags,
|
|
1942
|
+
"onClick:tag": _ctx.tagRemovalHandler
|
|
1943
|
+
}, {
|
|
1944
|
+
default: withCtx(() => [
|
|
1945
|
+
createElementVNode("div", _hoisted_1, [
|
|
1946
|
+
createVNode(_component_FormFieldMultiSelect, {
|
|
1947
|
+
values: _ctx.languageFilter,
|
|
1948
|
+
"onUpdate:values": _cache[0] || (_cache[0] = ($event) => _ctx.languageFilter = $event),
|
|
1949
|
+
options: _ctx.languageOptionList,
|
|
1950
|
+
name: "languageFilter",
|
|
1951
|
+
searchable: true,
|
|
1952
|
+
label: _ctx.$i18n.t("blog:language"),
|
|
1953
|
+
class: "filter"
|
|
1954
|
+
}, null, 8, ["values", "options", "label"])
|
|
1955
|
+
])
|
|
1956
|
+
]),
|
|
1957
|
+
_: 1
|
|
1958
|
+
}, 8, ["tags", "onClick:tag"])
|
|
1959
|
+
])
|
|
1960
|
+
} : void 0
|
|
1961
|
+
]), 1032, ["column-defs", "row-data", "loading", "error-message", "search-query", "pagination", "onChange"])
|
|
1962
|
+
]),
|
|
1963
|
+
_: 1
|
|
1964
|
+
}, 8, ["title", "header-buttons"]);
|
|
1965
|
+
}
|
|
1966
|
+
var BlogCategoryList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
1967
|
+
function convertCategoryToFormValues(category, languageOptionList, t) {
|
|
1968
|
+
var _a, _b, _c, _d, _e;
|
|
1969
|
+
const currentLangOption = languageOptionList.find(
|
|
1970
|
+
({ value }) => value === (category == null ? void 0 : category.language)
|
|
1971
|
+
);
|
|
1972
|
+
if (!category) {
|
|
1973
|
+
return {
|
|
1974
|
+
language: currentLangOption != null ? currentLangOption : null,
|
|
1975
|
+
name: "",
|
|
1976
|
+
parent: { value: null, label: t("blog:noParent") },
|
|
1977
|
+
urlAlias: "",
|
|
1978
|
+
isDefault: false,
|
|
1979
|
+
pageTitle: "",
|
|
1980
|
+
pageDescription: "",
|
|
1981
|
+
pageKeywords: "",
|
|
1982
|
+
openGraphTitle: "",
|
|
1983
|
+
openGraphDescription: "",
|
|
1984
|
+
openGraphImage: null
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
return {
|
|
1988
|
+
language: currentLangOption != null ? currentLangOption : null,
|
|
1989
|
+
isDefault: category.isDefault,
|
|
1990
|
+
name: category.name,
|
|
1991
|
+
parent: category.parent ? { value: category.parent.id, label: category.parent.name } : { value: null, label: t("blog:noParent") },
|
|
1992
|
+
urlAlias: category.urlAlias,
|
|
1993
|
+
pageTitle: (_a = category.pageTitle) != null ? _a : "",
|
|
1994
|
+
pageDescription: (_b = category.pageDescription) != null ? _b : "",
|
|
1995
|
+
pageKeywords: (_c = category.pageKeywords) != null ? _c : "",
|
|
1996
|
+
openGraphTitle: (_d = category.openGraphTitle) != null ? _d : "",
|
|
1997
|
+
openGraphDescription: (_e = category.openGraphDescription) != null ? _e : "",
|
|
1998
|
+
openGraphImage: category.openGraphImage ? { id: createId(), file: category.openGraphImage } : null
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
function convertCategoryFormValuesToPayload(values) {
|
|
2002
|
+
var _a, _b, _c, _d;
|
|
2003
|
+
return {
|
|
2004
|
+
language: (_b = (_a = values.language) == null ? void 0 : _a.value) != null ? _b : null,
|
|
2005
|
+
name: values.name,
|
|
2006
|
+
parent: values.parent.value,
|
|
2007
|
+
urlAlias: values.urlAlias,
|
|
2008
|
+
isDefault: values.isDefault,
|
|
2009
|
+
pageTitle: values.pageTitle,
|
|
2010
|
+
pageDescription: values.pageDescription,
|
|
2011
|
+
openGraphImage: (_d = (_c = values.openGraphImage) == null ? void 0 : _c.file.id) != null ? _d : null
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
function convertCategoryListToOptions(categoryList, languageId, t) {
|
|
2015
|
+
return [
|
|
2016
|
+
{ value: null, label: t("blog:noParent") },
|
|
2017
|
+
...categoryList.filter(({ language }) => languageId ? language === languageId : true).map(({ id, name, depth }) => ({
|
|
2018
|
+
value: id,
|
|
2019
|
+
label: getNameWithDepth(name, depth)
|
|
2020
|
+
}))
|
|
2021
|
+
];
|
|
2022
|
+
}
|
|
2023
|
+
const _sfc_main = defineComponent({
|
|
2024
|
+
name: "CategoryForm",
|
|
2025
|
+
components: {
|
|
2026
|
+
Page,
|
|
2027
|
+
SeoFieldGroup,
|
|
2028
|
+
FormFieldCheckbox,
|
|
2029
|
+
TabList,
|
|
2030
|
+
FormFieldUrlAliasInput,
|
|
2031
|
+
FormField,
|
|
2032
|
+
FormFieldSelect,
|
|
2033
|
+
FormFooter
|
|
2034
|
+
},
|
|
2035
|
+
setup() {
|
|
2036
|
+
const { t } = useI18n();
|
|
2037
|
+
const router = useRouter();
|
|
2038
|
+
const route = useRoute();
|
|
2039
|
+
const toast = useToast();
|
|
2040
|
+
const categoryId = computed(
|
|
2041
|
+
() => route.params.categoryId
|
|
2042
|
+
);
|
|
2043
|
+
const isCreation = computed(() => categoryId.value === "create");
|
|
2044
|
+
const { data: moduleConfig, loading: isModuleConfigLoading } = useFetchModuleConfig();
|
|
2045
|
+
const languageList = computed(
|
|
2046
|
+
() => {
|
|
2047
|
+
var _a, _b;
|
|
2048
|
+
return (_b = (_a = moduleConfig.value) == null ? void 0 : _a.languages) != null ? _b : [];
|
|
2049
|
+
}
|
|
2050
|
+
);
|
|
2051
|
+
const languageOptionList = computed(
|
|
2052
|
+
() => languageList.value.map(({ id, name }) => ({ value: id, label: name }))
|
|
2053
|
+
);
|
|
2054
|
+
const isLangSpecific = computed(
|
|
2055
|
+
() => languageOptionList.value.length > 0
|
|
2056
|
+
);
|
|
2057
|
+
const imageScenario = computed(
|
|
2058
|
+
() => {
|
|
2059
|
+
var _a, _b, _c;
|
|
2060
|
+
return (_c = (_b = (_a = moduleConfig.value) == null ? void 0 : _a.fileScenarios) == null ? void 0 : _b.openGraph) != null ? _c : null;
|
|
2061
|
+
}
|
|
2062
|
+
);
|
|
2063
|
+
const { data: categories, loading: isCategoriesLoading } = useFetchCategories();
|
|
2064
|
+
const { data: category, loading: isCategoryLoading } = useFetchCategory({
|
|
2065
|
+
categoryId,
|
|
2066
|
+
isCreation
|
|
2067
|
+
});
|
|
2068
|
+
const isSubmitting = ref(false);
|
|
2069
|
+
const values = ref(
|
|
2070
|
+
convertCategoryToFormValues(category.value, languageOptionList.value, t)
|
|
2071
|
+
);
|
|
2072
|
+
const errors = ref({});
|
|
2073
|
+
watch([category, languageOptionList], () => {
|
|
2074
|
+
values.value = convertCategoryToFormValues(
|
|
2075
|
+
category.value,
|
|
2076
|
+
languageOptionList.value,
|
|
2077
|
+
t
|
|
2078
|
+
);
|
|
2079
|
+
});
|
|
2080
|
+
function submitForm(event) {
|
|
2081
|
+
isSubmitting.value = true;
|
|
2082
|
+
const body = convertCategoryFormValuesToPayload(values.value);
|
|
2083
|
+
const requestPromise = isCreation.value ? createCategory(body) : updateCategory(categoryId.value, body);
|
|
2084
|
+
requestPromise.then(({ data }) => {
|
|
2085
|
+
errors.value = {};
|
|
2086
|
+
if (event.type === "create") {
|
|
2087
|
+
router.push(
|
|
2088
|
+
getBlogCategoryFormUrl({ categoryId: String(data.id) })
|
|
2089
|
+
);
|
|
2090
|
+
}
|
|
2091
|
+
if (event.type === "create_exit" || event.type === "save_exit") {
|
|
2092
|
+
navigateBack(router, getBlogCategoryListUrl());
|
|
2093
|
+
}
|
|
2094
|
+
if (event.type === "create_create-another") {
|
|
2095
|
+
values.value = convertCategoryToFormValues(
|
|
2096
|
+
null,
|
|
2097
|
+
languageOptionList.value,
|
|
2098
|
+
t
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
toast.show({
|
|
2102
|
+
variant: "success",
|
|
2103
|
+
title: t("blog:success"),
|
|
2104
|
+
body: isCreation.value ? t("blog:blogCategoryWasSuccessfullyCreated") : t("blog:blogCategoryWasSuccessfullyUpdated")
|
|
2105
|
+
});
|
|
2106
|
+
}).catch((error) => {
|
|
2107
|
+
console.error(error);
|
|
2108
|
+
errors.value = convertRequestErrorToMap(error);
|
|
2109
|
+
toast.show({
|
|
2110
|
+
variant: "danger",
|
|
2111
|
+
title: t("blog:error"),
|
|
2112
|
+
body: isCreation.value ? t("blog:blogCategoryCreationWasFailed") : t("blog:blogCategoryUpdateWasFailed")
|
|
2113
|
+
});
|
|
2114
|
+
}).finally(() => {
|
|
2115
|
+
isSubmitting.value = false;
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
const parentCategoryOptionList = computed(
|
|
2119
|
+
() => {
|
|
2120
|
+
var _a, _b;
|
|
2121
|
+
return convertCategoryListToOptions(
|
|
2122
|
+
categories.value,
|
|
2123
|
+
(_b = (_a = values.value.language) == null ? void 0 : _a.value) != null ? _b : null,
|
|
2124
|
+
t
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
const isContentLoading = computed(
|
|
2129
|
+
() => isCategoryLoading.value || isModuleConfigLoading.value || isCategoriesLoading.value
|
|
2130
|
+
);
|
|
2131
|
+
const categoryPagePath = computed(() => {
|
|
2132
|
+
var _a, _b;
|
|
2133
|
+
return `${getWebsiteOrigin()}${(_b = (_a = category.value) == null ? void 0 : _a.urlTemplate) != null ? _b : ""}`;
|
|
2134
|
+
});
|
|
2135
|
+
function handleSeoFieldGroupChange({
|
|
2136
|
+
title,
|
|
2137
|
+
description,
|
|
2138
|
+
keywords,
|
|
2139
|
+
image
|
|
2140
|
+
}) {
|
|
2141
|
+
values.value.pageTitle = title;
|
|
2142
|
+
values.value.pageDescription = description;
|
|
2143
|
+
values.value.pageKeywords = keywords;
|
|
2144
|
+
values.value.openGraphImage = image;
|
|
2145
|
+
}
|
|
2146
|
+
const tabList = computed(() => [
|
|
2147
|
+
{ id: "common", label: t("blog:tabs.common") },
|
|
2148
|
+
{ id: "seo", label: t("blog:tabs.seo") }
|
|
2149
|
+
]);
|
|
2150
|
+
const selectedTabId = ref(tabList.value[0].id);
|
|
2151
|
+
const urlAliasChanged = ref(false);
|
|
2152
|
+
const handleNameChange = (value) => {
|
|
2153
|
+
if (isCreation.value && !urlAliasChanged.value) {
|
|
2154
|
+
values.value.urlAlias = urlTranslit(value);
|
|
2155
|
+
}
|
|
2156
|
+
};
|
|
2157
|
+
const handleAliasChange = () => {
|
|
2158
|
+
urlAliasChanged.value = true;
|
|
2159
|
+
};
|
|
2160
|
+
return {
|
|
2161
|
+
isCreation,
|
|
2162
|
+
isContentLoading,
|
|
2163
|
+
values,
|
|
2164
|
+
errors,
|
|
2165
|
+
isLangSpecific,
|
|
2166
|
+
languageOptionList,
|
|
2167
|
+
pagePath: categoryPagePath,
|
|
2168
|
+
categoryListUrl: getBlogCategoryListUrl(),
|
|
2169
|
+
submitForm,
|
|
2170
|
+
isSubmitting,
|
|
2171
|
+
moduleConfig,
|
|
2172
|
+
parentCategoryOptionList,
|
|
2173
|
+
handleNameChange,
|
|
2174
|
+
handleAliasChange,
|
|
2175
|
+
imageScenario,
|
|
2176
|
+
handleSeoFieldGroupChange,
|
|
2177
|
+
tabList,
|
|
2178
|
+
selectedTabId
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2183
|
+
const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
|
|
2184
|
+
const _component_FormField = resolveComponent("FormField");
|
|
2185
|
+
const _component_FormFieldUrlAliasInput = resolveComponent("FormFieldUrlAliasInput");
|
|
2186
|
+
const _component_TabList = resolveComponent("TabList");
|
|
2187
|
+
const _component_FormFieldCheckbox = resolveComponent("FormFieldCheckbox");
|
|
2188
|
+
const _component_SeoFieldGroup = resolveComponent("SeoFieldGroup");
|
|
2189
|
+
const _component_FormFooter = resolveComponent("FormFooter");
|
|
2190
|
+
const _component_Page = resolveComponent("Page");
|
|
2191
|
+
return openBlock(), createBlock(_component_Page, {
|
|
2192
|
+
title: _ctx.isCreation ? _ctx.$i18n.t("blog:createBlogCategory") : _ctx.$i18n.t("blog:updateBlogCategory"),
|
|
2193
|
+
"is-content-loading": _ctx.isContentLoading
|
|
2194
|
+
}, {
|
|
2195
|
+
content: withCtx(() => [
|
|
2196
|
+
createElementVNode("form", {
|
|
2197
|
+
novalidate: "",
|
|
2198
|
+
onSubmit: _cache[10] || (_cache[10] = withModifiers((...args) => _ctx.submitForm && _ctx.submitForm(...args), ["prevent"]))
|
|
2199
|
+
}, [
|
|
2200
|
+
_ctx.isCreation ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2201
|
+
_ctx.isLangSpecific ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
2202
|
+
key: 0,
|
|
2203
|
+
value: _ctx.values.language,
|
|
2204
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.language = $event),
|
|
2205
|
+
name: "language",
|
|
2206
|
+
label: _ctx.$i18n.t("blog:language"),
|
|
2207
|
+
options: _ctx.languageOptionList,
|
|
2208
|
+
error: _ctx.errors.language
|
|
2209
|
+
}, null, 8, ["value", "label", "options", "error"])) : createCommentVNode("", true),
|
|
2210
|
+
createVNode(_component_FormField, {
|
|
2211
|
+
value: _ctx.values.name,
|
|
2212
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.name = $event),
|
|
2213
|
+
name: "name",
|
|
2214
|
+
label: _ctx.$i18n.t("blog:name"),
|
|
2215
|
+
error: _ctx.errors.name,
|
|
2216
|
+
onInput: _ctx.handleNameChange
|
|
2217
|
+
}, null, 8, ["value", "label", "error", "onInput"]),
|
|
2218
|
+
!_ctx.isLangSpecific || _ctx.values.language ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
2219
|
+
key: 1,
|
|
2220
|
+
value: _ctx.values.parent,
|
|
2221
|
+
"onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.values.parent = $event),
|
|
2222
|
+
name: "parentCategory",
|
|
2223
|
+
label: _ctx.$i18n.t("blog:parentCategory"),
|
|
2224
|
+
options: _ctx.parentCategoryOptionList,
|
|
2225
|
+
error: _ctx.errors.parent
|
|
2226
|
+
}, null, 8, ["value", "label", "options", "error"])) : createCommentVNode("", true),
|
|
2227
|
+
createVNode(_component_FormFieldUrlAliasInput, {
|
|
2228
|
+
id: "urlAlias",
|
|
2229
|
+
value: _ctx.values.urlAlias,
|
|
2230
|
+
"onUpdate:value": _cache[3] || (_cache[3] = ($event) => _ctx.values.urlAlias = $event),
|
|
2231
|
+
name: "urlAlias",
|
|
2232
|
+
label: _ctx.$i18n.t("blog:link"),
|
|
2233
|
+
"url-template": _ctx.pagePath,
|
|
2234
|
+
error: _ctx.errors.urlAlias,
|
|
2235
|
+
onChange: _ctx.handleAliasChange
|
|
2236
|
+
}, null, 8, ["value", "label", "url-template", "error", "onChange"])
|
|
2237
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2238
|
+
createVNode(_component_TabList, {
|
|
2239
|
+
"tab-list": _ctx.tabList,
|
|
2240
|
+
"selected-tab-id": _ctx.selectedTabId,
|
|
2241
|
+
"onTab:update": _cache[4] || (_cache[4] = ($event) => _ctx.selectedTabId = $event.tabId)
|
|
2242
|
+
}, null, 8, ["tab-list", "selected-tab-id"]),
|
|
2243
|
+
_ctx.selectedTabId === "common" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2244
|
+
_ctx.isLangSpecific ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
2245
|
+
key: 0,
|
|
2246
|
+
value: _ctx.values.language,
|
|
2247
|
+
"onUpdate:value": _cache[5] || (_cache[5] = ($event) => _ctx.values.language = $event),
|
|
2248
|
+
name: "language",
|
|
2249
|
+
label: _ctx.$i18n.t("blog:language"),
|
|
2250
|
+
options: _ctx.languageOptionList,
|
|
2251
|
+
error: _ctx.errors.language
|
|
2252
|
+
}, null, 8, ["value", "label", "options", "error"])) : createCommentVNode("", true),
|
|
2253
|
+
createVNode(_component_FormFieldCheckbox, {
|
|
2254
|
+
checked: _ctx.values.isDefault,
|
|
2255
|
+
"onUpdate:checked": _cache[6] || (_cache[6] = ($event) => _ctx.values.isDefault = $event),
|
|
2256
|
+
name: "isDefault",
|
|
2257
|
+
label: _ctx.$i18n.t("blog:defaultCategory"),
|
|
2258
|
+
error: _ctx.errors.isDefault
|
|
2259
|
+
}, null, 8, ["checked", "label", "error"]),
|
|
2260
|
+
createVNode(_component_FormField, {
|
|
2261
|
+
value: _ctx.values.name,
|
|
2262
|
+
"onUpdate:value": _cache[7] || (_cache[7] = ($event) => _ctx.values.name = $event),
|
|
2263
|
+
name: "name",
|
|
2264
|
+
label: _ctx.$i18n.t("blog:name"),
|
|
2265
|
+
error: _ctx.errors.name
|
|
2266
|
+
}, null, 8, ["value", "label", "error"]),
|
|
2267
|
+
!_ctx.isLangSpecific || _ctx.values.language ? (openBlock(), createBlock(_component_FormFieldSelect, {
|
|
2268
|
+
key: 1,
|
|
2269
|
+
value: _ctx.values.parent,
|
|
2270
|
+
"onUpdate:value": _cache[8] || (_cache[8] = ($event) => _ctx.values.parent = $event),
|
|
2271
|
+
name: "parentCategory",
|
|
2272
|
+
label: _ctx.$i18n.t("blog:parentCategory"),
|
|
2273
|
+
options: _ctx.parentCategoryOptionList,
|
|
2274
|
+
error: _ctx.errors.parent
|
|
2275
|
+
}, null, 8, ["value", "label", "options", "error"])) : createCommentVNode("", true),
|
|
2276
|
+
createVNode(_component_FormFieldUrlAliasInput, {
|
|
2277
|
+
id: "urlAlias",
|
|
2278
|
+
value: _ctx.values.urlAlias,
|
|
2279
|
+
"onUpdate:value": _cache[9] || (_cache[9] = ($event) => _ctx.values.urlAlias = $event),
|
|
2280
|
+
name: "urlAlias",
|
|
2281
|
+
label: _ctx.$i18n.t("blog:link"),
|
|
2282
|
+
"url-template": _ctx.pagePath,
|
|
2283
|
+
error: _ctx.errors.urlAlias
|
|
2284
|
+
}, null, 8, ["value", "label", "url-template", "error"])
|
|
2285
|
+
], 64)) : createCommentVNode("", true),
|
|
2286
|
+
_ctx.selectedTabId === "seo" ? (openBlock(), createBlock(_component_SeoFieldGroup, {
|
|
2287
|
+
key: 1,
|
|
2288
|
+
title: _ctx.values.pageTitle,
|
|
2289
|
+
"title-error-message": _ctx.errors.pageTitle,
|
|
2290
|
+
description: _ctx.values.pageDescription,
|
|
2291
|
+
"description-error-message": _ctx.errors.pageDescription,
|
|
2292
|
+
"should-display-keywords": false,
|
|
2293
|
+
keywords: _ctx.values.pageKeywords,
|
|
2294
|
+
"keywords-error-message": _ctx.errors.pageKeywords,
|
|
2295
|
+
image: _ctx.values.openGraphImage,
|
|
2296
|
+
"image-scenario": _ctx.imageScenario,
|
|
2297
|
+
"image-error-message": _ctx.errors.openGraphImage,
|
|
2298
|
+
onChange: _ctx.handleSeoFieldGroupChange
|
|
2299
|
+
}, null, 8, ["title", "title-error-message", "description", "description-error-message", "keywords", "keywords-error-message", "image", "image-scenario", "image-error-message", "onChange"])) : createCommentVNode("", true)
|
|
2300
|
+
], 64))
|
|
2301
|
+
], 32)
|
|
2302
|
+
]),
|
|
2303
|
+
footer: withCtx(() => [
|
|
2304
|
+
createVNode(_component_FormFooter, {
|
|
2305
|
+
"back-href": _ctx.categoryListUrl,
|
|
2306
|
+
"is-submitting": _ctx.isSubmitting,
|
|
2307
|
+
"is-creation": _ctx.isCreation,
|
|
2308
|
+
"can-create-another": _ctx.isCreation,
|
|
2309
|
+
onSubmit: _ctx.submitForm
|
|
2310
|
+
}, null, 8, ["back-href", "is-submitting", "is-creation", "can-create-another", "onSubmit"])
|
|
2311
|
+
]),
|
|
2312
|
+
_: 1
|
|
2313
|
+
}, 8, ["title", "is-content-loading"]);
|
|
2314
|
+
}
|
|
2315
|
+
var BlogCategoryForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
2316
|
+
const BLOG_POST_LIST_ROUTE = {
|
|
2317
|
+
path: BLOG_ROUTE_PATHS.POST_LIST,
|
|
2318
|
+
component: BlogPostList,
|
|
2319
|
+
name: "All posts",
|
|
2320
|
+
meta: {
|
|
2321
|
+
getBreadcrumbs: (route, { t }) => [
|
|
2322
|
+
{ url: "/", text: t("blog:home") },
|
|
2323
|
+
{ url: BLOG_ROUTE_PATHS.POST_LIST, text: t("blog:allPosts") }
|
|
2324
|
+
]
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
const BLOG_POST_FORM_ROUTE = {
|
|
2328
|
+
path: BLOG_ROUTE_PATHS.POST_FORM,
|
|
2329
|
+
component: BlogPostForm,
|
|
2330
|
+
name: "Post Form",
|
|
2331
|
+
meta: {
|
|
2332
|
+
getBreadcrumbs: (route, { t }) => [
|
|
2333
|
+
{ url: "/", text: t("blog:home") },
|
|
2334
|
+
{ url: BLOG_ROUTE_PATHS.POST_LIST, text: t("blog:allPosts") },
|
|
2335
|
+
{ url: route.path, text: t("blog:postForm") }
|
|
2336
|
+
]
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
const BLOG_CATEGORY_LIST_ROUTE = {
|
|
2340
|
+
path: BLOG_ROUTE_PATHS.CATEGORY_LIST,
|
|
2341
|
+
component: BlogCategoryList,
|
|
2342
|
+
name: "All categories",
|
|
2343
|
+
meta: {
|
|
2344
|
+
getBreadcrumbs: (route, { t }) => [
|
|
2345
|
+
{ url: "/", text: t("blog:home") },
|
|
2346
|
+
{ url: BLOG_ROUTE_PATHS.CATEGORY_LIST, text: t("blog:allCategories") }
|
|
2347
|
+
]
|
|
2348
|
+
}
|
|
2349
|
+
};
|
|
2350
|
+
const BLOG_CATEGORY_FORM_ROUTE = {
|
|
2351
|
+
path: BLOG_ROUTE_PATHS.CATEGORY_FORM,
|
|
2352
|
+
component: BlogCategoryForm,
|
|
2353
|
+
name: "Category Form",
|
|
2354
|
+
meta: {
|
|
2355
|
+
getBreadcrumbs: (route, { t }) => [
|
|
2356
|
+
{ url: "/", text: t("blog:home") },
|
|
2357
|
+
{ url: BLOG_ROUTE_PATHS.CATEGORY_LIST, text: t("blog:allCategories") },
|
|
2358
|
+
{ url: route.path, text: t("blog:categoryForm") }
|
|
2359
|
+
]
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
applyTranslations();
|
|
2363
|
+
export { BLOG_CATEGORY_FORM_ROUTE, BLOG_CATEGORY_LIST_ROUTE, BLOG_POST_FORM_ROUTE, BLOG_POST_LIST_ROUTE, clonePost, createBlogPost, createCategory, deleteBlogPost, deleteCategory, getBlogCategoryFormUrl, getBlogCategoryListUrl, getBlogPostCount, getBlogPostFormUrl, getBlogPostListUrl, getCategories, getCategory, getModuleConfig, getPost, getPosts, moveCategory, updateBlogPost, updateCategory };
|