Skip to content

Commit

Permalink
Breadcrumbs refactor
Browse files Browse the repository at this point in the history
Added personal area breadcrumbs and users breadcrumb
  • Loading branch information
Okeanij committed Jan 19, 2020
1 parent 728bd97 commit b6408ec
Show file tree
Hide file tree
Showing 64 changed files with 219 additions and 130 deletions.
2 changes: 1 addition & 1 deletion Client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sunengine-client",
"version": "2.2.5",
"version": "2.2.6",
"description": "SunEngine - web engine with support of blog, forum and articles functionality",
"productName": "SunEngine",
"author": "Dimitrij Polianin",
Expand Down
3 changes: 2 additions & 1 deletion Client/quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = function (ctx) {
'iconPicker',
'components',
'throttle',
'vueDevTools'
'vueDevTools',
'getBreadcrumbs'
],
css: [
'app.scss',
Expand Down
2 changes: 1 addition & 1 deletion Client/quasar.extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"ide-helper": {
"addToGitIgnore": true,
"__internal": {
"lastQuasarVersion": "1.7.3",
"lastQuasarVersion": "1.7.4",
"lastIdeHelperVersion": "1.0.0-alpha.3"
}
},
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/AdminInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
},
additionalData() {
const {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/ConfigurationAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
},
filterLowerCase() {
return this.filter.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/CypherSecrets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
name: "CypherSecrets",
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/DeletedElements.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
beforeCreate() {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/ImagesCleaner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
methods: {
Expand Down
6 changes: 3 additions & 3 deletions Client/src/admin/categories/CategoriesAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default {
};
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
}
breadcrumbsCategory() {
return this.$getBreadcrumbs("Admin");
}
},
methods: {
up(category) {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/categories/CreateCategory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsCategoriesAdmin;
return this.$getBreadcrumbs("CategoriesAdmin");
}
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions Client/src/admin/categories/EditCategory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default {
};
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsCategoriesAdmin;
breadcrumbsCategory() {
return this.$getBreadcrumbs("CategoriesAdmin");
}
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions Client/src/admin/components/ComponentsAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
methods: {
Expand Down Expand Up @@ -85,4 +85,4 @@ export default {
font-size: 1.15em;
}
}
</style>
</style>
6 changes: 3 additions & 3 deletions Client/src/admin/components/CreateComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export default {
};
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsComponentsAdmin;
}
breadcrumbsCategory() {
return this.$getBreadcrumbs("ComponentsAdmin");
}
},
methods: {
save() {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/components/EditComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsComponentsAdmin;
return this.$getBreadcrumbs("ComponentsAdmin");
}
},
data() {
Expand Down
4 changes: 2 additions & 2 deletions Client/src/admin/menuItems/CreateMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsMenuAdmin;
return this.$getBreadcrumbs("MenuItemsAdmin");
}
},
data() {
Expand Down Expand Up @@ -104,4 +104,4 @@ export default {
margin-top: $flex-gutter-md;
}
}
</style>
</style>
2 changes: 1 addition & 1 deletion Client/src/admin/menuItems/EditMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsMenuAdmin;
return this.$getBreadcrumbs("MenuItemsAdmin");
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/menuItems/MenuItemsAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
return this.menuItems.length - 1;
},
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/roles/RolesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/roles/RolesPermissions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion Client/src/admin/skins/SkinsAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
},
computed: {
breadcrumbsCategory() {
return this.$store.getters.breadcrumbsAdmin;
return this.$getBreadcrumbs("Admin");
}
},
beforeCreate() {
Expand Down
5 changes: 5 additions & 0 deletions Client/src/boot/getBreadcrumbs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getBreadcrumbs } from "sun";

export default ({ Vue }) => {
Vue.prototype.$getBreadcrumbs = getBreadcrumbs;
};
6 changes: 4 additions & 2 deletions Client/src/components/Breadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<q-breadcrumbs-el
:key="cat.id"
:exact="true"
:class="{ 'q-breadcrumbs--grey': !cat.route }"
v-for="cat of breadCrumbsCategories"
:to="cat.route"
:label="cat.title"
Expand Down Expand Up @@ -65,8 +66,9 @@ export default {
color: #00acc1;
}
.q-breadcrumbs--last {
.q-breadcrumbs__el {
.q-breadcrumbs {
.q-breadcrumbs__el.q-breadcrumbs--grey,
.q-breadcrumbs--last {
color: $grey-6;
}
}
Expand Down
74 changes: 74 additions & 0 deletions Client/src/components/getBreadcrumbs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { app } from "sun";

const breadcrumbs = {};

export function makeBreadcrumbs() {
breadcrumbs.Personal = {
title: app.$t("BreadcrumbsNames.personal"),
route: {
name: "ProfileInSettings"
},
showInBreadcrumbs: true,
id: "ProfileInSettings"
};

breadcrumbs.Users = {
title: app.$t("BreadcrumbsNames.user"),
route: null,
showInBreadcrumbs: true,
id: "Users"
};

/* breadcrumbs.PersonalUser = {
title: app.$t("BreadcrumbsNames.you"),
route: {},
showInBreadcrumbs: true,
id: "PersonalUser",
parent: breadcrumbs.Personal
};*/

breadcrumbs.Admin = {
title: app.$t("BreadcrumbsNames.adminPanel"),
route: {
name: "AdminInformation"
},
showInBreadcrumbs: true,
id: "AdminInformation"
};

breadcrumbs.CategoriesAdmin = {
title: app.$t("BreadcrumbsNames.adminPanelCategories"),
route: {
name: "CategoriesAdmin"
},
showInBreadcrumbs: true,
id: "CategoriesAdmin",
parent: breadcrumbs.Admin
};

breadcrumbs.ComponentsAdmin = {
title: app.$t("BreadcrumbsNames.adminPanelComponents"),
route: {
name: "ComponentsAdmin"
},
showInBreadcrumbs: true,
id: "ComponentsAdmin",
parent: breadcrumbs.Admin
};

breadcrumbs.MenuItemsAdmin = {
title: app.$t("BreadcrumbsNames.adminPanelMenu"),
route: {
name: "MenuItemsAdmin"
},
showInBreadcrumbs: true,
id: "MenuItemsAdmin",
parent: breadcrumbs.Admin
};

Object.freeze(breadcrumbs);
}

export default function getBreadcrumbs(name) {
return breadcrumbs[name];
}
8 changes: 8 additions & 0 deletions Client/src/i18n/en-us/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ export default {
},
Breadcrumbs: {
home: "Home"
},
BreadcrumbsNames: {
adminPanel: "Admin panel",
adminPanelCategories: "Categories",
adminPanelComponents: "Components",
adminPanelMenu: "Menu",
personal: "Personal area",
user: "Users",
}
};
8 changes: 8 additions & 0 deletions Client/src/i18n/ru/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ export default {
},
Breadcrumbs: {
home: "Главная"
},
BreadcrumbsNames: {
adminPanel: "Админка",
adminPanelCategories: "Категории",
adminPanelComponents: "Компоненты",
adminPanelMenu: "Меню",
personal: "Личный кабинет",
user: "Пользователи"
}
};
5 changes: 5 additions & 0 deletions Client/src/modules/account/ChangeEmail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export default {
showPassword: false
};
},
computed: {
breadcrumbsCategory() {
return this.$getBreadcrumbs("Personal");
}
},
methods: {
async save() {
this.$refs.email.validate();
Expand Down
5 changes: 5 additions & 0 deletions Client/src/modules/account/ChangePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ export default {
showPassword2: false
};
},
computed: {
breadcrumbsCategory() {
return this.$getBreadcrumbs("Personal");
}
},
methods: {
changePassword() {
this.$refs.passwordOld.validate();
Expand Down
5 changes: 5 additions & 0 deletions Client/src/modules/account/ResetPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ export default {
token: null
};
},
computed: {
breadcrumbsCategory() {
return this.$getBreadcrumbs("Personal");
}
},
methods: {
send() {
this.$refs.email.validate();
Expand Down
3 changes: 3 additions & 0 deletions Client/src/modules/personal/ChangeLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export default {
};
},
computed: {
breadcrumbsCategory() {
return this.$getBreadcrumbs("Personal");
},
userLink() {
const route = this.$router.resolve({
name: "User",
Expand Down
5 changes: 5 additions & 0 deletions Client/src/modules/personal/ChangeName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export default {
submitting: false
};
},
computed: {
breadcrumbsCategory() {
return this.$getBreadcrumbs("Personal");
}
},
methods: {
checkNameInDb() {
if (
Expand Down
Loading

0 comments on commit b6408ec

Please sign in to comment.