@tager/admin-blog 0.3.21 → 0.3.25
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/index.esm.js +3452 -612
- package/dist/index.umd.js +3454 -619
- package/package.json +13 -7
- package/src/constants/menu.ts +0 -2
- package/src/constants/paths.ts +0 -5
- package/src/constants/routes.ts +5 -18
- package/src/constants/scopes.ts +11 -0
- package/src/dev.ts +11 -44
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useBlogCategoryList.ts +3 -5
- package/src/hooks/useBlogPostList.ts +2 -4
- package/src/hooks/useModuleConfig.ts +4 -8
- package/src/hooks/useStore.ts +8 -0
- package/src/hooks/useUserPermission.ts +16 -0
- package/src/hooks/useUserProfile.ts +13 -0
- package/src/locales/en.ts +17 -5
- package/src/locales/ru.ts +17 -4
- package/src/router/index.ts +39 -0
- package/src/services/requests.ts +33 -43
- package/src/store/index.ts +21 -0
- package/src/store/user.ts +109 -0
- package/src/typings/common.ts +1 -0
- package/src/typings/model.ts +62 -38
- package/src/utils/common.ts +23 -0
- package/src/views/App.vue +10 -4
- package/src/views/{BlogCategoryForm/BlogCategoryForm.helpers.ts → Categories/CategoryForm/CategoryForm.helpers.ts} +22 -7
- package/src/views/{BlogCategoryForm/BlogCategoryForm.vue → Categories/CategoryForm/CategoryForm.vue} +140 -63
- package/src/views/Categories/CategoryForm/index.ts +1 -0
- package/src/views/Categories/CategoryList/CategoryList.helpers.ts +91 -0
- package/src/views/Categories/CategoryList/CategoryList.vue +269 -0
- package/src/views/Categories/CategoryList/hooks/index.ts +1 -0
- package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +95 -0
- package/src/views/Categories/CategoryList/index.ts +1 -0
- package/src/views/Home.vue +2 -9
- package/src/views/Posts/PostForm/PostForm.helpers.ts +150 -0
- package/src/views/Posts/PostForm/PostForm.vue +550 -0
- package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.types.ts +0 -0
- package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.vue +1 -1
- package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/index.ts +0 -0
- package/src/views/Posts/PostForm/index.ts +1 -0
- package/src/views/{BlogPostList/BlogPostList.helpers.ts → Posts/PostList/PostList.helpers.ts} +10 -18
- package/src/views/Posts/PostList/PostList.vue +361 -0
- package/src/views/Posts/PostList/hooks/index.ts +1 -0
- package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +250 -0
- package/src/views/Posts/PostList/index.ts +1 -0
- package/dist/constants/menu.d.ts +0 -5
- package/dist/constants/paths.d.ts +0 -16
- package/dist/constants/routes.d.ts +0 -6
- package/dist/dev.d.ts +0 -3
- package/dist/hooks/useBlogCategoryList.d.ts +0 -7
- package/dist/hooks/useBlogPostList.d.ts +0 -7
- package/dist/hooks/useModuleConfig.d.ts +0 -7
- package/dist/locales/en.d.ts +0 -63
- package/dist/locales/ru.d.ts +0 -3
- package/dist/main.d.ts +0 -4
- package/dist/services/requests.d.ts +0 -68
- package/dist/typings/model.d.ts +0 -74
- package/dist/views/BlogCategoryForm/BlogCategoryForm.helpers.d.ts +0 -16
- package/dist/views/BlogCategoryForm/BlogCategoryForm.vue.d.ts +0 -86
- package/dist/views/BlogCategoryForm/index.d.ts +0 -1
- package/dist/views/BlogCategoryList/BlogCategoryList.helpers.d.ts +0 -6
- package/dist/views/BlogCategoryList/BlogCategoryList.vue.d.ts +0 -3
- package/dist/views/BlogCategoryList/index.d.ts +0 -1
- package/dist/views/BlogPostForm/BlogPostForm.helpers.d.ts +0 -27
- package/dist/views/BlogPostForm/BlogPostForm.vue.d.ts +0 -9320
- package/dist/views/BlogPostForm/components/TabList/TabList.types.d.ts +0 -5
- package/dist/views/BlogPostForm/components/TabList/index.d.ts +0 -2
- package/dist/views/BlogPostForm/index.d.ts +0 -1
- package/dist/views/BlogPostList/BlogPostList.helpers.d.ts +0 -6
- package/dist/views/BlogPostList/BlogPostList.vue.d.ts +0 -45
- package/dist/views/BlogPostList/index.d.ts +0 -1
- package/dist/views/BlogSettings/BlogSettings.helpers.d.ts +0 -6
- package/dist/views/BlogSettings/BlogSettings.vue.d.ts +0 -9132
- package/dist/views/BlogSettings/index.d.ts +0 -1
- package/src/views/BlogCategoryForm/index.ts +0 -1
- package/src/views/BlogCategoryList/BlogCategoryList.helpers.ts +0 -82
- package/src/views/BlogCategoryList/BlogCategoryList.vue +0 -196
- package/src/views/BlogCategoryList/index.ts +0 -1
- package/src/views/BlogPostForm/BlogPostForm.helpers.ts +0 -152
- package/src/views/BlogPostForm/BlogPostForm.vue +0 -534
- package/src/views/BlogPostForm/index.ts +0 -1
- package/src/views/BlogPostList/BlogPostList.vue +0 -174
- package/src/views/BlogPostList/index.ts +0 -1
- package/src/views/BlogSettings/BlogSettings.helpers.ts +0 -25
- package/src/views/BlogSettings/BlogSettings.vue +0 -110
- package/src/views/BlogSettings/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tager/admin-blog",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -19,15 +19,20 @@
|
|
|
19
19
|
"yalc:clean": "yalc remove --all"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"
|
|
22
|
+
"lodash.isequal": "^4.5.0",
|
|
23
|
+
"lodash.pick": "^4.4.0",
|
|
24
|
+
"path-to-regexp": "^6.1.0",
|
|
25
|
+
"vuex": "^3.6.2"
|
|
23
26
|
},
|
|
24
27
|
"devDependencies": {
|
|
25
28
|
"@rollup/plugin-commonjs": "^15.0.0",
|
|
26
29
|
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
27
|
-
"@tager/admin-dynamic-field": "^0.1.
|
|
28
|
-
"@tager/admin-layout": "^0.
|
|
29
|
-
"@tager/admin-services": "^0.2.
|
|
30
|
-
"@tager/admin-ui": "^0.8.
|
|
30
|
+
"@tager/admin-dynamic-field": "^0.1.18",
|
|
31
|
+
"@tager/admin-layout": "^0.5.3",
|
|
32
|
+
"@tager/admin-services": "^0.2.26",
|
|
33
|
+
"@tager/admin-ui": "^0.8.85",
|
|
34
|
+
"@types/lodash.isequal": "^4.5.5",
|
|
35
|
+
"@types/lodash.pick": "^4.4.6",
|
|
31
36
|
"@types/node": "12.x",
|
|
32
37
|
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
|
33
38
|
"@typescript-eslint/parser": "^2.26.0",
|
|
@@ -35,6 +40,7 @@
|
|
|
35
40
|
"@vue/cli-plugin-eslint": "~4.5.6",
|
|
36
41
|
"@vue/cli-plugin-router": "~4.5.6",
|
|
37
42
|
"@vue/cli-plugin-typescript": "~4.5.6",
|
|
43
|
+
"@vue/cli-plugin-vuex": "^4.5.14",
|
|
38
44
|
"@vue/cli-service": "~4.5.6",
|
|
39
45
|
"@vue/composition-api": "^1.0.0-beta.14",
|
|
40
46
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
@@ -50,7 +56,7 @@
|
|
|
50
56
|
"rollup-plugin-typescript2": "^0.27.2",
|
|
51
57
|
"rollup-plugin-vue": "^5.1.9",
|
|
52
58
|
"sass-loader": "^10.0.2",
|
|
53
|
-
"typescript": "~3.9.
|
|
59
|
+
"typescript": "~3.9.10",
|
|
54
60
|
"vue": "2.6.x",
|
|
55
61
|
"vue-router": "^3.5.1",
|
|
56
62
|
"vue-template-compiler": "^2.6.11"
|
package/src/constants/menu.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
getBlogCategoryListUrl,
|
|
7
7
|
getBlogPostFormUrl,
|
|
8
8
|
getBlogPostListUrl,
|
|
9
|
-
getBlogSettingsUrl,
|
|
10
9
|
} from './paths';
|
|
11
10
|
|
|
12
11
|
export function getBlogMenuItem(params: {
|
|
@@ -27,7 +26,6 @@ export function getBlogMenuItem(params: {
|
|
|
27
26
|
url: getBlogCategoryFormUrl({ categoryId: 'create' }),
|
|
28
27
|
},
|
|
29
28
|
{ text: params.t('blog:categories'), url: getBlogCategoryListUrl() },
|
|
30
|
-
{ text: params.t('blog:settings'), url: getBlogSettingsUrl() },
|
|
31
29
|
],
|
|
32
30
|
};
|
|
33
31
|
}
|
package/src/constants/paths.ts
CHANGED
|
@@ -5,7 +5,6 @@ export const BLOG_ROUTE_PATHS = {
|
|
|
5
5
|
POST_FORM: '/blog/posts/:postId',
|
|
6
6
|
CATEGORY_LIST: '/blog/categories',
|
|
7
7
|
CATEGORY_FORM: '/blog/categories/:categoryId',
|
|
8
|
-
SETTINGS: '/blog/settings',
|
|
9
8
|
} as const;
|
|
10
9
|
|
|
11
10
|
export function getBlogPostListUrl() {
|
|
@@ -27,7 +26,3 @@ export function getBlogCategoryFormUrl(params: {
|
|
|
27
26
|
categoryId: params.categoryId,
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
export function getBlogSettingsUrl() {
|
|
32
|
-
return BLOG_ROUTE_PATHS.SETTINGS;
|
|
33
|
-
}
|
package/src/constants/routes.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CustomRoute, CustomRouteConfig } from '@tager/admin-layout';
|
|
2
2
|
|
|
3
|
-
import BlogPostList from '../views/
|
|
4
|
-
import BlogPostForm from '../views/
|
|
5
|
-
import BlogCategoryList from '../views/
|
|
6
|
-
import BlogCategoryForm from '../views/
|
|
7
|
-
import BlogSettings from '../views/BlogSettings';
|
|
3
|
+
import BlogPostList from '../views/Posts/PostList';
|
|
4
|
+
import BlogPostForm from '../views/Posts/PostForm';
|
|
5
|
+
import BlogCategoryList from '../views/Categories/CategoryList';
|
|
6
|
+
import BlogCategoryForm from '../views/Categories/CategoryForm';
|
|
8
7
|
|
|
9
|
-
import { BLOG_ROUTE_PATHS
|
|
8
|
+
import { BLOG_ROUTE_PATHS } from './paths';
|
|
10
9
|
|
|
11
10
|
export const BLOG_POST_LIST_ROUTE: CustomRouteConfig = {
|
|
12
11
|
path: BLOG_ROUTE_PATHS.POST_LIST,
|
|
@@ -57,15 +56,3 @@ export const BLOG_CATEGORY_FORM_ROUTE: CustomRouteConfig = {
|
|
|
57
56
|
],
|
|
58
57
|
},
|
|
59
58
|
};
|
|
60
|
-
|
|
61
|
-
export const BLOG_SETTINGS_ROUTE: CustomRouteConfig = {
|
|
62
|
-
path: BLOG_ROUTE_PATHS.SETTINGS,
|
|
63
|
-
component: BlogSettings,
|
|
64
|
-
name: 'Settings',
|
|
65
|
-
meta: {
|
|
66
|
-
getBreadcrumbs: (route, t) => [
|
|
67
|
-
{ url: '/', text: t('blog:home') },
|
|
68
|
-
{ url: getBlogSettingsUrl(), text: t('blog:blogSettings') },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const Scope = {
|
|
2
|
+
All: '*',
|
|
3
|
+
OrdersCreate: 'orders.create',
|
|
4
|
+
OrdersView: 'orders.view',
|
|
5
|
+
OrdersDelete: 'orders.delete',
|
|
6
|
+
RbacViewRoles: 'rbac.view-roles',
|
|
7
|
+
RbacEditRoles: 'rbac.edit-roles',
|
|
8
|
+
AdministratorsView: 'administrators.view',
|
|
9
|
+
AdministratorsEdit: 'administrators.edit',
|
|
10
|
+
AdministratorsDelete: 'administrators.delete',
|
|
11
|
+
} as const;
|
package/src/dev.ts
CHANGED
|
@@ -1,69 +1,36 @@
|
|
|
1
1
|
import Vue, { CreateElement } from 'vue';
|
|
2
2
|
import VueCompositionApi, { createApp } from '@vue/composition-api';
|
|
3
|
+
import Vuex from 'vuex';
|
|
3
4
|
|
|
4
5
|
import { configStore, i18n } from '@tager/admin-services';
|
|
5
6
|
import { AdminUiPlugin } from '@tager/admin-ui';
|
|
6
|
-
import {
|
|
7
|
-
AdminLayoutPlugin,
|
|
8
|
-
createRouter,
|
|
9
|
-
CustomRoute,
|
|
10
|
-
CustomRouteConfig,
|
|
11
|
-
} from '@tager/admin-layout';
|
|
7
|
+
import { AdminLayoutPlugin } from '@tager/admin-layout';
|
|
12
8
|
|
|
13
9
|
import '@tager/admin-ui/dist/admin-ui.css';
|
|
14
10
|
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from './constants/routes';
|
|
22
|
-
import config from './config/config.json';
|
|
23
|
-
import App from './views/App.vue';
|
|
24
|
-
import Home from './views/Home.vue';
|
|
25
|
-
import EN from './locales/en';
|
|
26
|
-
import RU from './locales/ru';
|
|
11
|
+
import config from '@/config/config.json';
|
|
12
|
+
import App from '@/views/App.vue';
|
|
13
|
+
import EN from '@/locales/en';
|
|
14
|
+
import RU from '@/locales/ru';
|
|
15
|
+
import router from '@/router';
|
|
16
|
+
import store from '@/store';
|
|
27
17
|
|
|
28
18
|
configStore.setConfig(config);
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
path: '/',
|
|
32
|
-
component: Home,
|
|
33
|
-
name: 'Home',
|
|
34
|
-
meta: {
|
|
35
|
-
getBreadcrumbs: (route: CustomRoute) => [
|
|
36
|
-
{ url: '/', text: route.name ?? '' },
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const router = createRouter(
|
|
42
|
-
{
|
|
43
|
-
routes: [
|
|
44
|
-
HOME_ROUTE,
|
|
45
|
-
BLOG_POST_LIST_ROUTE,
|
|
46
|
-
BLOG_POST_FORM_ROUTE,
|
|
47
|
-
BLOG_CATEGORY_LIST_ROUTE,
|
|
48
|
-
BLOG_CATEGORY_FORM_ROUTE,
|
|
49
|
-
BLOG_SETTINGS_ROUTE,
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
{ useTitleSync: false }
|
|
53
|
-
);
|
|
20
|
+
Vue.use(VueCompositionApi);
|
|
54
21
|
|
|
55
22
|
i18n.addTranslations('en', 'blog', EN);
|
|
56
23
|
i18n.addTranslations('ru', 'blog', RU);
|
|
57
24
|
|
|
58
25
|
i18n.init({ debug: false }).then(() => {
|
|
59
|
-
Vue.use(VueCompositionApi);
|
|
60
|
-
|
|
61
26
|
const app = createApp({
|
|
62
27
|
router,
|
|
63
28
|
render: (h: CreateElement) => h(App),
|
|
29
|
+
store,
|
|
64
30
|
});
|
|
65
31
|
|
|
66
32
|
app.use(i18n.getPlugin());
|
|
33
|
+
app.use(Vuex);
|
|
67
34
|
app.use(AdminUiPlugin);
|
|
68
35
|
app.use(AdminLayoutPlugin);
|
|
69
36
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useModuleConfig } from './useModuleConfig';
|
|
2
|
+
export { useBlogPostList } from './useBlogPostList';
|
|
3
|
+
export { useBlogCategoryList } from './useBlogCategoryList';
|
|
4
|
+
export { useStore } from './useStore';
|
|
5
|
+
export { useUserProfile } from './useUserProfile';
|
|
6
|
+
export { useUserPermission } from './useUserPermission';
|
|
@@ -2,13 +2,13 @@ import { onMounted, SetupContext } from '@vue/composition-api';
|
|
|
2
2
|
|
|
3
3
|
import { ResourceRef, useResource } from '@tager/admin-services';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Category } from '../typings/model';
|
|
6
6
|
import { getBlogCategoryList } from '../services/requests';
|
|
7
7
|
|
|
8
8
|
export function useBlogCategoryList(params: {
|
|
9
9
|
context: SetupContext;
|
|
10
|
-
}): ResourceRef<
|
|
11
|
-
const [fetchBlogCategoryList, resource] = useResource<
|
|
10
|
+
}): ResourceRef<Category[]> {
|
|
11
|
+
const [fetchBlogCategoryList, resource] = useResource<Category[]>({
|
|
12
12
|
fetchResource: getBlogCategoryList,
|
|
13
13
|
initialValue: [],
|
|
14
14
|
context: params.context,
|
|
@@ -21,5 +21,3 @@ export function useBlogCategoryList(params: {
|
|
|
21
21
|
|
|
22
22
|
return resource;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export default useBlogCategoryList;
|
|
@@ -7,8 +7,8 @@ import { getBlogPostList } from '../services/requests';
|
|
|
7
7
|
|
|
8
8
|
export function useBlogPostList(params: {
|
|
9
9
|
context: SetupContext;
|
|
10
|
-
}): ResourceRef<
|
|
11
|
-
const [fetchBlogPostList, resource] = useResource<
|
|
10
|
+
}): ResourceRef<PostShort[]> {
|
|
11
|
+
const [fetchBlogPostList, resource] = useResource<PostShort[]>({
|
|
12
12
|
fetchResource: () => getBlogPostList({ pageNumber: 1, pageSize: 99999 }),
|
|
13
13
|
initialValue: [],
|
|
14
14
|
context: params.context,
|
|
@@ -21,5 +21,3 @@ export function useBlogPostList(params: {
|
|
|
21
21
|
|
|
22
22
|
return resource;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export default useBlogPostList;
|
|
@@ -2,15 +2,13 @@ import { onMounted, SetupContext } from '@vue/composition-api';
|
|
|
2
2
|
|
|
3
3
|
import { Nullable, ResourceRef, useResource } from '@tager/admin-services';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { getBlogModuleConfig } from '
|
|
5
|
+
import { ModuleConfig } from '@/typings/model';
|
|
6
|
+
import { getBlogModuleConfig } from '@/services/requests';
|
|
7
7
|
|
|
8
8
|
export function useModuleConfig(params: {
|
|
9
9
|
context: SetupContext;
|
|
10
|
-
}): ResourceRef<Nullable<
|
|
11
|
-
const [fetchModuleConfig, resource] = useResource<
|
|
12
|
-
Nullable<BlogModuleConfigType>
|
|
13
|
-
>({
|
|
10
|
+
}): ResourceRef<Nullable<ModuleConfig>> {
|
|
11
|
+
const [fetchModuleConfig, resource] = useResource<Nullable<ModuleConfig>>({
|
|
14
12
|
fetchResource: getBlogModuleConfig,
|
|
15
13
|
initialValue: null,
|
|
16
14
|
context: params.context,
|
|
@@ -23,5 +21,3 @@ export function useModuleConfig(params: {
|
|
|
23
21
|
|
|
24
22
|
return resource;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
export default useModuleConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computed, ComputedRef, SetupContext } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { ScopeType } from '@/typings/model';
|
|
4
|
+
import { useStore } from '@/hooks/useStore';
|
|
5
|
+
import { userNamespace } from '@/utils/common';
|
|
6
|
+
|
|
7
|
+
export function useUserPermission(
|
|
8
|
+
context: SetupContext,
|
|
9
|
+
scope: ScopeType
|
|
10
|
+
): ComputedRef<boolean> {
|
|
11
|
+
const store = useStore(context);
|
|
12
|
+
|
|
13
|
+
return computed<boolean>(() => {
|
|
14
|
+
return store.getters[userNamespace('userHasPermission')](scope);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { computed, ComputedRef, SetupContext } from '@vue/composition-api';
|
|
2
|
+
|
|
3
|
+
import { UserModel } from '@/typings/model';
|
|
4
|
+
import { useStore } from '@/hooks/useStore';
|
|
5
|
+
import { userNamespace } from '@/utils/common';
|
|
6
|
+
|
|
7
|
+
export function useUserProfile(context: SetupContext): ComputedRef<UserModel> {
|
|
8
|
+
const store = useStore(context);
|
|
9
|
+
|
|
10
|
+
return computed<UserModel>(() => {
|
|
11
|
+
return store.getters[userNamespace('userProfile')];
|
|
12
|
+
});
|
|
13
|
+
}
|
package/src/locales/en.ts
CHANGED
|
@@ -6,18 +6,13 @@ const EN = {
|
|
|
6
6
|
categories: 'Categories',
|
|
7
7
|
createPost: 'Create post',
|
|
8
8
|
createCategory: 'Create category',
|
|
9
|
-
settings: 'Settings',
|
|
10
9
|
home: 'Home',
|
|
11
10
|
allPosts: 'All posts',
|
|
12
11
|
postForm: 'Post Form',
|
|
13
12
|
allCategories: 'All categories',
|
|
14
13
|
categoryForm: 'Category Form',
|
|
15
|
-
blogSettings: 'Blog settings',
|
|
16
14
|
success: 'Success',
|
|
17
|
-
blogSettingsHaveBeenSuccessfullyUpdated:
|
|
18
|
-
'Blog settings have been successfully updated',
|
|
19
15
|
error: 'Error',
|
|
20
|
-
blogSettingsUpdateHasBeenFailed: 'Blog settings update has been failed',
|
|
21
16
|
newPost: 'New Post',
|
|
22
17
|
edit: 'Edit',
|
|
23
18
|
remove: 'Remove',
|
|
@@ -25,7 +20,14 @@ const EN = {
|
|
|
25
20
|
name: 'Name',
|
|
26
21
|
image: 'Image',
|
|
27
22
|
language: 'Language',
|
|
23
|
+
languages: 'Languages',
|
|
28
24
|
date: 'Date',
|
|
25
|
+
dateOfPublication: 'Date of publication',
|
|
26
|
+
from: 'from',
|
|
27
|
+
to: 'to',
|
|
28
|
+
From: 'From',
|
|
29
|
+
To: 'To',
|
|
30
|
+
category: 'Category',
|
|
29
31
|
actions: 'Actions',
|
|
30
32
|
updatePost: 'Update post',
|
|
31
33
|
title: 'Title',
|
|
@@ -60,6 +62,16 @@ const EN = {
|
|
|
60
62
|
blogCategoryWasSuccessfullyUpdated: 'Blog category was successfully updated',
|
|
61
63
|
blogCategoryCreationWasFailed: 'Blog category creation was failed',
|
|
62
64
|
blogCategoryUpdateWasFailed: 'Blog category update was failed',
|
|
65
|
+
|
|
66
|
+
clone: 'Clone',
|
|
67
|
+
cloneConfirm: 'Are you sure you want to clone the page?',
|
|
68
|
+
cloneSuccess: 'Page have copied successfully',
|
|
69
|
+
cloneFailure: 'Page copy failure',
|
|
70
|
+
|
|
71
|
+
tabs: {
|
|
72
|
+
common: 'Common',
|
|
73
|
+
seo: 'SEO',
|
|
74
|
+
},
|
|
63
75
|
};
|
|
64
76
|
|
|
65
77
|
export default EN;
|
package/src/locales/ru.ts
CHANGED
|
@@ -8,17 +8,13 @@ const RU: typeof EN = {
|
|
|
8
8
|
categories: 'Категории',
|
|
9
9
|
createPost: 'Создать пост',
|
|
10
10
|
createCategory: 'Создать категорию',
|
|
11
|
-
settings: 'Настройки',
|
|
12
11
|
home: 'Главная',
|
|
13
12
|
allPosts: 'Все посты',
|
|
14
13
|
postForm: 'Форма поста',
|
|
15
14
|
allCategories: 'Все категории',
|
|
16
15
|
categoryForm: 'Форма категории',
|
|
17
|
-
blogSettings: 'Настройки блога',
|
|
18
16
|
success: 'Успех',
|
|
19
|
-
blogSettingsHaveBeenSuccessfullyUpdated: 'Настройки блога успешно обновлены',
|
|
20
17
|
error: 'Ошибка',
|
|
21
|
-
blogSettingsUpdateHasBeenFailed: 'Не удалось обновить настройки блога',
|
|
22
18
|
newPost: 'Новый пост',
|
|
23
19
|
edit: 'Редактировать',
|
|
24
20
|
remove: 'Удалить',
|
|
@@ -26,7 +22,14 @@ const RU: typeof EN = {
|
|
|
26
22
|
name: 'Имя',
|
|
27
23
|
image: 'Изображение',
|
|
28
24
|
language: 'Язык',
|
|
25
|
+
languages: 'Языки',
|
|
29
26
|
date: 'Дата',
|
|
27
|
+
dateOfPublication: 'Дата публикации',
|
|
28
|
+
from: 'от',
|
|
29
|
+
to: 'до',
|
|
30
|
+
From: 'От',
|
|
31
|
+
To: 'До',
|
|
32
|
+
category: 'Категория',
|
|
30
33
|
actions: 'Действия',
|
|
31
34
|
updatePost: 'Обновить пост',
|
|
32
35
|
title: 'Заголовок',
|
|
@@ -61,6 +64,16 @@ const RU: typeof EN = {
|
|
|
61
64
|
blogCategoryWasSuccessfullyUpdated: 'Категория блога успешно обновлена',
|
|
62
65
|
blogCategoryCreationWasFailed: 'Не удалось создать категорию блога',
|
|
63
66
|
blogCategoryUpdateWasFailed: 'Не удалось обновить категорию блога',
|
|
67
|
+
|
|
68
|
+
clone: 'Клонировать',
|
|
69
|
+
cloneConfirm: 'Вы уверены, что хотите создать копию страницы?',
|
|
70
|
+
cloneSuccess: 'Копия страницы успешно создана',
|
|
71
|
+
cloneFailure: 'Ошибка копирования страницы',
|
|
72
|
+
|
|
73
|
+
tabs: {
|
|
74
|
+
common: 'Общие',
|
|
75
|
+
seo: 'SEO',
|
|
76
|
+
},
|
|
64
77
|
};
|
|
65
78
|
|
|
66
79
|
export default RU;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRouter,
|
|
3
|
+
CustomRoute,
|
|
4
|
+
CustomRouteConfig,
|
|
5
|
+
} from '@tager/admin-layout';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
BLOG_CATEGORY_FORM_ROUTE,
|
|
9
|
+
BLOG_CATEGORY_LIST_ROUTE,
|
|
10
|
+
BLOG_POST_FORM_ROUTE,
|
|
11
|
+
BLOG_POST_LIST_ROUTE,
|
|
12
|
+
} from '@/constants/routes';
|
|
13
|
+
import Home from '@/views/Home.vue';
|
|
14
|
+
|
|
15
|
+
export const HOME_ROUTE: CustomRouteConfig = {
|
|
16
|
+
path: '/',
|
|
17
|
+
component: Home,
|
|
18
|
+
name: 'Home',
|
|
19
|
+
meta: {
|
|
20
|
+
getBreadcrumbs: (route: CustomRoute) => [
|
|
21
|
+
{ url: '/', text: route.name ?? '' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const router = createRouter(
|
|
27
|
+
{
|
|
28
|
+
routes: [
|
|
29
|
+
HOME_ROUTE,
|
|
30
|
+
BLOG_POST_LIST_ROUTE,
|
|
31
|
+
BLOG_POST_FORM_ROUTE,
|
|
32
|
+
BLOG_CATEGORY_LIST_ROUTE,
|
|
33
|
+
BLOG_CATEGORY_FORM_ROUTE,
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{ useTitleSync: false }
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export default router;
|
package/src/services/requests.ts
CHANGED
|
@@ -2,12 +2,16 @@ import { request, Nullable, ResponseBody } from '@tager/admin-services';
|
|
|
2
2
|
import { FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Category,
|
|
6
|
+
ModuleConfig,
|
|
7
7
|
PostShort,
|
|
8
8
|
PostFull,
|
|
9
|
-
|
|
10
|
-
} from '
|
|
9
|
+
UserModel,
|
|
10
|
+
} from '@/typings/model';
|
|
11
|
+
|
|
12
|
+
export function getUserProfile(): Promise<ResponseBody<UserModel>> {
|
|
13
|
+
return request.get({ path: '/admin/self' });
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
/** Blog Posts */
|
|
13
17
|
|
|
@@ -15,7 +19,7 @@ export function getBlogPostList(params?: {
|
|
|
15
19
|
query?: string;
|
|
16
20
|
pageNumber?: number;
|
|
17
21
|
pageSize?: number;
|
|
18
|
-
}): Promise<ResponseBody<
|
|
22
|
+
}): Promise<ResponseBody<PostShort[]>> {
|
|
19
23
|
return request.get({ path: '/admin/blog/posts', params });
|
|
20
24
|
}
|
|
21
25
|
|
|
@@ -29,7 +33,13 @@ export function getBlogPost(
|
|
|
29
33
|
return request.get({ path: `/admin/blog/posts/${postId}` });
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
export
|
|
36
|
+
export function clonePost(
|
|
37
|
+
postId: number | string
|
|
38
|
+
): Promise<ResponseBody<PostFull>> {
|
|
39
|
+
return request.post({ path: `/admin/blog/posts/${postId}/clone` });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PostCreationPayload {
|
|
33
43
|
title: string;
|
|
34
44
|
urlAlias: string;
|
|
35
45
|
excerpt: string;
|
|
@@ -42,12 +52,12 @@ export type PostCreationPayload = {
|
|
|
42
52
|
pageTitle: string;
|
|
43
53
|
pageDescription: string;
|
|
44
54
|
openGraphImage: Nullable<string>;
|
|
45
|
-
categories:
|
|
55
|
+
categories: number[];
|
|
46
56
|
language: Nullable<string>;
|
|
47
|
-
relatedPosts:
|
|
48
|
-
tags:
|
|
49
|
-
additionalFields:
|
|
50
|
-
}
|
|
57
|
+
relatedPosts: number[];
|
|
58
|
+
tags: string[];
|
|
59
|
+
additionalFields: FieldShortType<OutgoingValueUnion>[];
|
|
60
|
+
}
|
|
51
61
|
|
|
52
62
|
export function createBlogPost(
|
|
53
63
|
payload: PostCreationPayload
|
|
@@ -74,30 +84,32 @@ export function deleteBlogPost(
|
|
|
74
84
|
|
|
75
85
|
/** Blog Categories */
|
|
76
86
|
|
|
77
|
-
export function getBlogCategoryList(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
export function getBlogCategoryList(params?: {
|
|
88
|
+
query?: string;
|
|
89
|
+
pageNumber?: number;
|
|
90
|
+
pageSize?: number;
|
|
91
|
+
}): Promise<ResponseBody<Category[]>> {
|
|
92
|
+
return request.get({ path: '/admin/blog/categories', params });
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
export function getBlogCategory(
|
|
84
96
|
categoryId: number | string
|
|
85
|
-
): Promise<ResponseBody<
|
|
97
|
+
): Promise<ResponseBody<Category>> {
|
|
86
98
|
return request.get({ path: `/admin/blog/categories/${categoryId}` });
|
|
87
99
|
}
|
|
88
100
|
|
|
89
|
-
export
|
|
101
|
+
export interface BlogCategoryCreationPayload {
|
|
90
102
|
name: string;
|
|
91
103
|
isDefault: boolean;
|
|
92
104
|
pageTitle: Nullable<string>;
|
|
93
105
|
language: Nullable<string>;
|
|
94
106
|
pageDescription: Nullable<string>;
|
|
95
107
|
openGraphImage: Nullable<string>;
|
|
96
|
-
}
|
|
108
|
+
}
|
|
97
109
|
|
|
98
110
|
export function createBlogCategory(
|
|
99
111
|
payload: BlogCategoryCreationPayload
|
|
100
|
-
): Promise<ResponseBody<
|
|
112
|
+
): Promise<ResponseBody<Category>> {
|
|
101
113
|
return request.post({ path: '/admin/blog/categories', body: payload });
|
|
102
114
|
}
|
|
103
115
|
|
|
@@ -108,7 +120,7 @@ export type BlogCategoryUpdatePayload = BlogCategoryCreationPayload & {
|
|
|
108
120
|
export function updateBlogCategory(
|
|
109
121
|
categoryId: number | string,
|
|
110
122
|
payload: BlogCategoryUpdatePayload
|
|
111
|
-
): Promise<ResponseBody<
|
|
123
|
+
): Promise<ResponseBody<Category>> {
|
|
112
124
|
return request.put({
|
|
113
125
|
path: `/admin/blog/categories/${categoryId}`,
|
|
114
126
|
body: payload,
|
|
@@ -132,30 +144,8 @@ export function moveBlogCategory(
|
|
|
132
144
|
});
|
|
133
145
|
}
|
|
134
146
|
|
|
135
|
-
export function getBlogModuleConfig(): Promise<
|
|
136
|
-
ResponseBody<BlogModuleConfigType>
|
|
137
|
-
> {
|
|
147
|
+
export function getBlogModuleConfig(): Promise<ResponseBody<ModuleConfig>> {
|
|
138
148
|
return request.get({
|
|
139
149
|
path: `/admin/blog/module-info`,
|
|
140
150
|
});
|
|
141
151
|
}
|
|
142
|
-
|
|
143
|
-
export function getBlogSettingList(): Promise<
|
|
144
|
-
ResponseBody<Array<SettingItemType>>
|
|
145
|
-
> {
|
|
146
|
-
return request.get({
|
|
147
|
-
path: `/admin/blog/settings`,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type SettingsUpdatePayload = {
|
|
152
|
-
values: Array<FieldShortType<OutgoingValueUnion>>;
|
|
153
|
-
};
|
|
154
|
-
export function updateBlogSettingList(
|
|
155
|
-
payload: SettingsUpdatePayload
|
|
156
|
-
): Promise<ResponseBody<Array<SettingItemType>>> {
|
|
157
|
-
return request.post({
|
|
158
|
-
path: `/admin/blog/settings`,
|
|
159
|
-
body: payload,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import Vuex from 'vuex';
|
|
3
|
+
|
|
4
|
+
import userModule, {
|
|
5
|
+
USER_MODULE_NAMESPACE,
|
|
6
|
+
UserModuleStateModel,
|
|
7
|
+
} from '@/store/user';
|
|
8
|
+
|
|
9
|
+
Vue.use(Vuex);
|
|
10
|
+
|
|
11
|
+
export interface RootState {
|
|
12
|
+
user: UserModuleStateModel;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const store = new Vuex.Store({
|
|
16
|
+
modules: {
|
|
17
|
+
[USER_MODULE_NAMESPACE]: userModule,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export default store;
|