Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d69b0e7
Upgrade blacklight-marc to 8
ajkiessl May 1, 2024
679ad6a
upgrade to blacklight 8
Smullz622 May 8, 2024
c97a8b6
structure of response has changed and the .first is no longer needed.…
Smullz622 May 8, 2024
9781622
convert_to_search_state has been depreciated and is no longer needed
Smullz622 May 8, 2024
9c28928
remove facets from homepage. There were problems getting them to work…
Smullz622 May 9, 2024
ec484fd
search_sidebar partial is depreciated, replacing with component
Smullz622 May 9, 2024
e1a6ddb
previous_next_doc partial is depreciated, replaced with component. Th…
Smullz622 May 9, 2024
ee7e1cd
Merge branch 'main' into preview/bl-upgrade
Smullz622 Aug 18, 2026
f70df53
merge main - missed one
Smullz622 Aug 18, 2026
daf6901
resolve dependency error
Smullz622 Aug 18, 2026
acf883b
resolve build error
Smullz622 Aug 19, 2026
7504632
niftany
Smullz622 Aug 19, 2026
5ae516b
WIP – some tests fixed
jlandiseigsti Aug 31, 2026
e00f752
Fixes unclosed comment
jlandiseigsti Aug 31, 2026
4845257
Rubocop
jlandiseigsti Aug 31, 2026
d335e45
niftany
jlandiseigsti Aug 31, 2026
19f27e6
other niftany
jlandiseigsti Aug 31, 2026
9467ced
Fixes the Share button
jlandiseigsti Aug 31, 2026
ff0991b
resolve depreciated index_default partial
Smullz622 Sep 2, 2026
b30a9a3
niftany
Smullz622 Sep 2, 2026
181db45
more niftany
Smullz622 Sep 2, 2026
3accec2
remove blacklight overrides that were used for testing purposes
Smullz622 Sep 2, 2026
a5abf78
resolve remaining test failures after blacklight upgrade
Smullz622 Sep 9, 2026
1bb64ac
restore RIS link name
Smullz622 Sep 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Layout/LineLength:
- 'spec/controllers/catalog_controller_spec.rb'
- 'app/components/blacklight/advanced_search_form_component.rb'
- 'spec/features/availability_spec.rb'
- 'app/components/psul_document_component.rb'

Lint/MissingSuper:
Exclude:
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ gem 'shelvit'
gem 'sprockets-rails'
gem 'stackprof'

gem 'blacklight', '~> 7.35'
gem 'blacklight', '~> 8.7.0'
gem 'blacklight_advanced_search', '~> 8.0.0.alpha'
gem 'blacklight-marc', '~> 8.0'
gem 'blacklight_range_limit', '~> 8.1.0'
gem 'blacklight-marc', '~> 8.1'
gem 'blacklight_range_limit'

group :development do
gem 'better_errors'
Expand Down
34 changes: 15 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ GEM
bindex (0.8.1)
binding_of_caller (1.0.1)
debug_inspector (>= 1.2.0)
blacklight (7.42.0)
deprecation
blacklight (8.7.0)
globalid
hashdiff
i18n (>= 1.7.0)
jbuilder (~> 2.7)
kaminari (>= 0.15)
Expand All @@ -113,11 +111,12 @@ GEM
marc-fastxmlwriter
rails
traject (~> 3.0)
blacklight_advanced_search (8.0.0.alpha2)
blacklight (>= 7.15, < 9)
blacklight_advanced_search (8.0.0)
blacklight (>= 7.15, < 10)
parslet
blacklight_range_limit (8.1.0)
blacklight (~> 7.0)
blacklight_range_limit (9.2.0)
blacklight (>= 7.25.2, < 10)
view_component (>= 2.54, < 5)
bootsnap (1.18.6)
msgpack (~> 1.2)
bot_challenge_page (1.2.0)
Expand Down Expand Up @@ -153,8 +152,6 @@ GEM
date (3.5.1)
debug_inspector (1.2.0)
deep_merge (1.2.2)
deprecation (1.1.0)
activesupport
devise (5.0.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -203,6 +200,7 @@ GEM
faraday-retry (1.0.4)
ffi (1.17.4)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
ffi-compiler (1.4.2)
ffi (>= 1.15.5)
rake
Expand Down Expand Up @@ -286,7 +284,6 @@ GEM
memory_profiler (1.1.0)
method_source (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (6.0.6)
drb (~> 2.0)
prism (~> 1.5)
Expand Down Expand Up @@ -317,11 +314,10 @@ GEM
rubocop-rspec_rails (~> 2.30)
scss_lint (~> 0.60)
nio4r (2.7.5)
nokogiri (1.19.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.19.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.19.4-x86_64-linux-gnu)
racc (~> 1.4)
okcomputer (1.19.0)
orm_adapter (0.5.0)
ostruct (0.6.3)
Expand Down Expand Up @@ -538,9 +534,8 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (2.9.5)
mini_portile2 (~> 2.8.0)
sqlite3 (2.9.5-arm64-darwin)
sqlite3 (2.9.5-x86_64-linux-gnu)
stackprof (0.2.27)
thor (1.5.0)
tilt (2.7.0)
Expand Down Expand Up @@ -595,15 +590,16 @@ GEM

PLATFORMS
arm64-darwin-24
ruby
arm64-darwin-25
x86_64-linux

DEPENDENCIES
better_errors
binding_of_caller
blacklight (~> 7.35)
blacklight-marc (~> 8.0)
blacklight (~> 8.7.0)
blacklight-marc (~> 8.1)
blacklight_advanced_search (~> 8.0.0.alpha)
blacklight_range_limit (~> 8.1.0)
blacklight_range_limit
bootsnap
bot_challenge_page
bugsnag (~> 6.26)
Expand Down
3 changes: 2 additions & 1 deletion app/components/blacklight/document/action_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class ActionComponent < Blacklight::Component
with_collection_parameter :action

# @param [Blacklight::Document] document
def initialize(document:, action:, options: {}, url_opts: {}, id: nil, link_classes: 'nav-link ps-3')
def initialize(document:, action:, options: {}, url_opts: {}, id: nil,
link_classes: 'nav-link ps-3 dropdown-item')
super
@document = document
@action = action
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="d-inline-block mb-1" role="group" aria-label="Actions including with nested dropdown">
<div class="dropdown">
<a class="btn btn-outline-secondary btn-sm dropdown-toggle" href="#" role="button" id="btnGroupDrop1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Share</a>
<%= render Blacklight::Document::ActionsComponent.new(
document: document,
tag: 'ul',
classes: 'dropdown-menu',
wrapping_tag: 'li',
actions: actions,
url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h),
link_classes: 'dropdown-item'
) %>
</div>
</div>
3 changes: 3 additions & 0 deletions app/components/catalog/document_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

# Intentionally left as a legacy stub to avoid autoload confusion during the Blacklight 8 migration.
57 changes: 57 additions & 0 deletions app/components/psul_document_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# frozen_string_literal: true

class PsulDocumentComponent < Blacklight::DocumentComponent
def before_render
super
set_slot(:title, nil, actions: false) unless @show

with_footer do
safe_join([
helpers.render(partial: 'external_links/index_external_links', locals: { document: @document }),
content_tag(:div, class: 'blacklight-availability') do
unless Settings.readonly
helpers.render(partial: 'catalog/index_availability',
locals: { document: @document })
end
end
].compact)
end
end

def call
content_tag @component,
id: @id,
data: {
'document-id': @document.id.to_s.parameterize,
'document-counter': @counter
},
itemscope: true,
itemtype: @document.itemtype,
class: classes.flatten.join(' ') do
safe_join([
content_tag(:div, class: 'document-header row align-items-start gx-3') do
safe_join([
content_tag(:div, class: 'col-sm-9 pe-0') do
safe_join([
title,
embed,
content,
metadata,
metadata_sections.to_a,
partials
].compact)
end,
content_tag(:div, class: 'col-sm-3 d-flex flex-column align-items-end ps-0 pe-0') do
safe_join([
helpers.render_index_doc_actions(@document,
wrapping_class: 'index-document-functions d-flex justify-content-end mb-2'),
thumbnail
].compact)
end
].compact)
end,
footer
].compact)
end
end
end
52 changes: 8 additions & 44 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def index

if cache_key
@response = Rails.cache.fetch(cache_key, expires_in: 12.hours) do
response = search_service.search_results.first
response = search_service.search_results
# Nilling out below is necessary in order to avoid a Marshal.dump error of "can't dump an anonymous class" when
# attempting to cache the Solr response object.
response.blacklight_config = nil
Expand All @@ -38,7 +38,7 @@ def index
blacklight_config: blacklight_config
}
else
@response = search_service.search_results.first
@response = search_service.search_results
end

respond_to do |format|
Expand Down Expand Up @@ -77,9 +77,11 @@ def ris
end

configure_blacklight do |config|
# Controls the document actions (also called "tools"), note that blacklight_marc adds refworks and endnote
# Controls the document actions (also called "tools"), note that blacklight_marc adds refworks and endnote.
# Blacklight 8 defaults document actions to a modal trigger unless modal: false is set, which breaks
# direct-download actions like RIS exports.
config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params, html_class: 'dropdown-item')
config.add_show_tools_partial(:ris, callback: :ris_action, html_class: 'dropdown-item')
config.add_show_tools_partial(:ris, callback: :ris_action, html_class: 'dropdown-item', modal: false)
config.add_show_tools_partial(:report_issue, callback: :report_issue_action, validator: :validate_report_issue_params?)
# TODO: hide SMS action for now, should be enabled when fixed
# config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params, html_class: 'dropdown-item')
Expand Down Expand Up @@ -147,6 +149,8 @@ def ris
config.index.title_field = 'title_display_ssm'
config.index.display_type_field = 'format'
config.index.thumbnail_method = :render_thumbnail
config.index.document_component = PsulDocumentComponent
config.index.partials = []

# solr field configuration for document/show views
config.show.partials = [:show]
Expand Down Expand Up @@ -212,46 +216,6 @@ def ris
config.add_facet_field 'title_sort', label: 'Title', show: false
config.add_facet_field 'thesis_dept_facet', label: 'Graduate Program', show: false

#
# Facets that only appear on the home page
#
config.add_home_facet_field 'access_facet',
label: 'Access',
collapse: false,
presenter: Blacklight::FacetFieldPresenter

config.add_home_facet_field 'format',
label: 'Format',
limit: true,
collapse: false,
presenter: Blacklight::FacetFieldPresenter

config.add_home_facet_field 'campus_facet',
label: 'Campus',
sort: 'index',
limit: -1,
single: true,
collapse: true,
presenter: Blacklight::FacetFieldPresenter

config.add_home_facet_field 'media_type_facet',
label: 'Media Type',
limit: 20,
index_range: 'A'..'Z',
collapse: true,
presenter: Blacklight::FacetFieldPresenter

config.add_home_facet_field 'classification_pivot_field',
label: 'Call Number',
pivot: %w[lc_1letter_facet lc_rest_facet],
collapse: true,
collapsing: true,
presenter: Blacklight::FacetFieldPresenter,
icons: {
show: "\uf0fe", # same as '<i class="fa fa-plus-square" aria-hidden="true"></i>',
hide: "\uf146"
}

# Have BL send all facet field names to Solr, which has been the default
# previously. Simply remove these lines if you'd rather use Solr request
# handler defaults, or have no facets.
Expand Down
19 changes: 10 additions & 9 deletions app/helpers/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ module UrlHelper
# @example
# session_tracking_params(SolrDocument.new(id: 123), 7)
# => { data: { :'context-href' => '/catalog/123/track?counter=7&search_id=999' } }
def session_tracking_params(document, counter)
path = session_tracking_path(document,
per_page: params.fetch(:per_page, search_session['per_page']),
counter: counter,
search_id: current_search_session.try(:id),
document_id: document&.id)

if path.nil?
return {}
def session_tracking_params(document, counter, per_page: search_session['per_page'],
search_id: current_search_session&.id)
path_params = { per_page: params.fetch(:per_page, per_page), counter: counter, search_id: search_id }
if blacklight_config.track_search_session.storage == 'server'
path_params[:document_id] = document&.id
path_params[:search_id] = search_id
end
path = session_tracking_path(document, path_params)
return {} if path.nil?

{ data: { 'context-href': path } }
context_method = blacklight_config.track_search_session.storage == 'client' ? 'get' : 'post'
{ data: { context_href: path, context_method: context_method, turbo_prefetch: false } }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,30 @@ article.document {
}

.documents-list .document .document-thumbnail {
display: flex;
float: none;
margin-bottom: 1em;
justify-content: flex-end;
margin-bottom: 0;
padding-left: 0;
text-align: right;
width: 100%;

> * { // scss-lint:disable SelectorDepth
display: inline-block;
line-height: 1;
}
}

.documents-list .document .index-document-functions {
display: flex;
justify-content: flex-end;
width: 100%;
}

.documents-list .document .document-header {
margin-bottom: 0;
}

.documents-list .document .document-title-heading {
margin-bottom: 0;
}
3 changes: 1 addition & 2 deletions app/services/document_ris.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class DocumentRis
}.freeze

def initialize(document)
@document = document
@docs = @document.first['response']['docs'].first
@docs = document
end

def ris_to_string
Expand Down
10 changes: 1 addition & 9 deletions app/views/bookmarks/_tools.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
<div class="dropdown">
<a class="btn btn-outline-secondary btn-md dropdown-toggle" href="#" role="button" id="btnGroupDrop1" data-bs-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false">Share</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left" aria-labelledby="btnGroupDrop1">
<%= render_show_doc_actions @response.documents, document: nil, document_list: @response.documents, url_opts: Blacklight::Parameters.sanitize(params.to_unsafe_h) do |config, inner| %>
<% next if [:citation, :ris].include?(config.key) %>
<% if (config.key == :bulk_ris) %>
<% bookmark_ids = current_user.bookmarks.map { |b| b.document_id.to_s }.join(',') %>
<a class="dropdown-item" href="<%= bulk_ris_bookmarks_path(item_ids: bookmark_ids) %>">RIS file</a>
<% else %>
<%= inner %>
<% end %>
<% end %>
<%= render Blacklight::Document::ShowToolsComponent.new(document: @document) %>
</div>
</div>
</div>
3 changes: 2 additions & 1 deletion app/views/catalog/_bookmark_control.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<% if current_user %>
<%= render PsulBookmarkComponent.new(document: document) %>
<%# The ID value here is a placeholder value to bypass inheritance issues %>
<%= render PsulBookmarkComponent.new(document: document, id: 'bookmark') %>
<% else %>
<a class="btn btn-sm btn-outline-secondary" href="/login?fullpath=<%= u(request.fullpath) %>&bookmark_doc_id=<%= document.id %>">Bookmark</a>
<% end %>
2 changes: 1 addition & 1 deletion app/views/catalog/_constraints.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render(PsulConstraintsComponent.new(search_state: convert_to_search_state(controller.params == params ? search_state : params))) %>
<%= render(PsulConstraintsComponent.new(search_state: search_state)) %>
Loading