@tager/admin-blog 0.3.31 → 0.3.36
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/hooks/index.d.ts +0 -3
- package/dist/index.esm.js +120 -206
- package/dist/index.umd.js +119 -206
- package/dist/locales/en.d.ts +1 -0
- package/dist/services/requests.d.ts +2 -3
- package/dist/typings/model.d.ts +2 -16
- package/dist/utils/common.d.ts +0 -2
- package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +3 -1
- package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +25 -20
- package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +1 -1
- package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +0 -2
- package/dist/views/Posts/PostList/PostList.helpers.d.ts +1 -1
- package/dist/views/Posts/PostList/PostList.vue.d.ts +0 -2
- package/package.json +2 -4
- package/src/dev.ts +0 -4
- package/src/hooks/index.ts +0 -3
- package/src/locales/en.ts +1 -0
- package/src/locales/ru.ts +1 -0
- package/src/services/requests.ts +1 -6
- package/src/typings/model.ts +2 -21
- package/src/utils/common.ts +0 -10
- package/src/views/App.vue +1 -9
- package/src/views/Categories/CategoryForm/CategoryForm.helpers.ts +24 -4
- package/src/views/Categories/CategoryForm/CategoryForm.vue +39 -13
- package/src/views/Categories/CategoryList/CategoryList.helpers.ts +9 -12
- package/src/views/Categories/CategoryList/CategoryList.vue +8 -25
- package/src/views/Posts/PostForm/PostForm.vue +1 -1
- package/src/views/Posts/PostList/PostList.helpers.ts +8 -11
- package/src/views/Posts/PostList/PostList.vue +9 -30
- package/dist/constants/scopes.d.ts +0 -11
- package/dist/hooks/useStore.d.ts +0 -4
- package/dist/hooks/useUserPermission.d.ts +0 -3
- package/dist/hooks/useUserProfile.d.ts +0 -3
- package/dist/store/index.d.ts +0 -6
- package/dist/store/user.d.ts +0 -14
- package/src/constants/scopes.ts +0 -11
- package/src/hooks/useStore.ts +0 -8
- package/src/hooks/useUserPermission.ts +0 -16
- package/src/hooks/useUserProfile.ts +0 -13
- package/src/store/index.ts +0 -21
- package/src/store/user.ts +0 -110
package/dist/index.umd.js
CHANGED
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
seo: 'SEO',
|
|
78
78
|
},
|
|
79
79
|
parentCategory: 'Parent category',
|
|
80
|
+
noParent: 'No parent',
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
const RU = {
|
|
@@ -152,6 +153,7 @@
|
|
|
152
153
|
seo: 'SEO',
|
|
153
154
|
},
|
|
154
155
|
parentCategory: 'Родительская категория',
|
|
156
|
+
noParent: 'Нет родительской',
|
|
155
157
|
};
|
|
156
158
|
|
|
157
159
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -2525,26 +2527,11 @@
|
|
|
2525
2527
|
|
|
2526
2528
|
var lodash_pick = pick;
|
|
2527
2529
|
|
|
2528
|
-
const Scope = {
|
|
2529
|
-
All: '*',
|
|
2530
|
-
OrdersCreate: 'orders.create',
|
|
2531
|
-
OrdersView: 'orders.view',
|
|
2532
|
-
OrdersDelete: 'orders.delete',
|
|
2533
|
-
RbacViewRoles: 'rbac.view-roles',
|
|
2534
|
-
RbacEditRoles: 'rbac.edit-roles',
|
|
2535
|
-
AdministratorsView: 'administrators.view',
|
|
2536
|
-
AdministratorsEdit: 'administrators.edit',
|
|
2537
|
-
AdministratorsDelete: 'administrators.delete',
|
|
2538
|
-
};
|
|
2539
|
-
|
|
2540
|
-
function getUserProfile() {
|
|
2541
|
-
return adminServices.request.get({ path: '/admin/self' });
|
|
2542
|
-
}
|
|
2543
2530
|
/** Blog Posts */
|
|
2544
2531
|
function getPosts(params) {
|
|
2545
2532
|
return adminServices.request.get({ path: '/admin/blog/posts', params });
|
|
2546
2533
|
}
|
|
2547
|
-
function
|
|
2534
|
+
function getBlogPostCount() {
|
|
2548
2535
|
return adminServices.request.get({ path: '/admin/blog/posts/count' });
|
|
2549
2536
|
}
|
|
2550
2537
|
function getPost(postId) {
|
|
@@ -2655,105 +2642,6 @@
|
|
|
2655
2642
|
return resource;
|
|
2656
2643
|
}
|
|
2657
2644
|
|
|
2658
|
-
function useStore(context) {
|
|
2659
|
-
return context.root.$store;
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
const USER_MODULE_NAMESPACE = 'user';
|
|
2663
|
-
const USER_MUTATION_TYPES = {
|
|
2664
|
-
PROFILE_REQUEST_STARTED: 'profileRequestStarted',
|
|
2665
|
-
PROFILE_REQUEST_FULFILLED: 'profileRequestFulfilled',
|
|
2666
|
-
PROFILE_REQUEST_REJECTED: 'profileRequestRejected',
|
|
2667
|
-
};
|
|
2668
|
-
const USER_ACTION_TYPES = {
|
|
2669
|
-
FETCH_USER_PROFILE: 'fetchUserProfile',
|
|
2670
|
-
};
|
|
2671
|
-
const userGetters = {
|
|
2672
|
-
userProfile(state) {
|
|
2673
|
-
return state.profile;
|
|
2674
|
-
},
|
|
2675
|
-
userScopes(state) {
|
|
2676
|
-
const roles = state.profile ? state.profile.roles : [];
|
|
2677
|
-
const scopes = [];
|
|
2678
|
-
roles.forEach((role) => {
|
|
2679
|
-
scopes.push(...role.scopes);
|
|
2680
|
-
});
|
|
2681
|
-
return scopes;
|
|
2682
|
-
},
|
|
2683
|
-
userHasPermission: (state, getters) => (scope) => {
|
|
2684
|
-
const scopes = getters.userScopes;
|
|
2685
|
-
if (scopes.includes(Scope.All))
|
|
2686
|
-
return true;
|
|
2687
|
-
return scopes.includes(scope);
|
|
2688
|
-
},
|
|
2689
|
-
};
|
|
2690
|
-
const userModule = {
|
|
2691
|
-
namespaced: true,
|
|
2692
|
-
state: {
|
|
2693
|
-
profile: null,
|
|
2694
|
-
status: adminServices.FETCH_STATUSES.IDLE,
|
|
2695
|
-
},
|
|
2696
|
-
mutations: {
|
|
2697
|
-
[USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED](state) {
|
|
2698
|
-
if (state.status === adminServices.FETCH_STATUSES.IDLE) {
|
|
2699
|
-
state.status = adminServices.FETCH_STATUSES.LOADING;
|
|
2700
|
-
}
|
|
2701
|
-
},
|
|
2702
|
-
[USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED](state, user) {
|
|
2703
|
-
if (state.status === adminServices.FETCH_STATUSES.LOADING) {
|
|
2704
|
-
state.status = adminServices.FETCH_STATUSES.SUCCESS;
|
|
2705
|
-
state.profile = user;
|
|
2706
|
-
}
|
|
2707
|
-
},
|
|
2708
|
-
[USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED](state) {
|
|
2709
|
-
if (state.status === adminServices.FETCH_STATUSES.LOADING) {
|
|
2710
|
-
state.status = adminServices.FETCH_STATUSES.FAILURE;
|
|
2711
|
-
state.profile = null;
|
|
2712
|
-
}
|
|
2713
|
-
},
|
|
2714
|
-
},
|
|
2715
|
-
actions: {
|
|
2716
|
-
[USER_ACTION_TYPES.FETCH_USER_PROFILE](store) {
|
|
2717
|
-
if (store.state.status !== adminServices.FETCH_STATUSES.IDLE)
|
|
2718
|
-
return;
|
|
2719
|
-
store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED);
|
|
2720
|
-
getUserProfile()
|
|
2721
|
-
.then((response) => {
|
|
2722
|
-
store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED, response.data);
|
|
2723
|
-
})
|
|
2724
|
-
.catch((error) => {
|
|
2725
|
-
console.error(error);
|
|
2726
|
-
store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED);
|
|
2727
|
-
});
|
|
2728
|
-
},
|
|
2729
|
-
},
|
|
2730
|
-
getters: userGetters,
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
function namespace(namespace, name) {
|
|
2734
|
-
return `${namespace}/${name}`;
|
|
2735
|
-
}
|
|
2736
|
-
function userNamespace(name) {
|
|
2737
|
-
return namespace(USER_MODULE_NAMESPACE, name);
|
|
2738
|
-
}
|
|
2739
|
-
function generateNumberArray(length) {
|
|
2740
|
-
return Array.from({ length }, (_, index) => index);
|
|
2741
|
-
}
|
|
2742
|
-
function getNameWithDepth(name, depth) {
|
|
2743
|
-
return (generateNumberArray(depth)
|
|
2744
|
-
.map(() => '—')
|
|
2745
|
-
.join(' ') +
|
|
2746
|
-
' ' +
|
|
2747
|
-
name);
|
|
2748
|
-
}
|
|
2749
|
-
|
|
2750
|
-
function useUserPermission(context, scope) {
|
|
2751
|
-
const store = useStore(context);
|
|
2752
|
-
return compositionApi.computed(() => {
|
|
2753
|
-
return store.getters[userNamespace('userHasPermission')](scope);
|
|
2754
|
-
});
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
2645
|
const BLOG_ROUTE_PATHS = {
|
|
2758
2646
|
POST_LIST: '/blog/posts',
|
|
2759
2647
|
POST_FORM: '/blog/posts/:postId',
|
|
@@ -2788,7 +2676,7 @@
|
|
|
2788
2676
|
return post;
|
|
2789
2677
|
});
|
|
2790
2678
|
}
|
|
2791
|
-
function getPostTableColumnDefs(moduleConfig, t
|
|
2679
|
+
function getPostTableColumnDefs(moduleConfig, t) {
|
|
2792
2680
|
const isLangSpecific = moduleConfig
|
|
2793
2681
|
? moduleConfig.languages.length > 0
|
|
2794
2682
|
: false;
|
|
@@ -2837,19 +2725,28 @@
|
|
|
2837
2725
|
field: 'categories',
|
|
2838
2726
|
format: ({ row }) => row.categories.map((category) => category.name).join(', '),
|
|
2839
2727
|
},
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
}
|
|
2848
|
-
: null,
|
|
2728
|
+
{
|
|
2729
|
+
id: 7,
|
|
2730
|
+
name: t('blog:actions'),
|
|
2731
|
+
field: 'actions',
|
|
2732
|
+
style: { whiteSpace: 'nowrap', width: '120px' },
|
|
2733
|
+
headStyle: { whiteSpace: 'nowrap', width: '120px' },
|
|
2734
|
+
},
|
|
2849
2735
|
];
|
|
2850
2736
|
return COLUMN_DEFS.filter(adminServices.notEmpty);
|
|
2851
2737
|
}
|
|
2852
2738
|
|
|
2739
|
+
function generateNumberArray(length) {
|
|
2740
|
+
return Array.from({ length }, (_, index) => index);
|
|
2741
|
+
}
|
|
2742
|
+
function getNameWithDepth(name, depth) {
|
|
2743
|
+
return (generateNumberArray(depth)
|
|
2744
|
+
.map(() => '—')
|
|
2745
|
+
.join(' ') +
|
|
2746
|
+
' ' +
|
|
2747
|
+
name);
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2853
2750
|
var FilterTypes;
|
|
2854
2751
|
(function (FilterTypes) {
|
|
2855
2752
|
FilterTypes["CATEGORY"] = "category";
|
|
@@ -2987,7 +2884,6 @@
|
|
|
2987
2884
|
name: 'Posts',
|
|
2988
2885
|
setup(props, context) {
|
|
2989
2886
|
const { t } = adminUi.useTranslation(context);
|
|
2990
|
-
const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
|
|
2991
2887
|
const categoryId = compositionApi.computed(() => {
|
|
2992
2888
|
var _a;
|
|
2993
2889
|
return Array.isArray(context.root.$route.query.category)
|
|
@@ -3051,13 +2947,13 @@
|
|
|
3051
2947
|
confirmMessage: t('blog:cloneConfirm'),
|
|
3052
2948
|
successMessage: t('blog:cloneSuccess'),
|
|
3053
2949
|
failureMessage: t('blog:cloneFailure'),
|
|
3054
|
-
onSuccessRedirectTo: (data) => `/posts/${data.id}`,
|
|
2950
|
+
onSuccessRedirectTo: (data) => `/blog/posts/${data.id}`,
|
|
3055
2951
|
context,
|
|
3056
2952
|
});
|
|
3057
2953
|
function isBusy(postId) {
|
|
3058
2954
|
return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;
|
|
3059
2955
|
}
|
|
3060
|
-
const columnDefs = compositionApi.computed(() => getPostTableColumnDefs(moduleConfig.value, context.root.$t
|
|
2956
|
+
const columnDefs = compositionApi.computed(() => getPostTableColumnDefs(moduleConfig.value, context.root.$t));
|
|
3061
2957
|
return {
|
|
3062
2958
|
columnDefs,
|
|
3063
2959
|
rowData: displayedPostList,
|
|
@@ -3083,8 +2979,6 @@
|
|
|
3083
2979
|
toDateFilter,
|
|
3084
2980
|
tags,
|
|
3085
2981
|
tagRemovalHandler,
|
|
3086
|
-
// Permissions
|
|
3087
|
-
canViewAdministrators,
|
|
3088
2982
|
// Clone
|
|
3089
2983
|
handleResourceClone,
|
|
3090
2984
|
isBusy,
|
|
@@ -3232,13 +3126,11 @@
|
|
|
3232
3126
|
attrs: {
|
|
3233
3127
|
title: _vm.pageTitle,
|
|
3234
3128
|
"header-buttons": [
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
: null,
|
|
3241
|
-
].filter(Boolean),
|
|
3129
|
+
{
|
|
3130
|
+
text: _vm.$t("blog:newPost"),
|
|
3131
|
+
href: _vm.getBlogPostFormUrl({ postId: "create" }),
|
|
3132
|
+
},
|
|
3133
|
+
],
|
|
3242
3134
|
},
|
|
3243
3135
|
scopedSlots: _vm._u([
|
|
3244
3136
|
{
|
|
@@ -3442,11 +3334,11 @@
|
|
|
3442
3334
|
/* style */
|
|
3443
3335
|
const __vue_inject_styles__ = function (inject) {
|
|
3444
3336
|
if (!inject) return
|
|
3445
|
-
inject("data-v-0acae486_0", { source: ".filters[data-v-0acae486] {\n display: flex;\n margin: 0 -10px;\n}\n.filters[data-v-0acae486]:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter[data-v-0acae486] {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n.date-label[data-v-0acae486] {\n margin-bottom: 0.5rem;\n}\n.date-content[data-v-0acae486] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-blog/tager-admin-blog/src/views/Posts/PostList/PostList.vue","PostList.vue"],"names":[],"mappings":"AA0VA;EACA,aAAA;EACA,eAAA;ACzVA;AD2VA;EACA,gBAAA;ACzVA;AD4VA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;AC1VA;AD8VA;EACA,qBAAA;AC3VA;AD8VA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;AC3VA;;AAEA,uCAAuC","file":"PostList.vue","sourcesContent":["<template>\n <page\n :title=\"pageTitle\"\n :header-buttons=\"\n [\n canViewAdministrators\n ? {\n text: $t('blog:newPost'),\n href: getBlogPostFormUrl({ postId: 'create' }),\n }\n : null,\n ].filter(Boolean)\n \"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n data-table=\"blog-post\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"categoryFilter\"\n :options=\"categoryOptionList\"\n name=\"categoryFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:category')\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-if=\"isLangSpecific\"\n v-model=\"languageFilter\"\n :options=\"languageOptionList\"\n name=\"languageFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:language')\"\n class=\"filter\"\n />\n\n <div class=\"filter\">\n <div class=\"date-label\">\n {{ $t('blog:dateOfPublication') }}\n </div>\n\n <div class=\"date-content\">\n <form-field\n v-model=\"fromDateFilter\"\n :label=\"$t('blog:From')\"\n name=\"fromDateFilter\"\n type=\"date\"\n :max=\"toDateFilter\"\n />\n\n <form-field\n v-model=\"toDateFilter\"\n :label=\"$t('blog:To')\"\n name=\"toDateFilter\"\n type=\"date\"\n :min=\"fromDateFilter\"\n />\n </div>\n </div>\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:edit')\"\n :disabled=\"isBusy(row.id)\"\n :href=\"getBlogPostFormUrl({ postId: row.id })\"\n >\n <svg-icon name=\"edit\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:clone')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceClone(row.id)\"\n >\n <svg-icon name=\"contentCopy\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:remove')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\" />\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, watch } from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport {\n ColumnDefinition,\n useDataTable,\n useTranslation,\n} from '@tager/admin-ui';\nimport {\n Nullable,\n useResourceClone,\n useResourceDelete,\n} from '@tager/admin-services';\n\nimport { Scope } from '../../../constants/scopes';\nimport {\n useFetchModuleConfig,\n useFetchCategories,\n useUserPermission,\n} from '../../../hooks';\nimport {\n clonePost,\n deleteBlogPost,\n getPosts,\n} from '../../../services/requests';\nimport { getBlogPostFormUrl } from '../../../constants/paths';\nimport {\n Category,\n Language,\n PostFull,\n PostShort,\n} from '../../../typings/model';\n\nimport { convertPostList, getPostTableColumnDefs } from './PostList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'Posts',\n setup(props, context) {\n const { t } = useTranslation(context);\n\n const canViewAdministrators = useUserPermission(\n context,\n Scope.AdministratorsView\n );\n\n const categoryId = computed<string>(() => {\n return Array.isArray(context.root.$route.query.category)\n ? context.root.$route.query.category[0] ?? ''\n : context.root.$route.query.category;\n });\n\n /** Fetch module config **/\n\n const {\n data: moduleConfig,\n loading: isModuleConfigLoading,\n } = useFetchModuleConfig({ context });\n\n const languageList = computed<Language[]>(\n () => moduleConfig.value?.languages ?? []\n );\n\n /** Fetch category list **/\n\n const {\n data: categoryList,\n loading: isCategoryListLoading,\n } = useFetchCategories({ context });\n\n const selectedCategory = computed<Nullable<Category>>(() =>\n categoryId.value\n ? categoryList.value.find(\n ({ id }) => String(id) === String(categoryId.value)\n ) ?? null\n : null\n );\n\n const pageTitle = computed<string>(() => {\n return selectedCategory.value\n ? `${context.root.$t('blog:postsByCategory')} \"${\n selectedCategory.value.name\n }\"`\n : context.root.$t('blog:posts');\n });\n\n /** Advanced search **/\n\n const {\n categoryFilter,\n categoryOptionList,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n categoryList,\n languageList,\n });\n\n const isLangSpecific = computed<boolean>(\n () => languageOptionList.value.length > 1\n );\n\n /** Fetch Post list **/\n\n const {\n fetchEntityList: fetchPostList,\n isLoading: isPostLoading,\n rowData: postList,\n errorMessage,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<PostShort>({\n fetchEntityList: (params) =>\n getPosts({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Blog post list',\n pageSize: 100,\n });\n\n watch(filterParams, () => {\n if (isModuleConfigLoading.value || isCategoryListLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchPostList();\n }\n });\n\n const displayedPostList = computed<PostShort[]>(() =>\n convertPostList(\n postList.value,\n selectedCategory.value,\n moduleConfig.value?.languages ?? []\n )\n );\n\n const isRowDataLoading = computed<boolean>(\n () =>\n isCategoryListLoading.value ||\n isPostLoading.value ||\n isModuleConfigLoading.value\n );\n\n const { isDeleting, handleResourceDelete } = useResourceDelete({\n deleteResource: deleteBlogPost,\n resourceName: 'Post',\n onSuccess: fetchPostList,\n context,\n });\n\n const { isCloning, handleResourceClone } = useResourceClone({\n cloneResource: clonePost,\n confirmMessage: t('blog:cloneConfirm'),\n successMessage: t('blog:cloneSuccess'),\n failureMessage: t('blog:cloneFailure'),\n onSuccessRedirectTo: (data: PostFull) => `/posts/${data.id}`,\n context,\n });\n\n function isBusy(postId: number): boolean {\n return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;\n }\n\n const columnDefs = computed<ColumnDefinition<PostShort>[]>(() =>\n getPostTableColumnDefs(\n moduleConfig.value,\n context.root.$t,\n canViewAdministrators.value\n )\n );\n\n return {\n columnDefs,\n rowData: displayedPostList,\n handleResourceDelete,\n isDeleting,\n categoryList,\n isRowDataLoading,\n errorMessage,\n getBlogPostFormUrl,\n pageTitle,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n\n // Advanced search\n categoryFilter,\n categoryOptionList,\n isLangSpecific,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n tags,\n tagRemovalHandler,\n\n // Permissions\n canViewAdministrators,\n\n // Clone\n handleResourceClone,\n isBusy,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */"]}, media: undefined });
|
|
3337
|
+
inject("data-v-6697ac14_0", { source: ".filters[data-v-6697ac14] {\n display: flex;\n margin: 0 -10px;\n}\n.filters[data-v-6697ac14]:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter[data-v-6697ac14] {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n.date-label[data-v-6697ac14] {\n margin-bottom: 0.5rem;\n}\n.date-content[data-v-6697ac14] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-blog/tager-admin-blog/src/views/Posts/PostList/PostList.vue","PostList.vue"],"names":[],"mappings":"AAqUA;EACA,aAAA;EACA,eAAA;ACpUA;ADsUA;EACA,gBAAA;ACpUA;ADuUA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;ACrUA;ADyUA;EACA,qBAAA;ACtUA;ADyUA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;ACtUA;;AAEA,uCAAuC","file":"PostList.vue","sourcesContent":["<template>\n <page\n :title=\"pageTitle\"\n :header-buttons=\"[\n {\n text: $t('blog:newPost'),\n href: getBlogPostFormUrl({ postId: 'create' }),\n },\n ]\"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n data-table=\"blog-post\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"categoryFilter\"\n :options=\"categoryOptionList\"\n name=\"categoryFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:category')\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-if=\"isLangSpecific\"\n v-model=\"languageFilter\"\n :options=\"languageOptionList\"\n name=\"languageFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:language')\"\n class=\"filter\"\n />\n\n <div class=\"filter\">\n <div class=\"date-label\">\n {{ $t('blog:dateOfPublication') }}\n </div>\n\n <div class=\"date-content\">\n <form-field\n v-model=\"fromDateFilter\"\n :label=\"$t('blog:From')\"\n name=\"fromDateFilter\"\n type=\"date\"\n :max=\"toDateFilter\"\n />\n\n <form-field\n v-model=\"toDateFilter\"\n :label=\"$t('blog:To')\"\n name=\"toDateFilter\"\n type=\"date\"\n :min=\"fromDateFilter\"\n />\n </div>\n </div>\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:edit')\"\n :disabled=\"isBusy(row.id)\"\n :href=\"getBlogPostFormUrl({ postId: row.id })\"\n >\n <svg-icon name=\"edit\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:clone')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceClone(row.id)\"\n >\n <svg-icon name=\"contentCopy\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:remove')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\" />\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, watch } from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport {\n ColumnDefinition,\n useDataTable,\n useTranslation,\n} from '@tager/admin-ui';\nimport {\n Nullable,\n useResourceClone,\n useResourceDelete,\n} from '@tager/admin-services';\n\nimport { useFetchModuleConfig, useFetchCategories } from '../../../hooks';\nimport {\n clonePost,\n deleteBlogPost,\n getPosts,\n} from '../../../services/requests';\nimport { getBlogPostFormUrl } from '../../../constants/paths';\nimport {\n Category,\n Language,\n PostFull,\n PostShort,\n} from '../../../typings/model';\n\nimport { convertPostList, getPostTableColumnDefs } from './PostList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'Posts',\n setup(props, context) {\n const { t } = useTranslation(context);\n\n const categoryId = computed<string>(() => {\n return Array.isArray(context.root.$route.query.category)\n ? context.root.$route.query.category[0] ?? ''\n : context.root.$route.query.category;\n });\n\n /** Fetch module config **/\n\n const {\n data: moduleConfig,\n loading: isModuleConfigLoading,\n } = useFetchModuleConfig({ context });\n\n const languageList = computed<Language[]>(\n () => moduleConfig.value?.languages ?? []\n );\n\n /** Fetch category list **/\n\n const {\n data: categoryList,\n loading: isCategoryListLoading,\n } = useFetchCategories({ context });\n\n const selectedCategory = computed<Nullable<Category>>(() =>\n categoryId.value\n ? categoryList.value.find(\n ({ id }) => String(id) === String(categoryId.value)\n ) ?? null\n : null\n );\n\n const pageTitle = computed<string>(() => {\n return selectedCategory.value\n ? `${context.root.$t('blog:postsByCategory')} \"${\n selectedCategory.value.name\n }\"`\n : context.root.$t('blog:posts');\n });\n\n /** Advanced search **/\n\n const {\n categoryFilter,\n categoryOptionList,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n categoryList,\n languageList,\n });\n\n const isLangSpecific = computed<boolean>(\n () => languageOptionList.value.length > 1\n );\n\n /** Fetch Post list **/\n\n const {\n fetchEntityList: fetchPostList,\n isLoading: isPostLoading,\n rowData: postList,\n errorMessage,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<PostShort>({\n fetchEntityList: (params) =>\n getPosts({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Blog post list',\n pageSize: 100,\n });\n\n watch(filterParams, () => {\n if (isModuleConfigLoading.value || isCategoryListLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchPostList();\n }\n });\n\n const displayedPostList = computed<PostShort[]>(() =>\n convertPostList(\n postList.value,\n selectedCategory.value,\n moduleConfig.value?.languages ?? []\n )\n );\n\n const isRowDataLoading = computed<boolean>(\n () =>\n isCategoryListLoading.value ||\n isPostLoading.value ||\n isModuleConfigLoading.value\n );\n\n const { isDeleting, handleResourceDelete } = useResourceDelete({\n deleteResource: deleteBlogPost,\n resourceName: 'Post',\n onSuccess: fetchPostList,\n context,\n });\n\n const { isCloning, handleResourceClone } = useResourceClone({\n cloneResource: clonePost,\n confirmMessage: t('blog:cloneConfirm'),\n successMessage: t('blog:cloneSuccess'),\n failureMessage: t('blog:cloneFailure'),\n onSuccessRedirectTo: (data: PostFull) => `/blog/posts/${data.id}`,\n context,\n });\n\n function isBusy(postId: number): boolean {\n return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;\n }\n\n const columnDefs = computed<ColumnDefinition<PostShort>[]>(() =>\n getPostTableColumnDefs(moduleConfig.value, context.root.$t)\n );\n\n return {\n columnDefs,\n rowData: displayedPostList,\n handleResourceDelete,\n isDeleting,\n categoryList,\n isRowDataLoading,\n errorMessage,\n getBlogPostFormUrl,\n pageTitle,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n\n // Advanced search\n categoryFilter,\n categoryOptionList,\n isLangSpecific,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n tags,\n tagRemovalHandler,\n\n // Clone\n handleResourceClone,\n isBusy,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */"]}, media: undefined });
|
|
3446
3338
|
|
|
3447
3339
|
};
|
|
3448
3340
|
/* scoped */
|
|
3449
|
-
const __vue_scope_id__ = "data-v-
|
|
3341
|
+
const __vue_scope_id__ = "data-v-6697ac14";
|
|
3450
3342
|
/* module identifier */
|
|
3451
3343
|
const __vue_module_identifier__ = undefined;
|
|
3452
3344
|
/* functional template */
|
|
@@ -4194,7 +4086,7 @@
|
|
|
4194
4086
|
return category;
|
|
4195
4087
|
});
|
|
4196
4088
|
}
|
|
4197
|
-
function getCategoryTableColumnDefs(moduleConfig, t
|
|
4089
|
+
function getCategoryTableColumnDefs(moduleConfig, t) {
|
|
4198
4090
|
const isLangSpecific = moduleConfig
|
|
4199
4091
|
? moduleConfig.languages.length > 0
|
|
4200
4092
|
: false;
|
|
@@ -4236,16 +4128,14 @@
|
|
|
4236
4128
|
field: 'linkToPosts',
|
|
4237
4129
|
style: { whiteSpace: 'nowrap', width: '130px' },
|
|
4238
4130
|
},
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
}
|
|
4248
|
-
: null,
|
|
4131
|
+
{
|
|
4132
|
+
id: 5,
|
|
4133
|
+
name: t('blog:actions'),
|
|
4134
|
+
field: 'actions',
|
|
4135
|
+
style: { whiteSpace: 'nowrap', width: '170px' },
|
|
4136
|
+
headStyle: { whiteSpace: 'nowrap', width: '170px' },
|
|
4137
|
+
class: 'actions-cell',
|
|
4138
|
+
},
|
|
4249
4139
|
];
|
|
4250
4140
|
return COLUMN_DEFS.filter(adminServices.notEmpty);
|
|
4251
4141
|
}
|
|
@@ -4299,7 +4189,6 @@
|
|
|
4299
4189
|
var script$2 = compositionApi.defineComponent({
|
|
4300
4190
|
name: 'BlogCategoryList',
|
|
4301
4191
|
setup(props, context) {
|
|
4302
|
-
const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
|
|
4303
4192
|
/** Fetch module config **/
|
|
4304
4193
|
const { data: moduleConfig, loading: isModuleConfigLoading, } = useFetchModuleConfig({ context });
|
|
4305
4194
|
const languageList = compositionApi.computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []; });
|
|
@@ -4348,7 +4237,7 @@
|
|
|
4348
4237
|
/** Misc */
|
|
4349
4238
|
const isRowDataLoading = compositionApi.computed(() => isCategoryListLoading.value || isModuleConfigLoading.value);
|
|
4350
4239
|
const displayedCategoryList = compositionApi.computed(() => convertCategoryList(categoryList.value, languageList.value));
|
|
4351
|
-
const columnDefs = compositionApi.computed(() => getCategoryTableColumnDefs(moduleConfig.value, context.root.$t
|
|
4240
|
+
const columnDefs = compositionApi.computed(() => getCategoryTableColumnDefs(moduleConfig.value, context.root.$t));
|
|
4352
4241
|
return {
|
|
4353
4242
|
columnDefs,
|
|
4354
4243
|
rowData: displayedCategoryList,
|
|
@@ -4370,8 +4259,6 @@
|
|
|
4370
4259
|
languageOptionList,
|
|
4371
4260
|
tags,
|
|
4372
4261
|
tagRemovalHandler,
|
|
4373
|
-
// Permissions
|
|
4374
|
-
canViewAdministrators,
|
|
4375
4262
|
};
|
|
4376
4263
|
},
|
|
4377
4264
|
});
|
|
@@ -4388,13 +4275,11 @@
|
|
|
4388
4275
|
attrs: {
|
|
4389
4276
|
title: _vm.$t("blog:blogCategories"),
|
|
4390
4277
|
"header-buttons": [
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
: null,
|
|
4397
|
-
].filter(Boolean),
|
|
4278
|
+
{
|
|
4279
|
+
text: _vm.$t("blog:newCategory"),
|
|
4280
|
+
href: _vm.getBlogCategoryFormUrl({ categoryId: "create" }),
|
|
4281
|
+
},
|
|
4282
|
+
],
|
|
4398
4283
|
},
|
|
4399
4284
|
scopedSlots: _vm._u([
|
|
4400
4285
|
{
|
|
@@ -4611,14 +4496,14 @@
|
|
|
4611
4496
|
undefined
|
|
4612
4497
|
);
|
|
4613
4498
|
|
|
4614
|
-
function convertCategoryToFormValues(category, languageOptionList) {
|
|
4499
|
+
function convertCategoryToFormValues(category, languageOptionList, t) {
|
|
4615
4500
|
var _a, _b, _c, _d, _e;
|
|
4616
4501
|
const currentLangOption = languageOptionList.find(({ value }) => value === (category === null || category === void 0 ? void 0 : category.language));
|
|
4617
4502
|
if (!category) {
|
|
4618
4503
|
return {
|
|
4619
4504
|
language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
|
|
4620
4505
|
name: '',
|
|
4621
|
-
parent: null,
|
|
4506
|
+
parent: { value: null, label: t('blog:noParent') },
|
|
4622
4507
|
urlAlias: '',
|
|
4623
4508
|
pageTitle: '',
|
|
4624
4509
|
pageDescription: '',
|
|
@@ -4633,7 +4518,7 @@
|
|
|
4633
4518
|
name: category.name,
|
|
4634
4519
|
parent: category.parent
|
|
4635
4520
|
? { value: category.parent.id, label: category.parent.name }
|
|
4636
|
-
: null,
|
|
4521
|
+
: { value: null, label: t('blog:noParent') },
|
|
4637
4522
|
urlAlias: category.urlAlias,
|
|
4638
4523
|
pageTitle: (_a = category.pageTitle) !== null && _a !== void 0 ? _a : '',
|
|
4639
4524
|
pageDescription: (_b = category.pageDescription) !== null && _b !== void 0 ? _b : '',
|
|
@@ -4646,17 +4531,28 @@
|
|
|
4646
4531
|
};
|
|
4647
4532
|
}
|
|
4648
4533
|
function convertCategoryFormValuesToPayload(values) {
|
|
4649
|
-
var _a, _b, _c, _d
|
|
4534
|
+
var _a, _b, _c, _d;
|
|
4650
4535
|
return {
|
|
4651
4536
|
language: (_b = (_a = values.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null,
|
|
4652
4537
|
name: values.name,
|
|
4653
|
-
parent:
|
|
4538
|
+
parent: values.parent.value,
|
|
4654
4539
|
urlAlias: values.urlAlias,
|
|
4655
4540
|
isDefault: false,
|
|
4656
4541
|
pageTitle: values.pageTitle,
|
|
4657
4542
|
pageDescription: values.pageDescription,
|
|
4658
|
-
openGraphImage: (
|
|
4543
|
+
openGraphImage: (_d = (_c = values.openGraphImage) === null || _c === void 0 ? void 0 : _c.file.id) !== null && _d !== void 0 ? _d : null,
|
|
4659
4544
|
};
|
|
4545
|
+
}
|
|
4546
|
+
function convertCategoryListToOptions$1(categoryList, languageId, t) {
|
|
4547
|
+
return [
|
|
4548
|
+
{ value: null, label: t('blog:noParent') },
|
|
4549
|
+
...categoryList
|
|
4550
|
+
.filter(({ language }) => (languageId ? language === languageId : true))
|
|
4551
|
+
.map(({ id, name, depth }) => ({
|
|
4552
|
+
value: id,
|
|
4553
|
+
label: getNameWithDepth(name, depth),
|
|
4554
|
+
})),
|
|
4555
|
+
];
|
|
4660
4556
|
}
|
|
4661
4557
|
|
|
4662
4558
|
var script$3 = compositionApi.defineComponent({
|
|
@@ -4682,10 +4578,10 @@
|
|
|
4682
4578
|
});
|
|
4683
4579
|
/** Form State */
|
|
4684
4580
|
const isSubmitting = compositionApi.ref(false);
|
|
4685
|
-
const values = compositionApi.ref(convertCategoryToFormValues(category.value, languageOptionList.value));
|
|
4581
|
+
const values = compositionApi.ref(convertCategoryToFormValues(category.value, languageOptionList.value, t));
|
|
4686
4582
|
const errors = compositionApi.ref({});
|
|
4687
|
-
compositionApi.watch(category, () => {
|
|
4688
|
-
values.value = convertCategoryToFormValues(category.value, languageOptionList.value);
|
|
4583
|
+
compositionApi.watch([category, languageOptionList], () => {
|
|
4584
|
+
values.value = convertCategoryToFormValues(category.value, languageOptionList.value, t);
|
|
4689
4585
|
});
|
|
4690
4586
|
function submitForm(event) {
|
|
4691
4587
|
isSubmitting.value = true;
|
|
@@ -4703,7 +4599,7 @@
|
|
|
4703
4599
|
context.root.$router.push(getBlogCategoryListUrl());
|
|
4704
4600
|
}
|
|
4705
4601
|
if (event.type === 'create_create-another') {
|
|
4706
|
-
values.value = convertCategoryToFormValues(null, languageOptionList.value);
|
|
4602
|
+
values.value = convertCategoryToFormValues(null, languageOptionList.value, t);
|
|
4707
4603
|
}
|
|
4708
4604
|
context.root.$toast({
|
|
4709
4605
|
variant: 'success',
|
|
@@ -4729,9 +4625,9 @@
|
|
|
4729
4625
|
});
|
|
4730
4626
|
}
|
|
4731
4627
|
/** Category Options */
|
|
4732
|
-
const
|
|
4628
|
+
const parentCategoryOptionList = compositionApi.computed(() => {
|
|
4733
4629
|
var _a, _b;
|
|
4734
|
-
return convertCategoryListToOptions(categories.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null);
|
|
4630
|
+
return convertCategoryListToOptions$1(categories.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null, t);
|
|
4735
4631
|
});
|
|
4736
4632
|
/** Misc */
|
|
4737
4633
|
const isContentLoading = compositionApi.computed(() => isCategoryLoading.value ||
|
|
@@ -4754,6 +4650,16 @@
|
|
|
4754
4650
|
{ id: 'seo', label: t('blog:tabs.seo') },
|
|
4755
4651
|
]);
|
|
4756
4652
|
const selectedTabId = compositionApi.ref(tabList.value[0].id);
|
|
4653
|
+
/** Url Alias **/
|
|
4654
|
+
const urlAliasChanged = compositionApi.ref(false);
|
|
4655
|
+
const handleNameChange = (value) => {
|
|
4656
|
+
if (isCreation.value && !urlAliasChanged.value) {
|
|
4657
|
+
values.value.urlAlias = adminServices.urlTranslit(value);
|
|
4658
|
+
}
|
|
4659
|
+
};
|
|
4660
|
+
const handleAliasChange = () => {
|
|
4661
|
+
urlAliasChanged.value = true;
|
|
4662
|
+
};
|
|
4757
4663
|
return {
|
|
4758
4664
|
isCreation,
|
|
4759
4665
|
isContentLoading: isContentLoading,
|
|
@@ -4766,7 +4672,9 @@
|
|
|
4766
4672
|
submitForm,
|
|
4767
4673
|
isSubmitting,
|
|
4768
4674
|
moduleConfig,
|
|
4769
|
-
|
|
4675
|
+
parentCategoryOptionList,
|
|
4676
|
+
handleNameChange,
|
|
4677
|
+
handleAliasChange,
|
|
4770
4678
|
// SEO
|
|
4771
4679
|
imageScenario,
|
|
4772
4680
|
handleSeoFieldGroupChange,
|
|
@@ -4835,6 +4743,7 @@
|
|
|
4835
4743
|
label: _vm.$t("blog:name"),
|
|
4836
4744
|
error: _vm.errors.name,
|
|
4837
4745
|
},
|
|
4746
|
+
on: { input: _vm.handleNameChange },
|
|
4838
4747
|
model: {
|
|
4839
4748
|
value: _vm.values.name,
|
|
4840
4749
|
callback: function ($$v) {
|
|
@@ -4844,21 +4753,23 @@
|
|
|
4844
4753
|
},
|
|
4845
4754
|
}),
|
|
4846
4755
|
_vm._v(" "),
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4756
|
+
!_vm.isLangSpecific || _vm.values.language
|
|
4757
|
+
? _c("form-field-select", {
|
|
4758
|
+
attrs: {
|
|
4759
|
+
name: "parentCategory",
|
|
4760
|
+
label: _vm.$t("blog:parentCategory"),
|
|
4761
|
+
options: _vm.parentCategoryOptionList,
|
|
4762
|
+
error: _vm.errors.parent,
|
|
4763
|
+
},
|
|
4764
|
+
model: {
|
|
4765
|
+
value: _vm.values.parent,
|
|
4766
|
+
callback: function ($$v) {
|
|
4767
|
+
_vm.$set(_vm.values, "parent", $$v);
|
|
4768
|
+
},
|
|
4769
|
+
expression: "values.parent",
|
|
4770
|
+
},
|
|
4771
|
+
})
|
|
4772
|
+
: _vm._e(),
|
|
4862
4773
|
_vm._v(" "),
|
|
4863
4774
|
_c("form-field-url-alias-input", {
|
|
4864
4775
|
attrs: {
|
|
@@ -4868,6 +4779,7 @@
|
|
|
4868
4779
|
"url-template": _vm.pagePath,
|
|
4869
4780
|
error: _vm.errors.urlAlias,
|
|
4870
4781
|
},
|
|
4782
|
+
on: { change: _vm.handleAliasChange },
|
|
4871
4783
|
model: {
|
|
4872
4784
|
value: _vm.values.urlAlias,
|
|
4873
4785
|
callback: function ($$v) {
|
|
@@ -4925,21 +4837,23 @@
|
|
|
4925
4837
|
},
|
|
4926
4838
|
}),
|
|
4927
4839
|
_vm._v(" "),
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4840
|
+
!_vm.isLangSpecific || _vm.values.language
|
|
4841
|
+
? _c("form-field-select", {
|
|
4842
|
+
attrs: {
|
|
4843
|
+
name: "parentCategory",
|
|
4844
|
+
label: _vm.$t("blog:parentCategory"),
|
|
4845
|
+
options: _vm.parentCategoryOptionList,
|
|
4846
|
+
error: _vm.errors.parent,
|
|
4847
|
+
},
|
|
4848
|
+
model: {
|
|
4849
|
+
value: _vm.values.parent,
|
|
4850
|
+
callback: function ($$v) {
|
|
4851
|
+
_vm.$set(_vm.values, "parent", $$v);
|
|
4852
|
+
},
|
|
4853
|
+
expression: "values.parent",
|
|
4854
|
+
},
|
|
4855
|
+
})
|
|
4856
|
+
: _vm._e(),
|
|
4943
4857
|
_vm._v(" "),
|
|
4944
4858
|
_c("form-field-url-alias-input", {
|
|
4945
4859
|
attrs: {
|
|
@@ -5125,15 +5039,14 @@
|
|
|
5125
5039
|
exports.getBlogCategoryFormUrl = getBlogCategoryFormUrl;
|
|
5126
5040
|
exports.getBlogCategoryListUrl = getBlogCategoryListUrl;
|
|
5127
5041
|
exports.getBlogMenuItem = getBlogMenuItem;
|
|
5042
|
+
exports.getBlogPostCount = getBlogPostCount;
|
|
5128
5043
|
exports.getBlogPostFormUrl = getBlogPostFormUrl;
|
|
5129
5044
|
exports.getBlogPostListUrl = getBlogPostListUrl;
|
|
5130
5045
|
exports.getCategories = getCategories;
|
|
5131
5046
|
exports.getCategory = getCategory;
|
|
5132
|
-
exports.getCountPosts = getCountPosts;
|
|
5133
5047
|
exports.getModuleConfig = getModuleConfig;
|
|
5134
5048
|
exports.getPost = getPost;
|
|
5135
5049
|
exports.getPosts = getPosts;
|
|
5136
|
-
exports.getUserProfile = getUserProfile;
|
|
5137
5050
|
exports.moveCategory = moveCategory;
|
|
5138
5051
|
exports.updateBlogPost = updateBlogPost;
|
|
5139
5052
|
exports.updateCategory = updateCategory;
|
package/dist/locales/en.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Nullable, ResponseBody } from '@tager/admin-services';
|
|
2
2
|
import { FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
-
import { Category, ModuleConfig, PostShort, PostFull,
|
|
4
|
-
export declare function getUserProfile(): Promise<ResponseBody<UserModel>>;
|
|
3
|
+
import { Category, ModuleConfig, PostShort, PostFull, CategoryPayload } from '../typings/model';
|
|
5
4
|
/** Blog Posts */
|
|
6
5
|
export declare function getPosts(params?: {
|
|
7
6
|
query?: string;
|
|
8
7
|
pageNumber?: number;
|
|
9
8
|
pageSize?: number;
|
|
10
9
|
}): Promise<ResponseBody<PostShort[]>>;
|
|
11
|
-
export declare function
|
|
10
|
+
export declare function getBlogPostCount(): Promise<ResponseBody<{
|
|
12
11
|
count: number;
|
|
13
12
|
}>>;
|
|
14
13
|
export declare function getPost(postId: number | string): Promise<ResponseBody<PostFull>>;
|