-
Notifications
You must be signed in to change notification settings - Fork 0
Add 'Full text options' fulfillment link. #409
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| require 'uri' | ||
|
|
||
| class ThirdironController < ApplicationController | ||
| layout false | ||
|
|
||
|
|
@@ -14,11 +16,28 @@ def browzine | |
| return unless ThirdIron.enabled? && params[:issn].present? | ||
|
|
||
| @browzine = Browzine.lookup(issn: params[:issn]) | ||
| @full_record_url = safe_full_record_url(params[:full_record_url]) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def expected_params? | ||
| params[:type].present? && params[:identifier].present? | ||
| end | ||
|
|
||
| def safe_full_record_url(url) | ||
| return nil unless url.is_a?(String) | ||
|
|
||
| url = url.strip | ||
| return nil if url.blank? | ||
|
|
||
| parsed = URI.parse(url) | ||
| return nil unless parsed.is_a?(URI::HTTP) | ||
| return nil if parsed.host.blank? | ||
|
Copilot marked this conversation as resolved.
|
||
| return nil if parsed.userinfo.present? | ||
|
|
||
| parsed.to_s | ||
|
Copilot marked this conversation as resolved.
|
||
| rescue URI::InvalidURIError, ArgumentError | ||
| nil | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| end | ||
|
jazairi marked this conversation as resolved.
|
||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| <% if ThirdIron.enabled? && @browzine.present? %> | ||
| <% if @browzine[:browzine_link].present? %> | ||
| <div class="libkey-actions"> | ||
| <%= link_to @browzine[:browzine_link][:text], @browzine[:browzine_link][:link], class: 'button libkey-link', data: { matomo_seen: "Results, Browzine Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, Browzine Link Engaged, Link: {{getElementText}}", content_piece: @browzine[:browzine_link][:text] } %> | ||
| </div> | ||
| <%# Dedicated Browzine endpoint response for journal records. | ||
| Rendered when: A Primo journal result with ISSN triggers a Browzine API lookup via /browzine?issn=X&full_record_url=Y | ||
| Use case: Primary fulfillment source for journal articles (via trigger_browzine partial from _result_primo.html.erb) | ||
| Returns: Browzine link + optional "Full-text options" button (links to Primo record) | ||
| %> | ||
| <% if ThirdIron.enabled? && @browzine.present? && @browzine[:browzine_link].present? %> | ||
|
JPrevost marked this conversation as resolved.
|
||
| <% if @full_record_url.present? %> | ||
| <%= link_to 'Full-text options', @full_record_url, class: 'button libkey-link', data: { matomo_seen: "Results, Full-text Options Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, Full-text Options Link Engaged, Link: {{getElementText}}", content_piece: 'Full-text options' } %> | ||
| <% end %> | ||
|
|
||
| <div class="libkey-actions"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the intent of this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving the link outside of this div was a styling workaround, similar to removing the button class. When the Full-text options link is placed inside the div, both it and the Browse journal link render as if they are the first link in the list. I'll tag Dave on this to see if he has insight on this and the button class issue. |
||
| <%= link_to @browzine[:browzine_link][:text], @browzine[:browzine_link][:link], class: 'libkey-link', data: { matomo_seen: "Results, Browzine Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, Browzine Link Engaged, Link: {{getElementText}}", content_piece: @browzine[:browzine_link][:text] } %> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why button is being removed? Don't we add it to all the fulfillment links and the css styles them as buttons or not conditionally? |
||
| </div> | ||
| <% end %> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,10 +13,16 @@ | |
| <%= link_to( @libkey[:best_integrator_link][:text], @libkey[:best_integrator_link][:link], class: 'button libkey-link', data: { matomo_seen: "Results, LibKey Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, LibKey Link Engaged, Link: {{getElementText}}", content_piece: @libkey[:best_integrator_link][:text] } ) %> | ||
| <% end %> | ||
|
|
||
| <%# Browzine link returned as part of LibKey fulfillment response. | ||
| Rendered when: LibKey API includes a browzine_link in its response | ||
| Use case: Secondary fulfillment option alongside PDF, HTML, or other direct links from LibKey | ||
| Note: Different from dedicated browzine.html.erb which is called directly for journals. | ||
| LibKey Browzine link appears when looking up DOI/PMID fulfillment (articles, etc.) | ||
| %> | ||
| <%# Display browzine link if available. This should always display if we have it regardless of other links. %> | ||
| <% if @libkey[:browzine_link].present? %> | ||
| <div class="libkey-actions"> | ||
| <%= link_to @libkey[:browzine_link][:text], @libkey[:browzine_link][:link], class: 'button libkey-link', data: { matomo_seen: "Results, Browzine Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, Browzine Link Engaged, Link: {{getElementText}}", content_piece: @libkey[:browzine_link][:text] } %> | ||
| <%= link_to @libkey[:browzine_link][:text], @libkey[:browzine_link][:link], class: 'libkey-link', data: { matomo_seen: "Results, Browzine Link Seen, Tab: {{getActiveTabName}}", matomo_click: "Results, Browzine Link Engaged, Link: {{getElementText}}", content_piece: @libkey[:browzine_link][:text] } %> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why button is being removed? Don't we add it to all the fulfillment links and the css styles them as buttons or not conditionally? It's unclear to me when this template comes into play versus the same link in the browzine template. I'm concerned whatever condition this is here for should include the new full text options as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does, but the addition of the Full text options link affects the conditional styling in such a way that Browse journal renders as a primary button rather than the intended underlined styling. The easiest path I could figure to fix that was to remove the button class, but that doesn't necessarily mean it's the best path. |
||
| </div> | ||
| <% end %> | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.