@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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:title="
|
|
2
|
+
<Page
|
|
3
|
+
:title="
|
|
4
|
+
isCreation ? $i18n.t('blog:createPost') : $i18n.t('blog:updatePost')
|
|
5
|
+
"
|
|
4
6
|
:is-content-loading="isContentLoading"
|
|
5
7
|
:header-buttons="headerButtonList"
|
|
6
8
|
:footer="{
|
|
@@ -9,63 +11,117 @@
|
|
|
9
11
|
isSubmitting: isSubmitting,
|
|
10
12
|
}"
|
|
11
13
|
>
|
|
12
|
-
<template
|
|
14
|
+
<template #content>
|
|
13
15
|
<form novalidate @submit.prevent="submitForm">
|
|
14
|
-
<
|
|
16
|
+
<TabList
|
|
15
17
|
:tab-list="tabList"
|
|
16
18
|
:selected-tab-id="selectedTabId"
|
|
17
19
|
@tab:update="selectedTabId = $event.tabId"
|
|
18
20
|
/>
|
|
19
21
|
|
|
20
22
|
<template v-if="selectedTabId === 'common'">
|
|
21
|
-
<
|
|
22
|
-
v-model="values.status"
|
|
23
|
-
name="status"
|
|
24
|
-
:error="errors.status"
|
|
25
|
-
:label="$t('blog:status')"
|
|
26
|
-
:no-options-message="$t('blog:noTemplates')"
|
|
27
|
-
:options="statusOptions"
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<form-field-select
|
|
23
|
+
<FormFieldSelect
|
|
31
24
|
v-if="isCreation && isLangSpecific"
|
|
32
|
-
v-model="values.language"
|
|
25
|
+
v-model:value="values.language"
|
|
33
26
|
name="language"
|
|
34
|
-
:label="$t('blog:language')"
|
|
27
|
+
:label="$i18n.t('blog:language')"
|
|
35
28
|
:options="languageOptionList"
|
|
36
29
|
:error="errors.language"
|
|
37
30
|
/>
|
|
38
31
|
|
|
39
|
-
<
|
|
40
|
-
v-model="values.title"
|
|
32
|
+
<FormField
|
|
33
|
+
v-model:value="values.title"
|
|
41
34
|
name="title"
|
|
42
|
-
:label="$t('blog:title')"
|
|
35
|
+
:label="$i18n.t('blog:title')"
|
|
43
36
|
:error="errors.title"
|
|
44
37
|
@input="handleTitleChange"
|
|
45
38
|
/>
|
|
46
39
|
|
|
47
|
-
<
|
|
40
|
+
<FormFieldUrlAliasInput
|
|
48
41
|
id="urlAlias"
|
|
49
|
-
v-model="values.urlAlias"
|
|
42
|
+
v-model:value="values.urlAlias"
|
|
50
43
|
name="urlAlias"
|
|
51
|
-
:label="$t('blog:link')"
|
|
44
|
+
:label="$i18n.t('blog:link')"
|
|
52
45
|
:url-template="urlAliasTemplate"
|
|
53
46
|
:error="errors.urlAlias"
|
|
54
47
|
@change="handleAliasChange"
|
|
55
48
|
/>
|
|
56
49
|
|
|
57
|
-
<
|
|
58
|
-
|
|
50
|
+
<div class="status">
|
|
51
|
+
<div class="status-value">
|
|
52
|
+
<FormFieldSelect
|
|
53
|
+
v-model:value="values.status"
|
|
54
|
+
name="status"
|
|
55
|
+
:error="errors.status"
|
|
56
|
+
:label="$i18n.t('blog:status')"
|
|
57
|
+
:no-options-message="$i18n.t('blog:noTemplates')"
|
|
58
|
+
:options="statusOptions"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
<div
|
|
62
|
+
v-if="
|
|
63
|
+
values.status.value === 'PUBLISHED' ||
|
|
64
|
+
values.status.value === 'DRAFT'
|
|
65
|
+
"
|
|
66
|
+
class="status-checkbox"
|
|
67
|
+
>
|
|
68
|
+
<FormFieldCheckbox
|
|
69
|
+
v-model:checked="values.statusDateEnabled"
|
|
70
|
+
name="statusDateEnabled"
|
|
71
|
+
:label="
|
|
72
|
+
$i18n.t(
|
|
73
|
+
values.status.value === 'PUBLISHED'
|
|
74
|
+
? 'blog:scheduleArchive'
|
|
75
|
+
: 'blog:schedulePublish'
|
|
76
|
+
)
|
|
77
|
+
"
|
|
78
|
+
:error="errors.status"
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
<div
|
|
82
|
+
v-if="
|
|
83
|
+
values.statusDateEnabled &&
|
|
84
|
+
(values.status.value === 'PUBLISHED' ||
|
|
85
|
+
values.status.value === 'DRAFT')
|
|
86
|
+
"
|
|
87
|
+
class="status-date"
|
|
88
|
+
>
|
|
89
|
+
<FormField
|
|
90
|
+
v-model:value="values.statusDate"
|
|
91
|
+
name="statusDate"
|
|
92
|
+
type="date"
|
|
93
|
+
:label="
|
|
94
|
+
$i18n.t(
|
|
95
|
+
values.status.value === 'PUBLISHED'
|
|
96
|
+
? 'blog:archiveAt'
|
|
97
|
+
: 'blog:publishAt'
|
|
98
|
+
)
|
|
99
|
+
"
|
|
100
|
+
:error="errors.statusDate"
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<FormField
|
|
106
|
+
v-model:value="values.datetime"
|
|
107
|
+
name="datetime"
|
|
108
|
+
:label="$i18n.t('blog:date')"
|
|
109
|
+
type="date"
|
|
110
|
+
:error="errors.datetime"
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
<FormField
|
|
114
|
+
v-model:value="values.excerpt"
|
|
59
115
|
name="excerpt"
|
|
60
|
-
:label="$t('blog:excerpt')"
|
|
116
|
+
:label="$i18n.t('blog:excerpt')"
|
|
61
117
|
type="textarea"
|
|
62
118
|
:error="errors.excerpt"
|
|
63
119
|
/>
|
|
64
120
|
|
|
65
|
-
<
|
|
66
|
-
v-model="values.body"
|
|
121
|
+
<FormFieldRichTextInput
|
|
122
|
+
v-model:value="values.body"
|
|
67
123
|
name="body"
|
|
68
|
-
:label="$t('blog:body')"
|
|
124
|
+
:label="$i18n.t('blog:body')"
|
|
69
125
|
:error="errors.body"
|
|
70
126
|
:get-upload-adapter-options="getUploadAdapterOptions"
|
|
71
127
|
/>
|
|
@@ -75,37 +131,29 @@
|
|
|
75
131
|
moduleConfig ? moduleConfig.shortcodes : []
|
|
76
132
|
"
|
|
77
133
|
/>
|
|
78
|
-
|
|
79
|
-
<form-field
|
|
80
|
-
v-model="values.datetime"
|
|
81
|
-
name="datetime"
|
|
82
|
-
:label="$t('blog:date')"
|
|
83
|
-
type="date"
|
|
84
|
-
:error="errors.datetime"
|
|
85
|
-
/>
|
|
86
134
|
</template>
|
|
87
135
|
|
|
88
136
|
<template v-if="selectedTabId === 'images'">
|
|
89
|
-
<
|
|
90
|
-
v-model="values.coverImage"
|
|
91
|
-
:label="$t('blog:coverImage')"
|
|
137
|
+
<FormFieldFileInput
|
|
138
|
+
v-model:value="values.coverImage"
|
|
139
|
+
:label="$i18n.t('blog:coverImage')"
|
|
92
140
|
name="coverImage"
|
|
93
141
|
file-type="image"
|
|
94
142
|
:scenario="moduleConfig ? moduleConfig.fileScenarios.cover : null"
|
|
95
143
|
/>
|
|
96
144
|
|
|
97
|
-
<
|
|
98
|
-
v-model="values.image"
|
|
145
|
+
<FormFieldFileInput
|
|
146
|
+
v-model:value="values.image"
|
|
99
147
|
name="image"
|
|
100
|
-
:label="$t('blog:innerImage')"
|
|
148
|
+
:label="$i18n.t('blog:innerImage')"
|
|
101
149
|
file-type="image"
|
|
102
150
|
:scenario="moduleConfig ? moduleConfig.fileScenarios.image : null"
|
|
103
151
|
/>
|
|
104
152
|
|
|
105
|
-
<
|
|
106
|
-
v-model="values.imageMobile"
|
|
153
|
+
<FormFieldFileInput
|
|
154
|
+
v-model:value="values.imageMobile"
|
|
107
155
|
name="imageMobile"
|
|
108
|
-
:label="$t('blog:innerImageMobile')"
|
|
156
|
+
:label="$i18n.t('blog:innerImageMobile')"
|
|
109
157
|
file-type="image"
|
|
110
158
|
:scenario="
|
|
111
159
|
moduleConfig ? moduleConfig.fileScenarios.imageMobile : null
|
|
@@ -114,26 +162,26 @@
|
|
|
114
162
|
</template>
|
|
115
163
|
|
|
116
164
|
<template v-if="selectedTabId === 'relations'">
|
|
117
|
-
<
|
|
118
|
-
v-model="values.tags"
|
|
165
|
+
<FormField
|
|
166
|
+
v-model:value="values.tags"
|
|
119
167
|
name="tags"
|
|
120
|
-
:label="$t('blog:tags')"
|
|
168
|
+
:label="$i18n.t('blog:tags')"
|
|
121
169
|
:error="errors.tags"
|
|
122
170
|
/>
|
|
123
171
|
|
|
124
|
-
<
|
|
125
|
-
:selected-options="values.categories"
|
|
172
|
+
<FormFieldMultiSelect
|
|
173
|
+
v-model:selected-options="values.categories"
|
|
126
174
|
name="categories"
|
|
127
|
-
:label="$t('blog:categories')"
|
|
175
|
+
:label="$i18n.t('blog:categories')"
|
|
128
176
|
:options="categoryOptionList"
|
|
129
177
|
:error="errors.categories"
|
|
130
178
|
@change="handleCategoriesChange"
|
|
131
179
|
/>
|
|
132
180
|
|
|
133
|
-
<
|
|
134
|
-
v-model="values.relatedPosts"
|
|
181
|
+
<FormFieldMultiSelect
|
|
182
|
+
v-model:selected-options="values.relatedPosts"
|
|
135
183
|
name="relatedPosts"
|
|
136
|
-
:label="$t('blog:relatedPosts')"
|
|
184
|
+
:label="$i18n.t('blog:relatedPosts')"
|
|
137
185
|
:options="postOptionList"
|
|
138
186
|
:error="errors.relatedPosts"
|
|
139
187
|
:searchable="true"
|
|
@@ -149,16 +197,16 @@
|
|
|
149
197
|
</template>
|
|
150
198
|
|
|
151
199
|
<template v-if="selectedTabId === 'seo'">
|
|
152
|
-
<
|
|
200
|
+
<SeoFieldGroup
|
|
153
201
|
:title="values.pageTitle"
|
|
154
202
|
:title-error-message="errors.pageTitle"
|
|
155
|
-
:title-label="$t('blog:pageTitle')"
|
|
203
|
+
:title-label="$i18n.t('blog:pageTitle')"
|
|
156
204
|
:description="values.pageDescription"
|
|
157
205
|
:description-error-message="errors.pageDescription"
|
|
158
|
-
:description-label="$t('blog:pageDescription')"
|
|
206
|
+
:description-label="$i18n.t('blog:pageDescription')"
|
|
159
207
|
:image="values.openGraphImage"
|
|
160
208
|
:image-error-message="errors.openGraphImage"
|
|
161
|
-
:image-label="$t('blog:openGraphImage')"
|
|
209
|
+
:image-label="$i18n.t('blog:openGraphImage')"
|
|
162
210
|
:image-scenario="
|
|
163
211
|
moduleConfig ? moduleConfig.fileScenarios.openGraph : null
|
|
164
212
|
"
|
|
@@ -168,26 +216,21 @@
|
|
|
168
216
|
</form>
|
|
169
217
|
</template>
|
|
170
218
|
|
|
171
|
-
<template
|
|
219
|
+
<template #footer>
|
|
172
220
|
<FormFooter
|
|
173
221
|
:back-href="postListUrl"
|
|
174
|
-
:on-submit="submitForm"
|
|
175
222
|
:is-submitting="isSubmitting"
|
|
176
223
|
:is-creation="isCreation"
|
|
177
224
|
:can-create-another="isCreation"
|
|
225
|
+
@submit="submitForm"
|
|
178
226
|
/>
|
|
179
227
|
</template>
|
|
180
|
-
</
|
|
228
|
+
</Page>
|
|
181
229
|
</template>
|
|
182
230
|
|
|
183
231
|
<script lang="ts">
|
|
184
|
-
import {
|
|
185
|
-
|
|
186
|
-
defineComponent,
|
|
187
|
-
onMounted,
|
|
188
|
-
ref,
|
|
189
|
-
watch,
|
|
190
|
-
} from '@vue/composition-api';
|
|
232
|
+
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
|
|
233
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
191
234
|
|
|
192
235
|
import {
|
|
193
236
|
convertRequestErrorToMap,
|
|
@@ -195,6 +238,9 @@ import {
|
|
|
195
238
|
Nullable,
|
|
196
239
|
useResource,
|
|
197
240
|
urlTranslit,
|
|
241
|
+
useI18n,
|
|
242
|
+
useToast,
|
|
243
|
+
navigateBack,
|
|
198
244
|
} from '@tager/admin-services';
|
|
199
245
|
import {
|
|
200
246
|
createTabErrorFinder,
|
|
@@ -204,13 +250,19 @@ import {
|
|
|
204
250
|
SeoChangeEvent,
|
|
205
251
|
FormFooter,
|
|
206
252
|
TagerFormSubmitEvent,
|
|
253
|
+
FormFieldSelect,
|
|
254
|
+
FormField,
|
|
255
|
+
FormFieldUrlAliasInput,
|
|
256
|
+
FormFieldCheckbox,
|
|
257
|
+
FormFieldRichTextInput,
|
|
258
|
+
FormFieldFileInput,
|
|
259
|
+
FormFieldMultiSelect,
|
|
260
|
+
SeoFieldGroup,
|
|
207
261
|
} from '@tager/admin-ui';
|
|
208
262
|
import { DynamicField } from '@tager/admin-dynamic-field';
|
|
263
|
+
import { Page } from '@tager/admin-layout';
|
|
209
264
|
|
|
210
|
-
import {
|
|
211
|
-
getBlogPostFormUrl,
|
|
212
|
-
getBlogPostListUrl,
|
|
213
|
-
} from '../../../constants/paths';
|
|
265
|
+
import { getBlogPostFormUrl, getBlogPostListUrl } from '../../../utils/paths';
|
|
214
266
|
import {
|
|
215
267
|
createBlogPost,
|
|
216
268
|
getPost,
|
|
@@ -231,26 +283,42 @@ import {
|
|
|
231
283
|
FormValues,
|
|
232
284
|
getStatusOptions,
|
|
233
285
|
} from './PostForm.helpers';
|
|
286
|
+
import TabList from './components/TabList/TabList.vue';
|
|
234
287
|
|
|
235
288
|
export default defineComponent({
|
|
236
289
|
name: 'BlogPostForm',
|
|
237
|
-
components: {
|
|
238
|
-
|
|
239
|
-
|
|
290
|
+
components: {
|
|
291
|
+
SeoFieldGroup,
|
|
292
|
+
FormFieldMultiSelect,
|
|
293
|
+
FormFieldFileInput,
|
|
294
|
+
FormFieldRichTextInput,
|
|
295
|
+
FormFieldCheckbox,
|
|
296
|
+
FormFieldUrlAliasInput,
|
|
297
|
+
FormField,
|
|
298
|
+
FormFieldSelect,
|
|
299
|
+
TabList,
|
|
300
|
+
Page,
|
|
301
|
+
DynamicField,
|
|
302
|
+
ShortCodeConstructor,
|
|
303
|
+
FormFooter,
|
|
304
|
+
},
|
|
305
|
+
setup() {
|
|
306
|
+
const route = useRoute();
|
|
307
|
+
const router = useRouter();
|
|
308
|
+
const toast = useToast();
|
|
309
|
+
const { t } = useI18n();
|
|
310
|
+
|
|
311
|
+
const postId = computed<string>(() => route.params.postId as string);
|
|
240
312
|
const isCreation = computed<boolean>(() => postId.value === 'create');
|
|
241
313
|
|
|
242
314
|
const urlAliasChanged = ref<boolean>(false);
|
|
243
315
|
|
|
244
|
-
const statusOptions = computed<OptionType[]>(() =>
|
|
245
|
-
getStatusOptions(context.root.$t)
|
|
246
|
-
);
|
|
316
|
+
const statusOptions = computed<OptionType[]>(() => getStatusOptions(t));
|
|
247
317
|
|
|
248
318
|
/** Fetch module config **/
|
|
249
319
|
|
|
250
|
-
const {
|
|
251
|
-
|
|
252
|
-
loading: isModuleConfigLoading,
|
|
253
|
-
} = useFetchModuleConfig({ context });
|
|
320
|
+
const { data: moduleConfig, loading: isModuleConfigLoading } =
|
|
321
|
+
useFetchModuleConfig();
|
|
254
322
|
|
|
255
323
|
const languageList = computed<Language[]>(
|
|
256
324
|
() => moduleConfig.value?.languages ?? []
|
|
@@ -267,19 +335,17 @@ export default defineComponent({
|
|
|
267
335
|
|
|
268
336
|
/** Fetch category list */
|
|
269
337
|
|
|
270
|
-
const {
|
|
271
|
-
|
|
272
|
-
loading: isCategoryListLoading,
|
|
273
|
-
} = useFetchCategories({ context });
|
|
338
|
+
const { data: categoryList, loading: isCategoryListLoading } =
|
|
339
|
+
useFetchCategories();
|
|
274
340
|
|
|
275
341
|
/** Fetch Post */
|
|
276
342
|
|
|
277
343
|
const [fetchPost, { data: post, loading: isPostLoading }] = useResource<
|
|
278
344
|
Nullable<PostFull>
|
|
279
345
|
>({
|
|
280
|
-
fetchResource: () =>
|
|
346
|
+
fetchResource: () =>
|
|
347
|
+
postId.value ? getPost(postId.value) : new Promise(() => null),
|
|
281
348
|
initialValue: null,
|
|
282
|
-
context,
|
|
283
349
|
resourceName: 'Post',
|
|
284
350
|
});
|
|
285
351
|
|
|
@@ -296,9 +362,7 @@ export default defineComponent({
|
|
|
296
362
|
});
|
|
297
363
|
|
|
298
364
|
/** Fetch post list */
|
|
299
|
-
const { data: postList, loading: isPostListLoading } = useFetchPosts(
|
|
300
|
-
context,
|
|
301
|
-
});
|
|
365
|
+
const { data: postList, loading: isPostListLoading } = useFetchPosts();
|
|
302
366
|
|
|
303
367
|
const postOptionList = computed<OptionType<number>[]>(() =>
|
|
304
368
|
postList.value
|
|
@@ -347,17 +411,11 @@ export default defineComponent({
|
|
|
347
411
|
errors.value = {};
|
|
348
412
|
|
|
349
413
|
if (event.type === 'create') {
|
|
350
|
-
|
|
351
|
-
getBlogPostFormUrl({ postId: String(data.id) })
|
|
352
|
-
);
|
|
414
|
+
router.push(getBlogPostFormUrl({ postId: String(data.id) }));
|
|
353
415
|
}
|
|
354
416
|
|
|
355
417
|
if (event.type === 'create_exit' || event.type === 'save_exit') {
|
|
356
|
-
|
|
357
|
-
context.root.$router.back();
|
|
358
|
-
} else {
|
|
359
|
-
context.root.$router.push(getBlogPostListUrl());
|
|
360
|
-
}
|
|
418
|
+
navigateBack(router, getBlogPostListUrl());
|
|
361
419
|
}
|
|
362
420
|
|
|
363
421
|
if (event.type === 'create_create-another') {
|
|
@@ -370,23 +428,23 @@ export default defineComponent({
|
|
|
370
428
|
);
|
|
371
429
|
}
|
|
372
430
|
|
|
373
|
-
|
|
431
|
+
toast.show({
|
|
374
432
|
variant: 'success',
|
|
375
|
-
title:
|
|
433
|
+
title: t('blog:success'),
|
|
376
434
|
body: isCreation.value
|
|
377
|
-
?
|
|
378
|
-
:
|
|
435
|
+
? t('blog:blogPostWasSuccessfullyCreated')
|
|
436
|
+
: t('blog:blogPostWasSuccessfullyUpdated'),
|
|
379
437
|
});
|
|
380
438
|
})
|
|
381
439
|
.catch((error) => {
|
|
382
440
|
console.error(error);
|
|
383
441
|
errors.value = convertRequestErrorToMap(error);
|
|
384
|
-
|
|
442
|
+
toast.show({
|
|
385
443
|
variant: 'danger',
|
|
386
|
-
title:
|
|
444
|
+
title: t('blog:error'),
|
|
387
445
|
body: isCreation.value
|
|
388
|
-
?
|
|
389
|
-
:
|
|
446
|
+
? t('blog:blogPostCreationWasFailed')
|
|
447
|
+
: t('blog:blogPostUpdateWasFailed'),
|
|
390
448
|
});
|
|
391
449
|
})
|
|
392
450
|
.finally(() => {
|
|
@@ -452,7 +510,7 @@ export default defineComponent({
|
|
|
452
510
|
return [
|
|
453
511
|
{
|
|
454
512
|
id: 'common',
|
|
455
|
-
label:
|
|
513
|
+
label: t('blog:common'),
|
|
456
514
|
hasErrors: hasErrors([
|
|
457
515
|
'title',
|
|
458
516
|
'language',
|
|
@@ -464,18 +522,18 @@ export default defineComponent({
|
|
|
464
522
|
},
|
|
465
523
|
{
|
|
466
524
|
id: 'images',
|
|
467
|
-
label:
|
|
525
|
+
label: t('blog:images'),
|
|
468
526
|
hasErrors: hasErrors(['coverImage', 'image']),
|
|
469
527
|
},
|
|
470
528
|
{
|
|
471
529
|
id: 'relations',
|
|
472
|
-
label:
|
|
530
|
+
label: t('blog:relations'),
|
|
473
531
|
hasErrors: hasErrors(['categories', 'relatedPosts', 'tags']),
|
|
474
532
|
},
|
|
475
533
|
values.value.additionalFields.length > 0
|
|
476
534
|
? {
|
|
477
535
|
id: 'additional',
|
|
478
|
-
label:
|
|
536
|
+
label: t('blog:additionalFields'),
|
|
479
537
|
hasErrors: hasErrors([]),
|
|
480
538
|
}
|
|
481
539
|
: null,
|
|
@@ -499,7 +557,7 @@ export default defineComponent({
|
|
|
499
557
|
[
|
|
500
558
|
post.value
|
|
501
559
|
? {
|
|
502
|
-
text:
|
|
560
|
+
text: t('blog:viewPost'),
|
|
503
561
|
href: process.env.VUE_APP_WEBSITE_URL + post.value.url,
|
|
504
562
|
target: '_blank',
|
|
505
563
|
}
|
|
@@ -612,3 +670,24 @@ export default defineComponent({
|
|
|
612
670
|
},
|
|
613
671
|
});
|
|
614
672
|
</script>
|
|
673
|
+
|
|
674
|
+
<style scoped lang="scss">
|
|
675
|
+
.status {
|
|
676
|
+
display: flex;
|
|
677
|
+
align-items: flex-end;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.status-value {
|
|
681
|
+
flex-basis: 50%;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.status-checkbox {
|
|
685
|
+
margin-left: 20px;
|
|
686
|
+
padding-bottom: 8px;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.status-date {
|
|
690
|
+
margin-left: 20px;
|
|
691
|
+
flex: 1 1 1px;
|
|
692
|
+
}
|
|
693
|
+
</style>
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
|
-
import
|
|
19
|
+
import { defineComponent } from 'vue';
|
|
20
20
|
|
|
21
21
|
import { TabType } from './TabList.types';
|
|
22
22
|
|
|
23
|
-
export default
|
|
23
|
+
export default defineComponent({
|
|
24
24
|
name: 'TabList',
|
|
25
25
|
props: {
|
|
26
26
|
tabList: {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Language,
|
|
10
10
|
PostShort,
|
|
11
11
|
} from '../../../typings/model';
|
|
12
|
-
import { getBlogPostFormUrl } from '../../../
|
|
12
|
+
import { getBlogPostFormUrl } from '../../../utils/paths';
|
|
13
13
|
|
|
14
14
|
export function convertPostList(
|
|
15
15
|
postList: PostShort[],
|
|
@@ -64,12 +64,11 @@ export function getPostTableColumnDefs(
|
|
|
64
64
|
id: 2,
|
|
65
65
|
name: t('blog:status'),
|
|
66
66
|
field: 'status',
|
|
67
|
-
style: { width: '
|
|
68
|
-
headStyle: { width: '
|
|
69
|
-
format: ({ row }) => getStatuses(t)[row.status],
|
|
67
|
+
style: { width: '140px' },
|
|
68
|
+
headStyle: { width: '140px' },
|
|
70
69
|
},
|
|
71
70
|
{
|
|
72
|
-
id:
|
|
71
|
+
id: 3,
|
|
73
72
|
name: t('blog:name'),
|
|
74
73
|
field: 'name',
|
|
75
74
|
type: 'name',
|
|
@@ -88,7 +87,7 @@ export function getPostTableColumnDefs(
|
|
|
88
87
|
}),
|
|
89
88
|
},
|
|
90
89
|
{
|
|
91
|
-
id:
|
|
90
|
+
id: 4,
|
|
92
91
|
name: t('blog:image'),
|
|
93
92
|
field: 'image',
|
|
94
93
|
type: 'image',
|
|
@@ -96,24 +95,24 @@ export function getPostTableColumnDefs(
|
|
|
96
95
|
headStyle: { width: '250px' },
|
|
97
96
|
},
|
|
98
97
|
isLangSpecific
|
|
99
|
-
? { id:
|
|
98
|
+
? { id: 5, name: t('blog:language'), field: 'language' }
|
|
100
99
|
: null,
|
|
101
100
|
{
|
|
102
|
-
id:
|
|
101
|
+
id: 6,
|
|
103
102
|
name: t('blog:date'),
|
|
104
103
|
field: 'datetime',
|
|
105
104
|
type: 'datetime',
|
|
106
105
|
options: { ignoreStartOfDayTime: true },
|
|
107
106
|
},
|
|
108
107
|
{
|
|
109
|
-
id:
|
|
108
|
+
id: 7,
|
|
110
109
|
name: t('blog:categories'),
|
|
111
110
|
field: 'categories',
|
|
112
111
|
format: ({ row }) =>
|
|
113
112
|
row.categories.map((category) => category.name).join(', '),
|
|
114
113
|
},
|
|
115
114
|
{
|
|
116
|
-
id:
|
|
115
|
+
id: 8,
|
|
117
116
|
name: t('blog:actions'),
|
|
118
117
|
field: 'actions',
|
|
119
118
|
style: { whiteSpace: 'nowrap', width: '120px' },
|