diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 6aedabf4c..67c354e47 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,8 +22,8 @@ jobs: - ruby: "3.2" rails_version: 7.1.5.1 - ruby: "3.4" - rails_version: "8.0.1" - blacklight_version: 9.0.0.beta1 + rails_version: "8.0.4" + blacklight_version: 9.0.0.beta8 additional_name: "/ Blacklight 9" env: RAILS_VERSION: ${{ matrix.rails_version }} diff --git a/app/components/arclight/embed_component.rb b/app/components/arclight/embed_component.rb index 9961590c7..80579fabc 100644 --- a/app/components/arclight/embed_component.rb +++ b/app/components/arclight/embed_component.rb @@ -3,10 +3,10 @@ module Arclight # Render digital object links for a document class EmbedComponent < ViewComponent::Base - def initialize(document:, presenter:, **kwargs) # rubocop:disable Lint/UnusedMethodArgument + def initialize(presenter:, document_counter: nil, **kwargs) # rubocop:disable Lint/UnusedMethodArgument super() - @document = document + @document = presenter.document @presenter = presenter end diff --git a/app/components/arclight/repository_location_component.html.erb b/app/components/arclight/repository_location_component.html.erb index e875a059b..4813eed82 100644 --- a/app/components/arclight/repository_location_component.html.erb +++ b/app/components/arclight/repository_location_component.html.erb @@ -1,8 +1,8 @@ -<%= render(@layout.new(field: @field)) do |component| %> +<%= render(@layout.new(field: @field, index: 0)) do |component| %> <% component.with_label do %> <%= label %> <% end %> - <% component.with_value do %> + <% component.with_value(index: 0) do %>
<% if repository.thumbnail_url %> <%= image_tag repository.thumbnail_url, alt: '', class: 'img-fluid float-left' %> diff --git a/app/components/arclight/search_result_component.html.erb b/app/components/arclight/search_result_component.html.erb index e48a857ea..e5e327db5 100644 --- a/app/components/arclight/search_result_component.html.erb +++ b/app/components/arclight/search_result_component.html.erb @@ -1,17 +1,17 @@ <%= content_tag @component, id: @id, data: { - 'document-id': @document.id.to_s.parameterize, + 'document-id': presenter.document.id.to_s.parameterize, 'document-counter': @counter, }, itemscope: true, - itemtype: @document.itemtype, + itemtype: presenter.document.itemtype, class: classes.flatten.join(' ') do %>
<%= icon %>
- <%= render Arclight::SearchResultTitleComponent.new(document: document, compact: compact?) %> + <%= render Arclight::SearchResultTitleComponent.new(presenter: presenter, compact: compact?) %>
<%= metadata %> diff --git a/app/components/arclight/search_result_title_component.html.erb b/app/components/arclight/search_result_title_component.html.erb index ec90363ba..02bd9c346 100644 --- a/app/components/arclight/search_result_title_component.html.erb +++ b/app/components/arclight/search_result_title_component.html.erb @@ -1,12 +1,12 @@ -
+

- <%= helpers.link_to_document @document, counter: @counter %> - <% @document.extent.each do |extent| %> + <%= helpers.link_to_document presenter.document, counter: @counter %> + <% presenter.document.extent.each do |extent| %> <%= tag.span extent, class: 'al-document-extent badge' unless compact? %> <% end %> <%= tag.span class: 'al-document-container text-muted' do %> - <%= @document.containers.join(', ') %> - <% end if @document.containers.present? %> + <%= presenter.document.containers.join(', ') %> + <% end if presenter.document.containers.present? %>

<% actions.each do |action| %> diff --git a/app/components/arclight/upper_metadata_layout_component.rb b/app/components/arclight/upper_metadata_layout_component.rb index 226230fd1..e9a492630 100644 --- a/app/components/arclight/upper_metadata_layout_component.rb +++ b/app/components/arclight/upper_metadata_layout_component.rb @@ -3,8 +3,9 @@ module Arclight # Override upstream to add an offset bootstrap column class class UpperMetadataLayoutComponent < Blacklight::MetadataFieldLayoutComponent - def initialize(field:, label_class: 'col-md-3 offset-md-1', value_class: 'col-md-8') - super + def initialize(field:, index: 0, label_class: 'col-md-3 offset-md-1', value_class: 'col-md-8') + @index = index + super(field: field, label_class: label_class, value_class: value_class) end end end diff --git a/lib/generators/arclight/templates/arclight.scss b/lib/generators/arclight/templates/arclight.scss index 770982ec3..6421b6e95 100644 --- a/lib/generators/arclight/templates/arclight.scss +++ b/lib/generators/arclight/templates/arclight.scss @@ -3,4 +3,5 @@ } // Arclight, imported from arclight frontend package -@import 'arclight/app/assets/stylesheets/arclight/application'; +//@import 'arclight/app/assets/stylesheets/arclight/application'; +@import '../../../arclight/app/assets/stylesheets/arclight/application'; diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 79bb31fcc..7b7cec2e9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,23 @@ end require 'engine_cart' + +# Rails 7.1.3+ freezes certain internal arrays for +# performance and safety. Rails::Engine.paths["app"] is frozen +# but EngineCart tries to modify it, leading to errors like: +# Failure/Error: EngineCart.load_application! +# FrozenError: can't modify frozen Array +# We need to patch Rails::Engine to prevent path freezing during EngineCart loading +module Rails + class Engine + def freeze_config + # Override to prevent freezing of config arrays that EngineCart needs to modify + # This is a temporary workaround for EngineCart compatibility with Rails 7.1.3+ + @config.freeze unless defined?(EngineCart) + end + end +end + EngineCart.load_application! require 'rspec/rails'