Skip to content

Commit

Permalink
Pass context correctly into links and assets
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jun 5, 2024
1 parent 19eb6b9 commit cbea9aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/components/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default {
fallbackTitle: {
type: Function,
required: true
},
context: {
type: Object,
default: null
}
},
data() {
Expand Down
10 changes: 7 additions & 3 deletions src/components/Links.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<div class="group" v-for="group in groups" :key="group.rel">
<h4 v-if="group.rel">{{ group.label }}</h4>
<ul>
<Link v-for="(link, key) in group.links" :key="key" :link="link" :fallbackTitle="() => fallbackTitle(link)" />
<Link v-for="(link, key) in group.links" :key="key" :link="link" :context="context" :fallbackTitle="() => fallbackTitle(link)" />
</ul>
</div>
</template>
<ul v-else>
<Link v-for="(link, key) in links" :key="key" :link="link" :fallbackTitle="() => fallbackTitle(link)" />
<Link v-for="(link, key) in links" :key="key" :link="link" :context="context" :fallbackTitle="() => fallbackTitle(link)" />
</ul>
</section>
</template>
Expand Down Expand Up @@ -38,6 +38,10 @@ export default {
links: {
type: Array,
default: () => ([])
},
context: {
type: Object,
default: null
}
},
computed: {
Expand Down Expand Up @@ -103,4 +107,4 @@ export default {
}
}
}
</style>
</style>
8 changes: 4 additions & 4 deletions src/views/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<b-col md="8" class="value"><span v-html="temporalExtents" /></b-col>
</b-row>
</section>
<Links v-if="linkPosition === 'left'" :title="$t('additionalResources')" :links="additionalLinks" />
<Links v-if="linkPosition === 'left'" :title="$t('additionalResources')" :links="additionalLinks" :context="data" />
</section>
<section v-if="isCollection || hasThumbnails" class="mb-4">
<b-card no-body class="maps-preview">
Expand All @@ -35,11 +35,11 @@
</b-card>
</section>
<Assets v-if="hasAssets" :assets="assets" :context="data" :shown="shownAssets" @showAsset="showAsset" />
<Assets v-if="hasItemAssets && !hasItems" :assets="data.item_assets" :definition="true" />
<Assets v-if="hasItemAssets && !hasItems" :assets="data.item_assets" :context="data" :definition="true" />
<Providers v-if="providers" :providers="providers" />
<Metadata class="mb-4" :type="data.type" :data="data" :ignoreFields="ignoredMetadataFields" />
<CollectionLink v-if="collectionLink" :link="collectionLink" />
<Links v-if="linkPosition === 'right'" :title="$t('additionalResources')" :links="additionalLinks" />
<Links v-if="linkPosition === 'right'" :title="$t('additionalResources')" :links="additionalLinks" :context="data" />
</b-col>
<b-col class="catalogs-container" v-if="hasCatalogs">
<Catalogs :catalogs="catalogs" :hasMore="!!nextCollectionsLink" @loadMore="loadMoreCollections" />
Expand All @@ -52,7 +52,7 @@
@paginate="paginateItems" @filterItems="filterItems"
@filtersShown="filtersShown"
/>
<Assets v-if="hasItemAssets" :assets="data.item_assets" :definition="true" />
<Assets v-if="hasItemAssets" :assets="data.item_assets" :context="data" :definition="true" />
</b-col>
</b-row>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</b-card>
</section>
<Assets v-if="hasAssets" :assets="assets" :context="data" :shown="shownAssets" @showAsset="showAsset" />
<Links v-if="additionalLinks.length > 0" :title="$t('additionalResources')" :links="additionalLinks" />
<Links v-if="additionalLinks.length > 0" :title="$t('additionalResources')" :links="additionalLinks" :context="data" />
</b-col>
<b-col class="right">
<section class="intro">
Expand Down

0 comments on commit cbea9aa

Please sign in to comment.