Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
additional_engine_cart_rails_options: ["-j importmap"]
additional_name: [""]
include:
- rails_version: "~> 8.0"
ruby: "3.4"
blacklight_version: "~> 9.0.0.beta7"
additional_engine_cart_rails_options: "-j importmap"
additional_name: Blacklight 9 beta
- rails_version: "~> 7.2"
ruby: "3.3"
blacklight_version: "~> 8.0"
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/concerns/spotlight/search_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
module Spotlight
# ...
module SearchHelper
# @param [Hash] user_params the query parameters used to reconstitute the search state
# from saved searches. If not provided, will use the search_state from the view context
# or an empty hash if that is not available.
# @return [Object] An instance of the configured search service
def search_service(user_params = respond_to?(:search_state, true) ? search_state.to_h : {})
state = Blacklight::SearchState.new(user_params, blacklight_config)
klass = respond_to?(:search_service_class) ? search_service_class : Blacklight::SearchService

klass.new(config: blacklight_config, user_params:, **search_service_context)
klass.new(config: blacklight_config, search_state: state, **search_service_context)
end

# @return [Hash] a hash of context information to pass through to the search service
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/spotlight/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _prefixes
# @param [Hash] the query parameters
# @return [Object] the search results object from the configured search service
def search_results(user_params)
search_service(user_params).search_results
search_service(search_state: Blacklight::SearchState.new(user_params, blacklight_config)).search_results
end

def undo_link
Expand Down
2 changes: 1 addition & 1 deletion blacklight-spotlight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ these collections.)

s.add_dependency 'activejob-status'
s.add_dependency 'acts-as-taggable-on', '>= 5.0', '< 14'
s.add_dependency 'blacklight', '>= 8.7.0', '< 9'
s.add_dependency 'blacklight', '>= 8.7.0', '< 10'
s.add_dependency 'blacklight-gallery', '>= 3.0', '< 7'
s.add_dependency 'bootstrap_form', '>= 5.4', '< 6'
s.add_dependency 'cancancan'
Expand Down
4 changes: 4 additions & 0 deletions lib/generators/spotlight/assets/importmap_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class ImportmapGenerator < Rails::Generators::Base
- Configures cssbundling-rails to build the styles
- Javascript from gems such as Blacklight and Spotlight are delivered
via importmap/the asset pipeline without the need for bundling
- Jquery (which was added by the blacklight-gallery gem) is removed from the importmap
because it is loaded in the head of the HTML as a global.
DESCRIPTION

def add_stylesheet_dependencies
Expand Down Expand Up @@ -64,6 +66,8 @@ def add_javascript
});
CONTENT
end

gsub_file 'app/javascript/application.js', /import\s+'jquery'.*\n/, ''
end

def add_stylesheets
Expand Down
7 changes: 7 additions & 0 deletions lib/generators/spotlight/assets_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ def run_asset_pipeline_specific_generator

generate generator, generated_options
end

def add_openseadragon_images
append_file 'config/initializers/assets.rb', <<~RUBY

Rails.application.config.assets.paths << Rails.root.join('node_modules/openseadragon/build/openseadragon/images')
RUBY
end
end
end
4 changes: 2 additions & 2 deletions lib/generators/spotlight/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ def add_example_catalog_controller

def add_osd_viewer
unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
gem 'blacklight-gallery', '~> 4.0'
gem 'blacklight-gallery'
bundle_install
end
generate 'blacklight_gallery:install'
end

def add_oembed
unless Bundler.locked_gems.dependencies.key? 'blacklight-oembed'
gem 'blacklight-oembed', '~> 1.0'
gem 'blacklight-oembed', '~> 1.4'
bundle_install
end
generate 'blacklight_oembed:install'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def use_capybara3

def add_gems
gem 'blacklight', ENV['BLACKLIGHT_VERSION'] || '~> 8.0' unless Bundler.locked_gems.dependencies.key? 'blacklight'
gem 'blacklight-gallery', '~> 4.5' unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
gem 'blacklight-gallery' unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
gem 'bootstrap_form' unless Bundler.locked_gems.dependencies.key? 'bootstrap_form'

Bundler.with_unbundled_env do
Expand Down
Loading