Skip to content

Commit 38cd83d

Browse files
Merge branch '14-issue' into 'main'
Resolve "Broodkruimelpad toevoegen" Closes #14 See merge request ictu/devops/algoritmeregister/algoritmeregister!14
2 parents 6798409 + c3de426 commit 38cd83d

File tree

9 files changed

+123
-21
lines changed

9 files changed

+123
-21
lines changed

backend/app/routers/default.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ async def get_one(id: str, db: Session = Depends(get_db)):
2828
.filter(models.algoritme.Algoritme.id == id)
2929
.first()
3030
)
31+
32+
33+
@router.get("/algoritme-simple-list/")
34+
async def get_simple_list(db: Session = Depends(get_db)):
35+
return db.query(
36+
models.algoritme.Algoritme.id, models.algoritme.Algoritme.name
37+
).all()

frontend/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const { t } = useI18n()
1414
</div>
1515
<AppHeader />
1616
<AppContentBar v-if="false" />
17-
<AppBreadcrumb v-if="false" />
17+
<AppBreadcrumb />
1818

1919
<div class="container columns columns--sidebar-left row">
2020
<NuxtPage />
Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,58 @@
11
<template>
2-
<div class="row row--page-opener">
2+
<div class="row row--page-opener" v-if="breadcrumbs.length != 0">
33
<div class="container">
44
<div class="breadcrumb">
5-
<p>U bent hier:</p>
5+
<p>{{ t('you-are-here') }}:</p>
66
<ol>
7-
<li>
8-
<a href="#">Zoeken</a>
7+
<li v-for="crumb in breadcrumbsWithLinks">
8+
<a v-if="crumb.routeName != null" :href="`/${crumb.routeName}`">{{
9+
crumb.label
10+
}}</a>
11+
<span v-if="crumb.routeName == null">{{ crumb.label }}</span>
912
</li>
10-
<li>
11-
<a href="#">Zoekresultaten</a>
12-
</li>
13-
<li>Regeling</li>
13+
<li>{{ pathTail.label }}</li>
1414
</ol>
1515
</div>
1616
</div>
1717
</div>
1818
</template>
19+
20+
<script setup lang="ts">
21+
import { navigationItems } from '@/config/config'
22+
import { useI18n } from 'vue-i18n'
23+
import algoritmeService from '@/services/algoritme'
24+
import { AlgNamesOnly } from '~~/types/algoritme'
25+
const { t } = useI18n()
26+
const currentRoute = useRoute()
27+
28+
const { data } = await algoritmeService.getNames()
29+
let nameList = ref(data.value as AlgNamesOnly[])
30+
31+
const navigationItemsTranslated = computed(() =>
32+
navigationItems.map((item) => {
33+
return { label: t(item.label), routeName: item.routeName }
34+
})
35+
)
36+
37+
const navigationItemsWithoutLink = ['footer']
38+
39+
const breadcrumbs = computed(() => {
40+
const path = currentRoute.path
41+
const breadCrumbs = path != '/' ? path.split('/').slice(1) : []
42+
43+
return breadCrumbs.map((crumb) => {
44+
return {
45+
label:
46+
// translate path parts with a name matching a navigation item
47+
navigationItemsTranslated.value.find((item) => item.routeName == crumb)
48+
?.label || // translate path parts with a name matching an algorithm id
49+
nameList.value.find((alg: any) => alg.id == crumb)?.name ||
50+
crumb,
51+
routeName: navigationItemsWithoutLink.includes(crumb) ? null : crumb,
52+
}
53+
})
54+
})
55+
56+
const breadcrumbsWithLinks = computed(() => breadcrumbs.value.slice(0, -1))
57+
const pathTail = computed(() => breadcrumbs.value.slice(-1)[0])
58+
</script>

frontend/components/views/AppHeader.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161

6262
<script setup lang="ts">
6363
import LanguagePicker from '@/components/LanguagePicker.vue'
64-
import { computed } from 'vue'
6564
import { useI18n } from 'vue-i18n'
6665
const { t } = useI18n()
6766
@@ -75,7 +74,6 @@ const navigationItems = computed(() => [
7574
routeName: 'algoritme',
7675
},
7776
])
78-
7977
const currentRoute = useRoute()
8078
const menuExpanded = ref(false)
8179
@@ -84,10 +82,8 @@ watch(currentRoute, () => (menuExpanded.value = false))
8482
</script>
8583

8684
<style scoped lang="scss">
87-
8885
.active a {
8986
background-color: $secondary;
9087
color: $primary-darker !important;
9188
}
92-
93-
</style>
89+
</style>

frontend/config/config.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,39 @@ const keys = {
1717
status: 'status',
1818
}
1919

20-
export { summaryTiles, keys }
20+
const navigationItems = [
21+
{
22+
label: 'navigation.home',
23+
routeName: 'index',
24+
},
25+
{
26+
label: 'navigation.algorithmRegister',
27+
routeName: 'algoritme',
28+
},
29+
{
30+
label: 'navigation.footer',
31+
routeName: 'footer',
32+
},
33+
{
34+
label: 'navigation.over',
35+
routeName: 'over',
36+
},
37+
{
38+
label: 'navigation.contact',
39+
routeName: 'contact',
40+
},
41+
{
42+
label: 'navigation.vragen',
43+
routeName: 'vragen',
44+
},
45+
{
46+
label: 'navigation.privacyverklaring',
47+
routeName: 'privacyverklaring',
48+
},
49+
{
50+
label: 'navigation.toegankelijkheid',
51+
routeName: 'toegankelijkheid',
52+
},
53+
]
54+
55+
export { summaryTiles, keys, navigationItems }

frontend/locales/en.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"english?": "true",
33
"explanation": "Explanation",
4+
"you-are-here": "You are here",
45
"Ontbreekt": "Missing",
56
"locale-en": "English",
67
"locale-nl": "Dutch",
@@ -46,7 +47,13 @@
4647
"hideFilters": "Hide filters",
4748
"navigation": {
4849
"home": "Home",
49-
"algorithmRegister": "Algorithms"
50+
"algorithmRegister": "Algorithms",
51+
"footer": "Home",
52+
"over": "About",
53+
"contact": "Contact",
54+
"vragen": "FAQ",
55+
"privacyverklaring": "Privacy",
56+
"toegankelijkheid": "Accessibility"
5057
},
5158
"pagination": {
5259
"goTo": "Go to page {n}"
@@ -211,4 +218,4 @@
211218
}
212219
}
213220
}
214-
}
221+
}

frontend/locales/nl.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"english?": "false",
33
"explanation": "Uitleg",
4+
"you-are-here": "U bent hier",
45
"Ontbreekt": "Ontbreekt",
56
"locale-en": "Engels",
67
"locale-nl": "Nederlands",
@@ -46,7 +47,13 @@
4647
"hideFilters": "Verberg filters",
4748
"navigation": {
4849
"home": "Home",
49-
"algorithmRegister": "Algoritmes"
50+
"algorithmRegister": "Algoritmes",
51+
"footer": "Home",
52+
"over": "Over",
53+
"contact": "Contact",
54+
"vragen": "Vaak gestelde vragen",
55+
"privacyverklaring": "Privacyverklaring",
56+
"toegankelijkheid": "Toegankelijkheid"
5057
},
5158
"pagination": {
5259
"goTo": "Ga naar pagina {n}"
@@ -211,4 +218,4 @@
211218
}
212219
}
213220
}
214-
}
221+
}

frontend/services/algoritme.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// import { apiFetch } from '@/utils/fetchApi'
2-
import type { Algoritme } from '@/types/algoritme'
2+
import type { Algoritme, AlgNamesOnly } from '@/types/algoritme'
33

44
const getAll = () =>
55
useFetch<Algoritme[]>('/algoritme/', {
@@ -11,4 +11,9 @@ const getOne = (id: string) =>
1111
baseURL: useRuntimeConfig().public.apiBaseUrl,
1212
})
1313

14-
export default { getAll, getOne }
14+
const getNames = () =>
15+
useFetch<AlgNamesOnly[]>('/algoritme-simple-list/', {
16+
baseURL: useRuntimeConfig().public.apiBaseUrl,
17+
})
18+
19+
export default { getAll, getOne, getNames }

frontend/types/algoritme.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ export type AlgoritmeFilter = {
2020
attribute: string
2121
value: string
2222
}
23+
24+
export interface AlgNamesOnly {
25+
id: string
26+
name: string
27+
}

0 commit comments

Comments
 (0)