Skip to content

Commit

Permalink
Pass locationFlatTree to ItemCard in order to display full location
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-stack3 committed Nov 23, 2024
1 parent 05fbb20 commit 43e9794
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion frontend/components/Item/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
:to="`/location/${item.location.id}`"
loading="lazy"
>
{{ item.location.name }}
{{ locationString }}
</NuxtLink>
</div>
</div>
Expand Down Expand Up @@ -67,6 +67,14 @@
type: Object as () => ItemOut | ItemSummary,
required: true,
},
locationFlatTree: {
type: Array as () => FlatTreeItem[],
required: true,
},
});
const locationString = computed(() => {
return props.locationFlatTree.find(l => l.id === props.item.location.id)?.treeString;
});
</script>

Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/items.vue
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
<p>{{ $t("items.no_results") }}</p>
</div>
<div v-else ref="cardgrid" class="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
<ItemCard v-for="item in items" :key="item.id" :item="item" />
<ItemCard v-for="item in items" :key="item.id" :item="item" :location-flat-tree="locationFlatTree" />
</div>
<div v-if="items.length > 0 && (hasNext || hasPrev)" class="mt-10 flex flex-col items-center gap-2">
<div class="flex">
Expand Down

0 comments on commit 43e9794

Please sign in to comment.