Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to collection without requiring a second lookup #2155

Merged
merged 1 commit into from
May 29, 2024

Conversation

jcoyne
Copy link
Contributor

@jcoyne jcoyne commented May 28, 2024

Fixes #2154

The link is only used for analytics, so it shouldn't matter if the collection is dark or not

@@ -20,7 +20,7 @@
<%= javascript_importmap_tags @embed_response.viewer.importmap if @embed_response.viewer.importmap %>
<%= stylesheet_link_tag @embed_response.viewer.stylesheet %>
<%= stylesheet_link_tag 'sul_icons.css' %>
<%= tag :link, rel: "up", href: Embed::Purl.find(@embed_response.request.purl_object.collections.first).purl_url if @embed_response && @embed_response.request.purl_object.collections.any? %>
<%= tag :link, rel: "up", href: @embed_response.request.purl_object.first_collection_url if @embed_response && @embed_response.request.purl_object.first_collection_url %>
Copy link
Member

@mjgiarlo mjgiarlo May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a Purl instance has no collections, won't Purl#first_collection_url return "#{Settings.purl_url}/#{nil}" (truthy)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now handled in the model. Thank you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent. :shipit:

Fixes #2154

The link is only used for analytics, so it shouldn't matter if the collection is dark or not
@mjgiarlo mjgiarlo merged commit e3bfaa8 into main May 29, 2024
3 checks passed
@mjgiarlo mjgiarlo deleted the avoid-unnecessary-load branch May 29, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Items should be visible in embed even if their parent collection is "dark'
2 participants