blacklight-gallery 4.0.2 → 4.1.0

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: 5ffebc1b8d0949d7deaed3ce7d7391815ff694a5c9fe9581043bef8c37917ff3
4
- data.tar.gz: 7e7d766b8d517268b2dd5a5a3b018e02fcac14b1a3730ee62d49d865798156e6
3
+ metadata.gz: 0fe613439f90948ab6f8348ebd898a8dbcd50a39b09f537f26208b998ac7ca28
4
+ data.tar.gz: b87f85234155f5757efd197c22ba7ee8ab1663d9e9f6b19a1a38a03e59a76206
5
5
  SHA512:
6
- metadata.gz: d344db0389fd834cc709f14af45f215fadcaf3c40b0e2dcc46b40121caa9f7ab60b19cf06b657dde1338c46ab99f5cb2eae1d6e64c9735a0f54b919135743b75
7
- data.tar.gz: 54c51080b3476aaa4d58601623453cfb33d0716c0d8f9f4dd785b46801cc569d2974ad7e373f928dc7468c08d59db8059d8608b798ed6a9b2e5b508c97a53729
6
+ metadata.gz: 213771e22b7aad6533c89ec7e360d1e20134d90560d89826c2db0b326f88d8c3e8dcf1b71c94fb17ea5c6fe1212d922337f001fa97a1fa8cd60a7f7457ca1214
7
+ data.tar.gz: c0991767ff1d83f0c08b61f36b6473796666e39748270b3bb42be6632ec97bc788f91e5b0bcc993560630b3e876c621387f81a7f9966f3c88065f6ff4658751c
@@ -2,26 +2,36 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches: [ main ]
6
6
  pull_request:
7
- branches: [ master ]
7
+ branches: [ main ]
8
8
 
9
9
  jobs:
10
10
  test:
11
11
  runs-on: ubuntu-latest
12
+ continue-on-error: ${{ matrix.experimental }}
12
13
  strategy:
13
14
  matrix:
14
- rails_version: [6.1.4.6]
15
- ruby: ['2.7', '3.0']
15
+ ruby: [2.7, '3.0']
16
+ rails_version: ['6.1.7', '7.0.4']
17
+ blacklight_version: ['~> 7.0']
18
+ experimental: [false]
16
19
  include:
17
- - rails_version: 7.0.2.2
18
- ruby: '3.0'
19
- - rails_version: 5.2.4.4
20
- ruby: '2.7'
21
- - rails_version: 6.0.3.4
22
- ruby: '2.7'
20
+ - ruby: '3.1'
21
+ rails_version: '7.0.4'
22
+ blacklight_version: '~> 7.0'
23
+ experimental: false
24
+ - ruby: '3.1'
25
+ rails_version: '7.0.4'
26
+ blacklight_version: '8.0.0.beta6'
27
+ experimental: false
28
+ - ruby: '3.1'
29
+ rails_version: '7.0.4'
30
+ blacklight_version: 'github'
31
+ experimental: true
23
32
  env:
24
33
  RAILS_VERSION: ${{ matrix.rails_version }}
34
+ BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
25
35
  steps:
26
36
  - uses: actions/checkout@v2
27
37
  - name: Set up Ruby ${{ matrix.ruby }}
@@ -1,4 +1,8 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
1
+ <% component = Blacklight::VERSION > '8' ?
2
+ Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @presenter, counter: @counter) :
3
+ Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, presenter: @presenter, counter: @counter)
4
+ %>
5
+ <%= render(component) do |component| %>
2
6
  <% component.body do %>
3
7
  <div class="thumbnail-container">
4
8
  <%= thumbnail %>
@@ -1,4 +1,8 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
1
+ <% component = Blacklight::VERSION > '8' ?
2
+ Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @presenter, counter: @counter) :
3
+ Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, presenter: @presenter, counter: @counter)
4
+ %>
5
+ <%= render(component) do |component| %>
2
6
  <% component.body do %>
3
7
  <%= @view_context.link_to_document(@document, thumbnail, class: 'thumbnail', data: { 'context-href': nil, 'slide-to': @document_counter - 1, toggle: "modal", target: "#slideshow-modal" }) %>
4
8
  <% end %>
@@ -1,6 +1,7 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
  <div class="container">
3
3
  <div id="documents" class="<%= (Array(view_config.classes || 'row-cols-2 row-cols-md-3') + ["row documents-#{view_config.key}"]).join(' ') %>">
4
- <%= render documents, as: :document, view_config: view_config %>
4
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |doc| document_presenter(doc) } : documents %>
5
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
5
6
  </div>
6
7
  </div>
@@ -1,4 +1,5 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
  <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
3
- <%= render documents, as: :document, view_config: view_config %>
3
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |doc| document_presenter(doc) } : documents%>
4
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
4
5
  </div>
@@ -1,15 +1,16 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
 
3
3
  <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
4
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |document| document_presenter(document) }: documents %>
4
5
  <div class="grid">
5
- <%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(documents)) %>
6
+ <%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(document_presenters)) %>
6
7
  </div>
7
8
 
8
9
  <%= render layout: 'slideshow_modal' do %>
9
10
  <div id="slideshow" class="slideshow-presenter">
10
11
  <!-- Wrapper for slides -->
11
12
  <div class="slideshow-inner">
12
- <%= render documents, as: :document %>
13
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
13
14
  </div>
14
15
 
15
16
  <!-- Controls -->
@@ -17,12 +17,12 @@ 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", '>= 5.1', '< 8'
21
- spec.add_dependency 'blacklight', '~> 7.17'
20
+ spec.add_dependency "rails", '>= 6.1', '< 8'
21
+ spec.add_dependency 'blacklight', '>= 7.17', '< 9'
22
22
 
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency 'sqlite3'
25
- spec.add_development_dependency "rspec-rails", "~> 3.1"
25
+ spec.add_development_dependency "rspec-rails", "~> 6"
26
26
  spec.add_development_dependency "rspec-its"
27
27
  spec.add_development_dependency "rspec-activemodel-mocks"
28
28
  spec.add_development_dependency "rspec-collection_matchers"
@@ -30,6 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "engine_cart", "~> 2.0"
31
31
  spec.add_development_dependency "capybara"
32
32
  spec.add_development_dependency 'webdrivers'
33
- spec.add_development_dependency 'rexml' # pending https://github.com/SeleniumHQ/selenium/issues/9001
34
33
  spec.add_development_dependency "selenium-webdriver", '>= 3.13.1'
35
34
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "4.0.2"
3
+ VERSION = "4.1.0"
4
4
  end
5
5
  end
@@ -5,15 +5,6 @@ module BlacklightGallery
5
5
 
6
6
  source_root File.expand_path('../templates', __FILE__)
7
7
 
8
- def assets
9
- copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
10
- copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
11
-
12
- insert_into_file "app/assets/javascripts/application.js", after: '//= require blacklight/blacklight' do
13
- "\n//= require blacklight_gallery"
14
- end
15
- end
16
-
17
8
  def configuration
18
9
  inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
19
10
  "\n config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)" \
@@ -35,5 +26,14 @@ module BlacklightGallery
35
26
  Bundler.with_clean_env { run 'bundle install' }
36
27
  generate 'openseadragon:install'
37
28
  end
29
+
30
+ def assets
31
+ copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
32
+ copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
33
+
34
+ insert_into_file "app/assets/javascripts/application.js", after: '//= require blacklight/blacklight' do
35
+ "\n//= require blacklight_gallery"
36
+ end
37
+ end
38
38
  end
39
39
  end
@@ -3,7 +3,13 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Blacklight::Gallery::DocumentComponent, type: :component do
6
- subject(:component) { described_class.new(document: document, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, **attr)
9
+ else
10
+ described_class.new(document: document, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -27,7 +33,11 @@ RSpec.describe Blacklight::Gallery::DocumentComponent, type: :component do
27
33
 
28
34
  let(:blacklight_config) do
29
35
  CatalogController.blacklight_config.deep_copy.tap do |config|
30
- config.track_search_session = false
36
+ if Blacklight::VERSION > '8'
37
+ config.track_search_session.storage = false
38
+ else
39
+ config.track_search_session = false
40
+ end
31
41
  config.index.thumbnail_field = 'thumbnail_path_ss'
32
42
  end
33
43
  end
@@ -3,7 +3,13 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
6
- subject(:component) { described_class.new(document: document, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, **attr)
9
+ else
10
+ described_class.new(document: document, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -36,7 +42,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
36
42
  let(:blacklight_config) do
37
43
  Blacklight::Configuration.new.tap do |config|
38
44
  config.index.slideshow_method = :xyz
39
- config.track_search_session = false
45
+ if Blacklight::VERSION > '8'
46
+ config.track_search_session.storage = false
47
+ else
48
+ config.track_search_session = false
49
+ end
40
50
  end
41
51
  end
42
52
 
@@ -55,7 +65,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
55
65
  let(:blacklight_config) do
56
66
  Blacklight::Configuration.new.tap do |config|
57
67
  config.index.slideshow_field = :xyz
58
- config.track_search_session = false
68
+ if Blacklight::VERSION > '8'
69
+ config.track_search_session.storage = false
70
+ else
71
+ config.track_search_session = false
72
+ end
59
73
  end
60
74
  end
61
75
  let(:document) { SolrDocument.new({ xyz: 'http://example.com/some.jpg', id: 'x' }) }
@@ -70,9 +84,15 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
70
84
  end
71
85
 
72
86
  context 'with no view_config' do
73
- let(:blacklight_config) { Blacklight::Configuration.new.tap { |config|
74
- config.track_search_session = false
75
- } }
87
+ let(:blacklight_config) do
88
+ Blacklight::Configuration.new.tap do |config|
89
+ if Blacklight::VERSION > '8'
90
+ config.track_search_session.storage = false
91
+ else
92
+ config.track_search_session = false
93
+ end
94
+ end
95
+ end
76
96
  it { is_expected.not_to have_selector 'img' }
77
97
  end
78
98
 
@@ -80,7 +100,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
80
100
  let(:blacklight_config) do
81
101
  Blacklight::Configuration.new.tap do |config|
82
102
  config.index.thumbnail_field = :xyz
83
- config.track_search_session = false
103
+ if Blacklight::VERSION > '8'
104
+ config.track_search_session.storage = false
105
+ else
106
+ config.track_search_session = false
107
+ end
84
108
  end
85
109
  end
86
110
  let(:document) { SolrDocument.new({ xyz: 'http://example.com/thumb.jpg', id: 'x' }) }
@@ -3,7 +3,13 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component do
6
- subject(:component) { described_class.new(document: document, document_counter: 5, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, document_counter: 5, **attr)
9
+ else
10
+ described_class.new(document: document, document_counter: 5, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -30,7 +36,11 @@ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component
30
36
  let(:blacklight_config) do
31
37
  Blacklight::Configuration.new.tap do |config|
32
38
  config.index.thumbnail_field = 'thumbnail_path_ss'
33
- config.track_search_session = false
39
+ if Blacklight::VERSION > '8'
40
+ config.track_search_session.storage = false
41
+ else
42
+ config.track_search_session = false
43
+ end
34
44
  end
35
45
  end
36
46
 
@@ -38,7 +48,6 @@ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component
38
48
  let(:document) { SolrDocument.new(id: 'abc', thumbnail_path_ss: 'http://example.com/image.jpg') }
39
49
 
40
50
  it 'renders the thumbnail' do
41
- puts render
42
51
  expect(rendered).to have_selector '.thumbnail img[@src="http://example.com/image.jpg"]'
43
52
  end
44
53
 
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Gallery view", :type => :feature do
3
+ RSpec.describe "Gallery view", :type => :feature do
4
4
  before { visit search_catalog_path :q => 'medicine', :view => 'gallery' }
5
5
 
6
- it "should display results in a galley view" do
6
+ it "displays results in a galley view" do
7
7
  expect(page).to have_selector("#documents.documents-gallery")
8
8
  expect(page).to have_selector(".caption", text: "Strong Medicine speaks")
9
9
  end
@@ -0,0 +1,5 @@
1
+ if ENV['BLACKLIGHT_VERSION'] == 'github'
2
+ gem 'blacklight', github: 'projectblacklight/blacklight'
3
+ elsif ENV['BLACKLIGHT_VERSION'] && !ENV['BLACKLIGHT_VERSION'].empty?
4
+ gem 'blacklight', ENV['BLACKLIGHT_VERSION']
5
+ end
@@ -1,13 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "catalog/_document_slideshow", :type => :view do
3
+ RSpec.describe "catalog/_document_slideshow", :type => :view do
4
4
  let(:blacklight_config) do
5
5
  Blacklight::Configuration.new do |config|
6
- config.track_search_session = false
6
+ if Blacklight::VERSION > '8'
7
+ config.track_search_session.storage = false
8
+ else
9
+ config.track_search_session = false
10
+ end
7
11
  end
8
12
  end
9
13
 
10
14
  let(:document) { stub_model(::SolrDocument) }
15
+ let(:view_config) { Blacklight::Configuration::ViewConfig.new(document_component: Blacklight::Gallery::SlideshowComponent) }
11
16
 
12
17
  before do
13
18
  allow(view).to receive_messages(
@@ -19,10 +24,11 @@ describe "catalog/_document_slideshow", :type => :view do
19
24
  allow(view).to receive(:current_search_session).and_return(nil)
20
25
  allow(view).to receive(:search_session).and_return({})
21
26
  allow(view).to receive(:search_state).and_return(Blacklight::SearchState.new({}, blacklight_config))
27
+ @response = instance_double(Blacklight::Solr::Response, start: 0)
22
28
  end
23
29
 
24
30
  it 'has a modal' do
25
- render
31
+ render 'catalog/document_slideshow', view_config: view_config
26
32
  expect(rendered).to have_selector '#slideshow-modal'
27
33
  expect(rendered).to have_selector '[data-slide="prev"]'
28
34
  expect(rendered).to have_selector '[data-slide="next"]'
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.0.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-25 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.1'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: blacklight
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '7.17'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '9'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '7.17'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '9'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: rake
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +84,14 @@ dependencies:
78
84
  requirements:
79
85
  - - "~>"
80
86
  - !ruby/object:Gem::Version
81
- version: '3.1'
87
+ version: '6'
82
88
  type: :development
83
89
  prerelease: false
84
90
  version_requirements: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - "~>"
87
93
  - !ruby/object:Gem::Version
88
- version: '3.1'
94
+ version: '6'
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: rspec-its
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -184,20 +190,6 @@ dependencies:
184
190
  - - ">="
185
191
  - !ruby/object:Gem::Version
186
192
  version: '0'
187
- - !ruby/object:Gem::Dependency
188
- name: rexml
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- version: '0'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: '0'
201
193
  - !ruby/object:Gem::Dependency
202
194
  name: selenium-webdriver
203
195
  requirement: !ruby/object:Gem::Requirement
@@ -326,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
318
  - !ruby/object:Gem::Version
327
319
  version: '0'
328
320
  requirements: []
329
- rubygems_version: 3.2.33
321
+ rubygems_version: 3.3.26
330
322
  signing_key:
331
323
  specification_version: 4
332
324
  summary: Gallery display for Blacklight