Skip to content

Commit 977b475

Browse files
committed
moving sidebar links to config
1 parent 7ac9d4f commit 977b475

File tree

4 files changed

+93
-86
lines changed

4 files changed

+93
-86
lines changed

src/routes/main/components/Sidebar.vue

Lines changed: 6 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
mini-variant-width="60"
1111
>
1212
<v-list dense>
13-
<template v-if="checkRole(item.guard)" v-for="(item) in items">
13+
<template v-if="checkRole(item.guard)" v-for="(item) in sidebarItems">
1414
<v-list-group v-model="item.model" :key="item.text" :prepend-icon="item.icon"
1515
append-icon="">
1616
<v-list-tile slot="activator">
@@ -47,7 +47,7 @@ import { mapState, mapGetters, mapMutations } from "vuex";
4747
4848
export default {
4949
computed: {
50-
...mapState(["sidebarMini", "sidebar"]),
50+
...mapState(["sidebarMini", "sidebar", "sidebarItems"]),
5151
...mapGetters("auth", ["checkRole"])
5252
},
5353
props: {
@@ -65,87 +65,14 @@ export default {
6565
},
6666
mouseleave() {
6767
this.setSidebarWidth(true)
68+
for(let item of this.sidebarItems){
69+
item.model = false
70+
}
6871
}
6972
},
7073
data: () => ({
7174
setSidebarMini: false,
72-
dialog: false,
73-
items: [
74-
{
75-
icon: "people",
76-
text: "crm.name",
77-
model: false,
78-
guard: "CRM",
79-
route: "/crm",
80-
children: [
81-
{
82-
text: "crm.companies",
83-
route: "/companies"
84-
},
85-
{
86-
text: "crm.companyTypes",
87-
route: "/company-types"
88-
},
89-
{
90-
text: "crm.companyFiles",
91-
route: "/company-files"
92-
},
93-
{
94-
text: "crm.companyComments",
95-
route: "/company-comments"
96-
},
97-
{
98-
text: "crm.companyCommentTypes",
99-
route: "/company-comment-types"
100-
},
101-
{
102-
text: "crm.people",
103-
route: "/people"
104-
},
105-
{
106-
text: "crm.personComments",
107-
route: "/person-comments"
108-
},
109-
{
110-
text: "crm.personCommentTypes",
111-
route: "/person-comment-types"
112-
},
113-
{
114-
text: "crm.positions",
115-
route: "/positions"
116-
},
117-
{
118-
text: "crm.positionTasks",
119-
route: "/position-tasks"
120-
},
121-
{
122-
text: "crm.tasks",
123-
route: "/tasks"
124-
}
125-
]
126-
},
127-
{
128-
icon: "person_add_disabled",
129-
text: "admin.name",
130-
model: false,
131-
guard: "ADMIN",
132-
route: "/administration",
133-
children: [
134-
{
135-
text: "admin.users",
136-
route: "/users"
137-
},
138-
{
139-
text: "admin.permissions",
140-
route: "/permissions"
141-
},
142-
{
143-
text: "admin.userPermissions",
144-
route: "/user-permissions"
145-
}
146-
]
147-
}
148-
]
75+
dialog: false
14976
}),
15077
};
15178
</script>

src/store/state.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ let state = {
2323
},
2424
filesPath: configApi.url + configApi.path.files,
2525
logoLg: configParams.logoLg,
26-
logoSm: configParams.logoSm
26+
logoSm: configParams.logoSm,
27+
sidebarItems: configParams.sidebarItems
2728
}
2829

2930
export default state

templates/config/params.js

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ export const configParams = {
22
title: "Vue CRUD",
33
logoLg: 'vue-crud-lg.png',
44
logoSm: 'vue-crud-sm.png',
5-
locales: [
6-
{name: 'en', text: 'English'},
7-
{name: 'pl', text: 'Polski'},
5+
locales: [{
6+
name: 'en',
7+
text: 'English'
8+
},
9+
{
10+
name: 'pl',
11+
text: 'Polski'
12+
},
813
],
914
defaultLocale: 'en',
1015
localeSelectable: true,
@@ -19,5 +24,79 @@ export const configParams = {
1924
info: '#2196F3',
2025
success: '#4CAF50',
2126
warning: '#FFC107'
22-
}
23-
}
27+
},
28+
sidebarItems: [
29+
{
30+
icon: "people",
31+
text: "crm.name",
32+
model: false,
33+
guard: "CRM",
34+
route: "/crm",
35+
children: [{
36+
text: "crm.companies",
37+
route: "/companies"
38+
},
39+
{
40+
text: "crm.companyTypes",
41+
route: "/company-types"
42+
},
43+
{
44+
text: "crm.companyFiles",
45+
route: "/company-files"
46+
},
47+
{
48+
text: "crm.companyComments",
49+
route: "/company-comments"
50+
},
51+
{
52+
text: "crm.companyCommentTypes",
53+
route: "/company-comment-types"
54+
},
55+
{
56+
text: "crm.people",
57+
route: "/people"
58+
},
59+
{
60+
text: "crm.personComments",
61+
route: "/person-comments"
62+
},
63+
{
64+
text: "crm.personCommentTypes",
65+
route: "/person-comment-types"
66+
},
67+
{
68+
text: "crm.positions",
69+
route: "/positions"
70+
},
71+
{
72+
text: "crm.positionTasks",
73+
route: "/position-tasks"
74+
},
75+
{
76+
text: "crm.tasks",
77+
route: "/tasks"
78+
}
79+
]
80+
},
81+
{
82+
icon: "person_add_disabled",
83+
text: "admin.name",
84+
model: false,
85+
guard: "ADMIN",
86+
route: "/administration",
87+
children: [{
88+
text: "admin.users",
89+
route: "/users"
90+
},
91+
{
92+
text: "admin.permissions",
93+
route: "/permissions"
94+
},
95+
{
96+
text: "admin.userPermissions",
97+
route: "/user-permissions"
98+
}
99+
]
100+
}
101+
]
102+
}

templates/locales/en/alerts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
updated: 'Updated',
33
updateError: 'Error! Update unsuccessful',
4-
stored: 'Dodano',
4+
stored: 'Stored',
55
storeError: 'Error! Store unsuccessful',
66
suspended: 'Suspended',
77
suspendError: 'Error! Suspend unsuccessful',

0 commit comments

Comments
 (0)