blacklight-gallery 4.6.0 → 4.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3f0a42b90e61a4eb36e76d0be574f4d8f3f2a8c55afb3de20e69bca1f88a086
4
- data.tar.gz: b74abe92f757dd6a2cfd6a7043364915a591030fd1bd6560bb6f64f973d80f94
3
+ metadata.gz: 3847daebaccd26ec1cdb41d45b6120c1feee8844c8d862ecd46e695af06b2f69
4
+ data.tar.gz: 343c9d2a35ce8d194f06b3f81a29e6b5627a4cfe918cac69a02a08297a91e278
5
5
  SHA512:
6
- metadata.gz: 6bdc5e6d5bb2eba2f1d425513ce9d8623e73968734601c2fc239cb9937b809cfb7b86a6e3334ace2cd4c4a0d3155448597258b259f2d66ed329c95f43d2e5c77
7
- data.tar.gz: f8019948c79a90819b928c8548430fd7df8dce919de4f3d3e0a331ab54e344c4d7ed2f987c9df937f308663ca360c6cde6a751b06edeebfc1f3458423b9ad48d
6
+ metadata.gz: ceefd576c46c97ad8950c4d1abea1e65419b28ae9a36d6837f788885baaa8ef669c09e8cd8567a85061a3afddeb0ee6203d2821f4b1ef902266c7ddacf86a5ab
7
+ data.tar.gz: 9dc569009e0306f22471efd83d641c767741cf5f01068f94c3b4c047f75265e9489dcaf449eb5b517dcc345310af81ec0a0b41ee99d9b3192f4cbd6fbe161d51
@@ -14,11 +14,12 @@ jobs:
14
14
  strategy:
15
15
  matrix:
16
16
  ruby: ["3.2", "3.3"]
17
- rails_version: ["7.0.4"]
17
+ rails_version: ["7.2.2"]
18
18
  blacklight_version: ["~> 7.0"]
19
19
  experimental: [false]
20
20
  additional_engine_cart_rails_options: [""]
21
21
  additional_name: [""]
22
+ view_component_version: ["~> 3.12"]
22
23
  include:
23
24
  - ruby: "3.1"
24
25
  rails_version: 6.1.7
@@ -37,13 +38,26 @@ jobs:
37
38
  additional_name: Blacklight main branch
38
39
  - ruby: "3.2"
39
40
  rails_version: "7.0.4"
41
+ blacklight_version: "~> 7.0"
42
+ experimental: false
43
+ view_component_version: "~> 2.83"
44
+ additional_name: "/ ViewComponent 2"
45
+ - ruby: "3.3"
46
+ rails_version: "8.0.0"
47
+ blacklight_version: "~> 8.0"
48
+ experimental: false
49
+ additional_engine_cart_rails_options: --css bootstrap
50
+ additional_name: "/ Blackight 8 / Rails 8"
51
+ - ruby: "3.3"
52
+ rails_version: "7.2.2"
40
53
  blacklight_version: "github"
41
54
  experimental: true
42
- additional_engine_cart_rails_options: -a propshaft
43
- additional_name: "/ Propshaft"
55
+ additional_engine_cart_rails_options: -a propshaft --css bootstrap
56
+ additional_name: "/ Blacklight main branch with Propshaft"
44
57
  env:
45
58
  RAILS_VERSION: ${{ matrix.rails_version }}
46
59
  BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
60
+ VIEW_COMPONENT_VERSION: ${{ matrix.view_component_version }}
47
61
  ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
48
62
  steps:
49
63
  - uses: actions/checkout@v4
@@ -4,9 +4,14 @@
4
4
  padding: 0;
5
5
  margin: 0;
6
6
 
7
- &:hover, &:focus {
7
+ &:hover, &:focus, &:focus-within {
8
8
  .caption-area {
9
- display: block;
9
+ left: auto;
10
+ width: auto;
11
+ height: auto;
12
+ clip: unset;
13
+ max-height: 75%;
14
+ overflow-y: scroll;
10
15
  }
11
16
  }
12
17
 
@@ -34,14 +39,14 @@
34
39
  }
35
40
  @extend .bg-dark;
36
41
  @extend .text-white;
37
- display: none;
38
42
  padding: 5px 7px;
39
43
  background-color: rgba(0,0,0,0.5) !important;
40
44
  position: absolute;
41
45
  bottom: 0;
42
- overflow-x: hidden;
43
- overflow-y: scroll;
44
- max-height: 75%;
46
+ width: 1px;
47
+ height: 1px;
48
+ overflow: hidden;
49
+ clip: rect(0, 0, 0, 0);
45
50
  }
46
51
 
47
52
  .document-counter {
@@ -2,18 +2,18 @@
2
2
  <div class="osd-toolbar row">
3
3
  <div class="col-md-6 pagination">
4
4
  <% if count > 1 %>
5
- <% osd_config = osd_config_referencestrip.merge(osd_config) %>
6
- <a id="<%= id_prefix %>-previous"><%= render Blacklight::Gallery::Icons::ChevronLeftComponent.new %></a>
7
- <span id="<%= id_prefix %>-page">1</span> of <%= count %>
8
- <a id="<%= id_prefix %>-next"><%= render Blacklight::Gallery::Icons::ChevronRightComponent.new %></a>
5
+ <% multi_page_osd_config = osd_config_referencestrip.merge(osd_config) %>
6
+ <a id="<%= @id_prefix %>-previous"><%= render Blacklight::Gallery::Icons::ChevronLeftComponent.new %></a>
7
+ <span id="<%= @id_prefix %>-page">1</span>&nbsp; of <%= count %>
8
+ <a id="<%= @id_prefix %>-next"><%= render Blacklight::Gallery::Icons::ChevronRightComponent.new %></a>
9
9
  <% end %>
10
10
  </div>
11
11
  <div class="col-md-6 controls">
12
- <a id="<%= id_prefix %>-zoom-in"><%= render Blacklight::Gallery::Icons::AddCircleComponent.new %></a>
13
- <a id="<%= id_prefix %>-zoom-out"><%= render Blacklight::Gallery::Icons::RemoveCircleComponent.new %></a>
14
- <a id="<%= id_prefix %>-home"><%= render Blacklight::Gallery::Icons::ResizeSmallComponent.new %></a>
15
- <a id="<%= id_prefix %>-full-page"><%= render Blacklight::Gallery::Icons::CustomFullscreenComponent.new %></a>
12
+ <a id="<%= @id_prefix %>-zoom-in"><%= render Blacklight::Gallery::Icons::AddCircleComponent.new %></a>
13
+ <a id="<%= @id_prefix %>-zoom-out"><%= render Blacklight::Gallery::Icons::RemoveCircleComponent.new %></a>
14
+ <a id="<%= @id_prefix %>-home"><%= render Blacklight::Gallery::Icons::ResizeSmallComponent.new %></a>
15
+ <a id="<%= @id_prefix %>-full-page"><%= render Blacklight::Gallery::Icons::CustomFullscreenComponent.new %></a>
16
16
  </div>
17
17
  </div>
18
- <%= helpers.openseadragon_picture_tag image, class: 'osd-image row', data: { openseadragon: osd_config } %>
18
+ <%= helpers.openseadragon_picture_tag image, class: 'osd-image row', data: { openseadragon: multi_page_osd_config ? multi_page_osd_config : osd_config } %>
19
19
  </div>
@@ -12,6 +12,7 @@ module Blacklight
12
12
  @presenter = presenter
13
13
  @view_config = view_config
14
14
  @classes = classes
15
+ @id_prefix = id_prefix
15
16
  end
16
17
 
17
18
  def image
@@ -33,21 +34,20 @@ module Blacklight
33
34
  def osd_config
34
35
  {
35
36
  crossOriginPolicy: false,
36
- zoomInButton: "#{id_prefix}-zoom-in",
37
- zoomOutButton: "#{id_prefix}-zoom-out",
38
- homeButton: "#{id_prefix}-home",
39
- fullPageButton: "#{id_prefix}-full-page",
40
- nextButton: "#{id_prefix}-next",
41
- previousButton: "#{id_prefix}-previous"
37
+ zoomInButton: "#{@id_prefix}-zoom-in",
38
+ zoomOutButton: "#{@id_prefix}-zoom-out",
39
+ homeButton: "#{@id_prefix}-home",
40
+ fullPageButton: "#{@id_prefix}-full-page",
41
+ nextButton: "#{@id_prefix}-next",
42
+ previousButton: "#{@id_prefix}-previous"
42
43
  }
43
44
  end
44
45
 
45
46
  def osd_config_referencestrip
46
47
  {
47
48
  showReferenceStrip: true,
48
- referenceStripPosition: 'OUTSIDE',
49
+ sequenceMode: true,
49
50
  referenceStripScroll: 'vertical',
50
- referenceStripWidth: 100,
51
51
  referenceStripBackgroundColor: 'transparent'
52
52
  }
53
53
  end
@@ -7,7 +7,8 @@ module Blacklight
7
7
 
8
8
  def initialize(document:, document_counter: nil, **args)
9
9
  super(document: document, document_counter: document_counter, **args)
10
- @document_counter = document_counter || @counter
10
+
11
+ @slide_to = @counter - 1
11
12
  end
12
13
 
13
14
  def before_render
@@ -45,8 +46,8 @@ module Blacklight
45
46
  {
46
47
  'context-href': nil,
47
48
  context_href: nil,
48
- 'slide-to': @document_counter,
49
- 'bs-slide-to': @document_counter,
49
+ 'slide-to': @slide_to,
50
+ 'bs-slide-to': @slide_to,
50
51
  toggle: "modal",
51
52
  'bs-toggle': "modal",
52
53
  target: "#slideshow-modal",
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "rails", '>= 6.1', '< 8'
20
+ spec.add_dependency "rails", '>= 6.1', '< 9'
21
21
  spec.add_dependency 'blacklight', '>= 7.17', '< 9'
22
22
 
23
23
  spec.add_development_dependency "rake"
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "4.6.0"
3
+ VERSION = "4.6.2"
4
4
  end
5
5
  end
@@ -11,6 +11,7 @@ module BlacklightGallery
11
11
  "\n config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)" \
12
12
  "\n config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)" \
13
13
  "\n config.show.tile_source_field = :content_metadata_image_iiif_info_ssm" \
14
+ "\n config.show.partials ||= []" \
14
15
  "\n config.show.partials.insert(1, :openseadragon)"
15
16
  end
16
17
  end
@@ -29,6 +30,9 @@ module BlacklightGallery
29
30
 
30
31
  def assets
31
32
  copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
33
+
34
+ return unless defined?(Sprockets)
35
+
32
36
  append_to_file 'app/assets/config/manifest.js', "\n//= link blacklight_gallery/manifest.js\n"
33
37
  copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
34
38
 
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Blacklight::Gallery::OpenseadragonEmbedComponent, type: :component do
6
+ subject(:component) do
7
+ described_class.new(
8
+ document: document,
9
+ presenter: presenter,
10
+ **attr
11
+ )
12
+ end
13
+
14
+ let(:attr) { {} }
15
+ let(:view_context) { vc_test_controller.view_context }
16
+ let(:render) do
17
+ component.render_in(view_context)
18
+ end
19
+
20
+ let(:rendered) do
21
+ Capybara::Node::Simple.new(render)
22
+ end
23
+
24
+ let(:document) do
25
+ SolrDocument.new(
26
+ id: 'x'
27
+ )
28
+ end
29
+
30
+ let(:presenter) { Blacklight::IndexPresenter.new(document, view_context, blacklight_config) }
31
+
32
+ before do
33
+ allow(view_context).to receive(:current_search_session).and_return(nil)
34
+ allow(view_context).to receive(:search_session).and_return({})
35
+ allow(view_context).to receive(:blacklight_config).and_return(blacklight_config)
36
+ end
37
+
38
+ describe 'openseadragon viewer' do
39
+ let(:blacklight_config) do
40
+ Blacklight::Configuration.new.tap do |config|
41
+ config.index.slideshow_method = :xyz
42
+ if Blacklight::VERSION > '8'
43
+ config.track_search_session.storage = false
44
+ else
45
+ config.track_search_session = false
46
+ end
47
+ end
48
+ end
49
+ it 'uses a single @id_prefix to generate unique control ids' do
50
+ expect(component.osd_config[:zoomInButton]).to include(component.instance_variable_get(:@id_prefix))
51
+ expect(component.osd_config[:zoomOutButton]).to include(component.instance_variable_get(:@id_prefix))
52
+ expect(component.osd_config[:homeButton]).to include(component.instance_variable_get(:@id_prefix))
53
+ expect(component.osd_config[:fullPageButton]).to include(component.instance_variable_get(:@id_prefix))
54
+ expect(component.osd_config[:nextButton]).to include(component.instance_variable_get(:@id_prefix))
55
+ expect(component.osd_config[:previousButton]).to include(component.instance_variable_get(:@id_prefix))
56
+ end
57
+ end
58
+ end
@@ -51,6 +51,14 @@ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component
51
51
  expect(rendered).to have_selector '.thumbnail img[@src="http://example.com/image.jpg"]'
52
52
  end
53
53
 
54
+ it 'renders the correct slide number' do
55
+ if VIEW_COMPONENT_VERSION < 3
56
+ expect(rendered).to have_css '[data-slide-to=\"4\"][data-bs-slide-to=\"4\"]'
57
+ else
58
+ expect(rendered).to have_css '[data-slide-to=\"5\"][data-bs-slide-to=\"5\"]'
59
+ end
60
+ end
61
+
54
62
  context 'when the presenter returns nothing' do
55
63
  let(:document) { SolrDocument.new(id: 'abc') }
56
64
 
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'rspec/collection_matchers'
7
7
  require 'rspec/its'
8
8
  require 'rspec/rails'
9
9
  require 'rspec/active_model/mocks'
10
+ require 'view_component_v2_test_helpers'
10
11
 
11
12
  require 'selenium-webdriver'
12
13
 
@@ -19,4 +20,9 @@ require 'blacklight/gallery'
19
20
  RSpec.configure do |c|
20
21
  c.infer_spec_type_from_file_location!
21
22
  c.include ViewComponent::TestHelpers, type: :component
23
+ view_component_version = Gem.loaded_specs['view_component'].version
24
+ VIEW_COMPONENT_VERSION = view_component_version.segments.first
25
+ if VIEW_COMPONENT_VERSION < 3
26
+ c.include ViewComponentV2TestHelpers, type: :component
27
+ end
22
28
  end
@@ -3,3 +3,7 @@ if ENV['BLACKLIGHT_VERSION'] == 'github'
3
3
  elsif ENV['BLACKLIGHT_VERSION'] && !ENV['BLACKLIGHT_VERSION'].empty?
4
4
  gem 'blacklight', ENV['BLACKLIGHT_VERSION']
5
5
  end
6
+
7
+ unless ENV['VIEW_COMPONENT_VERSION'].to_s == ""
8
+ gem 'view_component', ENV.fetch('VIEW_COMPONENT_VERSION')
9
+ end
@@ -0,0 +1,20 @@
1
+ module ViewComponentV2TestHelpers
2
+ def vc_test_controller
3
+ @vc_test_controller ||= __vc_test_helpers_build_controller(ViewComponent::Base.test_controller.constantize)
4
+ end
5
+
6
+ def __vc_test_helpers_build_controller(klass)
7
+ klass.new.tap { |c| c.request = vc_test_request }.extend(Rails.application.routes.url_helpers)
8
+ end
9
+
10
+ def vc_test_request
11
+ require "action_controller/test_case"
12
+
13
+ @vc_test_request ||=
14
+ begin
15
+ out = ActionDispatch::TestRequest.create
16
+ out.session = ActionController::TestSession.new
17
+ out
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-gallery
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-25 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8'
22
+ version: '9'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8'
32
+ version: '9'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: blacklight
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -288,6 +288,7 @@ files:
288
288
  - solr/conf/xslt/example_rss.xsl
289
289
  - solr/conf/xslt/luke.xsl
290
290
  - spec/components/blacklight/gallery/document_component_spec.rb
291
+ - spec/components/blacklight/gallery/openseadragon_embed_component_spec.rb
291
292
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
292
293
  - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
293
294
  - spec/features/gallery_spec.rb
@@ -298,6 +299,7 @@ files:
298
299
  - spec/spec_helper.rb
299
300
  - spec/test_app_templates/Gemfile.extra
300
301
  - spec/test_app_templates/lib/generators/test_app_generator.rb
302
+ - spec/view_component_v2_test_helpers.rb
301
303
  - spec/views/catalog/_document_slideshow.html.erb_spec.rb
302
304
  - spec/views/catalog/_openseadragon_default.html.erb_spec.rb
303
305
  - vendor/assets/javascripts/imagesloaded.min.js
@@ -321,12 +323,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
323
  - !ruby/object:Gem::Version
322
324
  version: '0'
323
325
  requirements: []
324
- rubygems_version: 3.5.9
326
+ rubygems_version: 3.4.19
325
327
  signing_key:
326
328
  specification_version: 4
327
329
  summary: Gallery display for Blacklight
328
330
  test_files:
329
331
  - spec/components/blacklight/gallery/document_component_spec.rb
332
+ - spec/components/blacklight/gallery/openseadragon_embed_component_spec.rb
330
333
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
331
334
  - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
332
335
  - spec/features/gallery_spec.rb
@@ -337,5 +340,6 @@ test_files:
337
340
  - spec/spec_helper.rb
338
341
  - spec/test_app_templates/Gemfile.extra
339
342
  - spec/test_app_templates/lib/generators/test_app_generator.rb
343
+ - spec/view_component_v2_test_helpers.rb
340
344
  - spec/views/catalog/_document_slideshow.html.erb_spec.rb
341
345
  - spec/views/catalog/_openseadragon_default.html.erb_spec.rb