Skip to content

Commit

Permalink
Добавлено управление хлебными крошками в админке
Browse files Browse the repository at this point in the history
  • Loading branch information
simba77 committed May 30, 2024
1 parent 3d2343f commit 1d5222d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
8 changes: 0 additions & 8 deletions resources/admin/composables/page/useBreadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ export const useBreadcrumbs = () => {
setItems([])
}

function homePage () {
breadcrumbs.items.push({
name: 'Главная',
url: '/'
})
}

function add (item: Breadcrumb) {
breadcrumbs.items.push(item)
}
Expand All @@ -27,7 +20,6 @@ export const useBreadcrumbs = () => {
breadcrumbs,
setItems,
reset,
homePage,
add
}
}
26 changes: 4 additions & 22 deletions resources/admin/composables/page/useBreadcrumbsPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,17 @@ import { useBreadcrumbs } from './useBreadcrumbs'
export const useBreadcrumbsPreset = () => {
const { setItems, add } = useBreadcrumbs()

function catalog () {
function users () {
setItems([
{
name: 'Главная',
url: '/'
},
{
name: 'Каталог',
url: '/catalog/'
}
])
}

function favourites () {
setItems([
{
name: 'Главная',
url: '/'
},
{
name: 'Избранное',
url: '/favourites/'
name: 'Пользователи',
url: '/admin/users/'
}
])
}

return {
catalog,
favourites,
users,
add
}
}
3 changes: 2 additions & 1 deletion resources/admin/pages/Users/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import AdminPageLayout from "../../components/Layout/AdminPageLayout.vue";
import { usePage } from "../../composables/page/usePage";
import { useHead } from '@unhead/vue'
const { pageHeader } = usePage()
const { pageHeader, breadcrumbsPreset } = usePage()
breadcrumbsPreset.users()
pageHeader.title = 'Пользователи'
useHead({
Expand Down
3 changes: 2 additions & 1 deletion resources/admin/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import AdminPageLayout from "../components/Layout/AdminPageLayout.vue";
import { usePage } from "../composables/page/usePage";
import { useHead } from "@unhead/vue";
const {pageHeader} = usePage()
const {pageHeader, breadcrumbs} = usePage()
breadcrumbs.reset()
pageHeader.title = 'Главная'
useHead({
Expand Down

0 comments on commit 1d5222d

Please sign in to comment.