Skip to content

Commit

Permalink
Merge branch 'main' into i4012_add_citation_scsb
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadel authored Oct 8, 2024
2 parents 849aa79 + e3143b9 commit 14b5621
Show file tree
Hide file tree
Showing 44 changed files with 2,380 additions and 11,490 deletions.
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ executors:
ORANGELIGHT_USER: postgres
SOLR_URL: http://solr:SolrRocks@localhost:8983/solr/orangelight-core-test
COVERALLS_PARALLEL: true
VITE_RUBY_AUTO_BUILD: false
- image: cimg/postgres:15.8
environment:
POSTGRES_USER: orangelight
Expand Down Expand Up @@ -80,6 +81,9 @@ jobs:
key: orangelight-v3-yarn-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Precompile assets
command: bundle exec rake assets:precompile
- persist_to_workspace:
root: '~/orangelight'
paths:
Expand Down
7 changes: 2 additions & 5 deletions .reek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ detectors:
- PhysicalHoldingsMarkupBuilder
DuplicateMethodCall:
exclude:
- Holdings::OnlineHoldingsComponent#marc_links
- LocationCodeFacetComponent#add_scsb_loc
- LocationCodeFacetComponent#fetch_libraries_and_locations
- LocationCodeFacetComponent#library_facet_values
Expand Down Expand Up @@ -115,7 +116,6 @@ detectors:
- ApplicationHelper#location_full_display
- ApplicationHelper#name_title_hierarchy
- ApplicationHelper#scsb_supervised_items?
- ApplicationHelper#search_links
- ApplicationHelper#search_location_display
- ApplicationHelper#series_results
- ApplicationHelper#subjectify
Expand All @@ -133,7 +133,6 @@ detectors:
- BlacklightHelper#wildcard_char_strip
- CatalogHelper#render_search_to_page_title
- HoldingsHelper#first_two_holdings_block
- HoldingsHelper#holding_block_search
- HoldingsHelper#view_record_for_full_avail_li_two
- Orangelight::BrowsablesHelper#current_browse_per_page
- Requests::ApplicationHelper#available_pick_ups
Expand Down Expand Up @@ -271,7 +270,6 @@ detectors:
- AdvancedHelper#advanced_search_fields
- AdvancedHelper#param_for_field
- ApplicationHelper#action_notes_display
- ApplicationHelper#search_links
- ApplicationHelper#search_location_display
- ApplicationHelper#series_results
- ApplicationHelper#title_hierarchy
Expand Down Expand Up @@ -606,7 +604,6 @@ detectors:
- ApplicationHelper#holding_location_label
- ApplicationHelper#locate_link_with_glyph
- ApplicationHelper#render_location_code
- ApplicationHelper#search_links
- BlacklightHelper#html_facets
- BlacklightHelper#isbn_resolve
- BlacklightHelper#issn_resolve
Expand Down Expand Up @@ -704,6 +701,7 @@ detectors:
- initialize
- AeonStatus#check!
- BibdataStatus#check!
- Holdings::OnlineHoldingsComponent#marc_links
- LocationCodeFacetComponent#fetch_libraries_and_locations
- LocationCodeFacetComponent#location_codes_by_lib
- Orangelight::ConstraintsComponent#guided_search_value
Expand Down Expand Up @@ -731,7 +729,6 @@ detectors:
- ApplicationHelper#location_has
- ApplicationHelper#name_title_hierarchy
- ApplicationHelper#render_location_code
- ApplicationHelper#search_links
- ApplicationHelper#search_location_display
- ApplicationHelper#subjectify
- ApplicationHelper#title_hierarchy
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Rails/I18nLocaleTexts:
# TODO: Fix
Rails/OutputSafety:
Exclude:
- 'app/components/holdings/online_holdings_component.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/blacklight_helper.rb'
- 'app/services/holding_requests_builder.rb'
Expand Down
1 change: 0 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@ RSpec/OverwritingSetup:
RSpec/PendingWithoutReason:
Exclude:
- 'spec/features/availability_spec.rb'
- 'spec/features/browsing_item_spec.rb'
- 'spec/features/holding_locations_sort_order_spec.rb'
- 'spec/system/catalog_show_spec.rb'
- 'spec/system/searching_spec.rb'
Expand Down
3 changes: 3 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-standard-scss"
}
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ group :development, :test do
gem 'rubocop-rails', require: false
gem 'rubocop-performance', require: false
gem 'capybara'
gem 'coveralls_reborn'
gem 'coveralls_reborn', require: false
gem "erb_lint", require: false
gem "erblint-github"
gem 'pry-byebug'
gem 'solargraph'
end
group :production do
gem 'datadog', require: 'datadog/auto_instrument'
end
26 changes: 11 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
sshkit (>= 1.6.1, != 1.7.0)
alma (0.5.1)
alma (0.6.1)
activesupport
httparty
xml-simple
Expand Down Expand Up @@ -205,15 +205,12 @@ GEM
csl-styles (2.0.1)
csl (~> 2.0)
csv (3.3.0)
datadog-ci (0.8.3)
msgpack
date (3.3.4)
ddtrace (1.23.3)
datadog-ci (~> 0.8.1)
datadog (2.3.0)
debase-ruby_core_source (= 3.3.1)
libdatadog (~> 7.0.0.1.0)
libdatadog (~> 11.0.0.1.0)
libddwaf (~> 1.14.0.0.0)
msgpack
date (3.3.4)
debase-ruby_core_source (3.3.1)
deprecation (1.1.0)
activesupport
Expand Down Expand Up @@ -324,7 +321,7 @@ GEM
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
httpclient (2.8.3)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
io-console (0.7.2)
Expand Down Expand Up @@ -359,9 +356,9 @@ GEM
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
lcsort (0.9.1)
libdatadog (7.0.0.1.0)
libdatadog (7.0.0.1.0-aarch64-linux)
libdatadog (7.0.0.1.0-x86_64-linux)
libdatadog (11.0.0.1.0)
libdatadog (11.0.0.1.0-aarch64-linux)
libdatadog (11.0.0.1.0-x86_64-linux)
libddwaf (1.14.0.0.0)
ffi (~> 1.0)
libddwaf (1.14.0.0.0-aarch64-linux)
Expand Down Expand Up @@ -400,7 +397,7 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
msgpack (1.7.2)
msgpack (1.7.3)
multi_xml (0.6.0)
mutex_m (0.2.0)
namae (1.2.0)
Expand Down Expand Up @@ -541,8 +538,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.6)
strscan
rexml (3.3.8)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand Down Expand Up @@ -668,7 +664,6 @@ GEM
stackprof (0.2.26)
string_rtl (0.1.0)
stringio (3.1.1)
strscan (3.1.0)
sync (0.5.0)
term-ansicolor (1.11.2)
tins (~> 1.0)
Expand Down Expand Up @@ -766,6 +761,7 @@ DEPENDENCIES
coveralls_reborn
csl-styles
ddtrace
datadog
devise
devise-guests
ed25519
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ bundle exec rubocop
bundle exec reek app
```

#### Running stylelint

```
yarn stylelint "**/*.scss"
```

#### Run lighthouse from the command line
This command runs a rails server, so you will need to stop any rails server that is already running locally before running the commands below.

Expand Down
3 changes: 2 additions & 1 deletion app/assets/stylesheets/components/availability.scss
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@
}

.blacklight-holdings ul {
margin-top: 1.5em;
margin-top: var(--space-small);
margin-bottom: var(--space-x-small);

li {
margin-bottom: 6px;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/search-results.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

.blacklight-holdings {
margin-top: 1em;
margin-top: 0.5em;
}

.blacklight-format {
Expand Down
19 changes: 6 additions & 13 deletions app/assets/stylesheets/components/universal-viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@
height: 600px;
background-color: #000;
}
hr.clear {
clear: both;
}

.uv__overlay {
background:transparent;
position:relative;
width:100%;
height:600px;
top:600px;
margin-top:-600px;
z-index: 1000;
}

.intrinsic-container {
position: relative;
Expand All @@ -36,3 +23,9 @@ hr.clear {
height: 100%;
border: none;
}

.document-viewers {
width: 100%;
padding: 0rem 4rem 3rem 4rem;
background: #ffffff;
}
7 changes: 7 additions & 0 deletions app/assets/stylesheets/icons/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@
}
}

.icon-microform,
.blacklight-microform .document-thumbnail .default {
&:before {
content: $icon-film;
}
}

.icon-audio,
.blacklight-audio .document-thumbnail .default {
&:before {
Expand Down
17 changes: 17 additions & 0 deletions app/components/holdings/online_holdings_component.html.erb
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>
50 changes: 50 additions & 0 deletions app/components/holdings/online_holdings_component.rb
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
6 changes: 6 additions & 0 deletions app/components/thumbnail_component.html.erb
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)
%>
26 changes: 26 additions & 0 deletions app/components/thumbnail_component.rb
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
Loading

0 comments on commit 14b5621

Please sign in to comment.