Object Links
This commit is contained in:
rodič
2beb3467f8
revize
f26d46b84c
|
@ -10,11 +10,26 @@
|
||||||
export let aspect = "aspect-square";
|
export let aspect = "aspect-square";
|
||||||
export let size = "normal";
|
export let size = "normal";
|
||||||
export let offer = false;
|
export let offer = false;
|
||||||
|
export let bundle;
|
||||||
|
export let currentItem;
|
||||||
|
|
||||||
|
function findObject (it) {
|
||||||
|
if (col === "speaker" && !it.name) {
|
||||||
|
let found = null
|
||||||
|
for (const e of bundle.events) {
|
||||||
|
if (!e.speakers) continue;
|
||||||
|
if (currentItem && e.id === currentItem.id) continue;
|
||||||
|
found = e.speakers.find(s => s.id === it.id)
|
||||||
|
}
|
||||||
|
Object.assign(it, found)
|
||||||
|
}
|
||||||
|
return it
|
||||||
|
}
|
||||||
|
|
||||||
const _url = (col, item) => `/${entry}/${col}/${item.id}`
|
const _url = (col, item) => `/${entry}/${col}/${item.id}`
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each arr as item}
|
{#each arr.map((k) => findObject(k)) as item}
|
||||||
<div class="{size === "small" ? "p-0.5 lg:p-1" : "p-1 lg:p-1.5"} hover:bg-pbw-yellow/20 dark:hover:bg-pbw-white/10 {size==="small" ? "rounded-lg" : "rounded-2xl"}">
|
<div class="{size === "small" ? "p-0.5 lg:p-1" : "p-1 lg:p-1.5"} hover:bg-pbw-yellow/20 dark:hover:bg-pbw-white/10 {size==="small" ? "rounded-lg" : "rounded-2xl"}">
|
||||||
<div class="w-full relative">
|
<div class="w-full relative">
|
||||||
{#if col === "benefit"}
|
{#if col === "benefit"}
|
||||||
|
|
|
@ -262,7 +262,7 @@
|
||||||
{#if item.speakers}
|
{#if item.speakers}
|
||||||
<h2 class="text-2xl uppercase font-bold mt-10 text-gray-500">Speakers ({item.speakers?.length || 0})</h2>
|
<h2 class="text-2xl uppercase font-bold mt-10 text-gray-500">Speakers ({item.speakers?.length || 0})</h2>
|
||||||
<div class="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 xl:grid-cols-8 mt-4 text-center text-xl">
|
<div class="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 xl:grid-cols-8 mt-4 text-center text-xl">
|
||||||
<CollectionList arr={item.speakers} />
|
<CollectionList arr={item.speakers} bundle={data.bundle} currentItem={item} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if item.events}
|
{#if item.events}
|
||||||
|
|
Načítá se…
Odkázat v novém úkolu