-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into i4012_add_citation_scsb
- Loading branch information
Showing
44 changed files
with
2,380 additions
and
11,490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "stylelint-config-standard-scss" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
} | ||
|
||
.blacklight-holdings { | ||
margin-top: 1em; | ||
margin-top: 0.5em; | ||
} | ||
|
||
.blacklight-format { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/components/holdings/online_holdings_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<li> | ||
<% if links.length == 1 %> | ||
<%= content_tag( | ||
:span, | ||
'Online', | ||
class: 'availability-icon badge badge-primary' | ||
) %> | ||
<%= links.first %> | ||
<% elsif links.length > 1 %> | ||
<%= content_tag( | ||
:div, | ||
tag(:'online-options', :'document-id' => document.id), | ||
class: 'lux' | ||
) | ||
%> | ||
<% end %> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
# This component is responsible for displaying a brief description of | ||
# a document's online holdings for consice contexts like the search | ||
# results page | ||
class Holdings::OnlineHoldingsComponent < ViewComponent::Base | ||
def initialize(document:) | ||
@document = document | ||
end | ||
|
||
def render? | ||
links.present? | ||
end | ||
|
||
private | ||
|
||
attr_reader :document | ||
|
||
def links | ||
@links ||= marc_links + portfolio_links | ||
end | ||
|
||
# Generate an Array of <div> elements wrapping links to proxied service endpoints for access | ||
# Takes first 2 links for pairing with online holdings in search results | ||
# @return [Array<String>] array containing the links in the <div>'s | ||
def marc_links | ||
electronic_access = document['electronic_access_1display'] | ||
urls = [] | ||
if electronic_access | ||
links_hash = JSON.parse(electronic_access) | ||
links_hash.first(2).each do |url, text| | ||
link = link_to(text.first, EzProxyService.ez_proxy_url(url), target: '_blank', rel: 'noopener') | ||
link = "#{text[1]}: ".html_safe + link if text[1] | ||
urls << content_tag(:div, link, class: 'library-location') | ||
end | ||
end | ||
urls | ||
end | ||
|
||
# Returns electronic portfolio links for Alma records. | ||
# @return [Array<String>] array containing the links | ||
def portfolio_links | ||
return [] if document.try(:electronic_portfolios).blank? | ||
document.electronic_portfolios.map do |portfolio| | ||
content_tag(:div, class: 'library-location') do | ||
link_to(portfolio["title"], portfolio["url"], target: '_blank', rel: 'noopener') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= helpers.content_tag( | ||
:div, | ||
helpers.content_tag(:div, nil, class: "default"), | ||
class: 'document-thumbnail', | ||
data: identifier_data) | ||
%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
# This component renders the necessary HTML markup | ||
# to provide thumbnails in the search result and | ||
# show pages from 3 different sources: | ||
# * default format-based thumbnails (added via CSS) | ||
# * Google Books thumbnails (added via JS) | ||
# * Figgy thumbnails (added via JS) | ||
class ThumbnailComponent < ViewComponent::Base | ||
def initialize(document:) | ||
@document = document | ||
end | ||
|
||
private | ||
|
||
attr_accessor :document | ||
|
||
def identifier_data | ||
all_identifiers = document.identifier_data | ||
if document.in_a_special_collection? | ||
all_identifiers.slice(:'bib-id') | ||
else | ||
all_identifiers | ||
end | ||
end | ||
end |
Oops, something went wrong.