Skip to content

Commit 0cc703a

Browse files
committed
✨ use property checklistDetailUrl for generating a link to detail page
1 parent 98a87b7 commit 0cc703a

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

personalization-webcomponents/index-my-checklists.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
</strong>
3737
</noscript>
3838
<div>
39-
<my-checklists first-name="Fabi" />
39+
<my-checklists
40+
checklist-detail-url="./index-checklist-detail.html"
41+
></my-checklists>
4042
</div>
4143
</body>
4244
</html>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type DummyChecklistItem from "@/api/dummyservice/DummyChecklistItem.ts";
22

33
export default interface DummyChecklist {
4-
title: string;
5-
lhmExtId: string;
6-
items: DummyChecklistItem[];
7-
lastUpdated: Date;
4+
id: string;
5+
title: string;
6+
lhmExtId: string;
7+
items: DummyChecklistItem[];
8+
lastUpdated: Date;
89
}

personalization-webcomponents/src/api/dummyservice/DummyChecklistService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type DummyChecklist from "@/api/dummyservice/DummyChecklist.ts";
33
export default class DummyChecklistService {
44
dummyResponse: DummyChecklist[] = [
55
{
6+
id: "1111",
67
title: "Ich habe wenig Geld.",
78
lhmExtId: "111",
89
lastUpdated: new Date(),
@@ -45,6 +46,7 @@ export default class DummyChecklistService {
4546
],
4647
},
4748
{
49+
id: "2222",
4850
title: "Ich will umziehen.",
4951
lhmExtId: "111",
5052
lastUpdated: new Date(),
@@ -122,6 +124,7 @@ export default class DummyChecklistService {
122124
],
123125
},
124126
{
127+
id: "3333",
125128
title: "Ich manage eine Familie.",
126129
lhmExtId: "111",
127130
lastUpdated: new Date(),

personalization-webcomponents/src/components/ChecklistCard.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<muc-card
33
:title="checklist.title"
44
tagline="Checkliste"
5+
@click="gotoChecklist(checklist.id!)"
56
>
67
<template #headerPrefix>
78
<div class="card-header-icon">
@@ -72,10 +73,11 @@ import { computed } from "vue";
7273
7374
import ChecklistitemListitem from "@/components/checklistitem-listitem.vue";
7475
import MucChip from "@/components/common/muc-chip.vue";
75-
import { getChecklistIconByTitle } from "@/util/constants.ts";
76+
import {getChecklistIconByTitle, QUERY_PARAM_CHECKLIST_ID} from "@/util/constants.ts";
7677
7778
const props = defineProps<{
7879
checklist: DummyChecklist;
80+
checklistDetailUrl: string;
7981
}>();
8082
8183
const todoCount = computed(() => {
@@ -92,6 +94,11 @@ const firstThreeItemsSortedByChecked = computed(() => {
9294
);
9395
return sortedItems.slice(0, 3);
9496
});
97+
98+
99+
function gotoChecklist(checklistId: string) {
100+
location.href = `${props.checklistDetailUrl}?${QUERY_PARAM_CHECKLIST_ID}=${checklistId}`;
101+
}
95102
</script>
96103

97104
<style scoped>

personalization-webcomponents/src/my-checklists.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
>
2828
</checklist-card>
2929
</div>
30+
:checklist-detail-url="checklistDetailUrl"
31+
>
3032
</muc-card-container>
3133
</main>
3234
</template>

personalization-webcomponents/src/util/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export const FIRSTNAME_DEFAULT = "World";
22

3+
export const QUERY_PARAM_CHECKLIST_ID = "cl-id";
4+
35
export function getChecklistIconByTitle(checklistTitle: string) {
46
return {
57
"Ich habe wenig Geld.": "./assets/img/placeholder_checklist_icon.png",

0 commit comments

Comments
 (0)