blacklight-gallery 3.3.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3a18f9fb266e50ea51b326f0a0ef67ef6cfbd3fb7ae999004575e18d849bdfb
4
- data.tar.gz: 2c3b270a4e50b5fc9058b60d2fce4682da9c4c9d5dcab93ae1c83811843ae586
3
+ metadata.gz: c6cef93b47ca74eb2e2cf9083baafce7e28948cc568b1146dd30f98a842720f6
4
+ data.tar.gz: 890631e78d834ac011666bb1b652ef97f9948b12352a4085c421b4e6f7aec6f7
5
5
  SHA512:
6
- metadata.gz: 616b9e895bbfb120fb2d61f51b19d953babb516aa4df4dbb8b36bb745f34b35b6fa944dbb873ef679dfa097aa033ab189651a80643e0b3ce6e4e9cc54a2bb378
7
- data.tar.gz: 4a05826269a68efef37879ecbd745b53e8cf246c3b15018bdb2b082560774eaeab34c35319913da02055ac102bc5f19fbe8334f336ca81a5fa6f9c504c35af15
6
+ metadata.gz: 79942d8ad4a805a6020fc30e96e26fc392ea38b51dbab5868379a2744fd6ee798fd1b75f9c71f744678456deb165e3510e31820ff24f5c2eb7e21c9343be3c7f
7
+ data.tar.gz: 136ddeb750ddafe01d690265d734e9a183ffefebd896a024e893ae4fd8ab41762c5558fc72a4a88a7198358be9bc5594c69fc3de84304e7f1d2677148ecc64d0
@@ -12,7 +12,7 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  rails_version: [6.1.1]
15
- ruby: [2.7, 3.0]
15
+ ruby: [2.7, '3.0']
16
16
  env:
17
17
  RAILS_VERSION: ${{ matrix.rails_version }}
18
18
  steps:
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Blacklight::Gallery
2
- [![Gem Version](https://badge.fury.io/rb/blacklight-gallery.svg)](http://badge.fury.io/rb/blacklight-gallery) [![Build Status](https://travis-ci.org/projectblacklight/blacklight-gallery.svg?branch=master)](https://travis-ci.org/projectblacklight/blacklight-gallery)
2
+ [![Gem Version](https://badge.fury.io/rb/blacklight-gallery.svg)](http://badge.fury.io/rb/blacklight-gallery) [![CI](https://github.com/projectblacklight/blacklight-gallery/actions/workflows/ruby.yml/badge.svg)](https://github.com/projectblacklight/blacklight-gallery/actions/workflows/ruby.yml)
3
3
 
4
4
  Gallery views for Blacklight search results
5
5
 
@@ -1 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 25 24">
3
+ <path d="m1 9v6h-1v-6zm6-3h12v13h-13v-13zm11 1h-11v11h11zm-13 0v11h-1v-11zm-2 1v9h-1v-9zm18-1v11h-1v-11zm2 1v8h-1v-8zm2 1v5h-1v-5z"/>
4
+ </svg>
@@ -24,6 +24,11 @@
24
24
  }
25
25
 
26
26
  .document-metadata {
27
+ .document-title-heading {
28
+ padding-left: 0;
29
+ padding-right: 0;
30
+ }
31
+
27
32
  dt, dd {
28
33
  flex: 0 0 100%;
29
34
  max-width: 100%;
@@ -12,8 +12,10 @@ $gray-dark: #343a40 !default;
12
12
 
13
13
  .modal-header {
14
14
  border-bottom: none;
15
+ padding: 0.5rem 1rem;
15
16
 
16
17
  .close {
18
+ font-size: 2.5rem;
17
19
  color: white;
18
20
  }
19
21
  }
@@ -57,11 +59,16 @@ $gray-dark: #343a40 !default;
57
59
 
58
60
  .carousel-control {
59
61
  position: absolute;
60
- top: 40%;
62
+ top: 0;
61
63
  height: 100%;
62
64
  width: 50px;
65
+
63
66
  .blacklight-icons {
67
+ display: block;
68
+ position: absolute;
64
69
  width: 3rem;
70
+ top: calc(50% - 3rem);
71
+
65
72
  svg {
66
73
  height: 3rem;
67
74
  width: 3rem;
@@ -77,18 +84,24 @@ $gray-dark: #343a40 !default;
77
84
  }
78
85
 
79
86
  .caption {
80
- font-size: 14px;
81
- color: $gray-light;
87
+ font-size: 1rem;
82
88
  margin: 10px auto;
83
89
  min-width: 200px;
84
90
  max-width: 50%;
91
+ a {
92
+ color: $gray-light;
93
+ text-decoration: underline;
94
+ &:hover, &:focus {
95
+ color: #ffffff;
96
+ }
97
+ }
85
98
  }
86
99
 
87
100
  .counter {
88
101
  border-radius: 12px;
89
102
  border: 1px solid $gray-light;
90
103
  color: $gray-light;
91
- font-size: 12px;
104
+ font-size: 1rem;
92
105
  overflow: auto;
93
106
  padding: 4px 10px;
94
107
  text-align: center;
@@ -97,6 +110,8 @@ $gray-dark: #343a40 !default;
97
110
  .controls {
98
111
  svg {
99
112
  fill: $gray-light;
113
+ width: 32px;
114
+ height: 32px;
100
115
  }
101
116
  }
102
117
  }
@@ -2,7 +2,7 @@
2
2
  <div class="frame">
3
3
  <%= slideshow_tag %>
4
4
  <div class="caption">
5
- <%= presenter.heading %>
5
+ <%= helpers.link_to_document(presenter.document, presenter.heading, counter: @counter) %>
6
6
  </div>
7
7
 
8
8
  <span class="counter">
@@ -20,11 +20,11 @@ module Blacklight
20
20
  method_name = view_config.slideshow_method
21
21
  @view_context.send(method_name, @document, image_options)
22
22
  elsif view_config.slideshow_field
23
- url = slideshow_image_url
24
-
25
- image_tag url, image_options if url.present?
23
+ return if slideshow_image_url.blank?
24
+ image = image_tag slideshow_image_url, image_options
25
+ helpers.link_to_document(@document, image)
26
26
  elsif presenter.thumbnail.exists?
27
- presenter.thumbnail.thumbnail_tag(image_options, url_options.reverse_merge(suppress_link: true))
27
+ presenter.thumbnail.thumbnail_tag(image_options)
28
28
  end
29
29
  end
30
30
 
@@ -11,11 +11,24 @@ module Blacklight
11
11
  end
12
12
 
13
13
  def before_render
14
- thumbnail(presenter.thumbnail.render({ alt: presenter.heading })) if thumbnail.blank? && presenter.thumbnail.exists?
15
- thumbnail(content_tag(:div, t('.missing_image', scope: [:blacklight_gallery]), class: 'thumbnail thumbnail-placeholder')) if thumbnail.blank?
14
+ populate_thumbnail_slot if thumbnail.blank?
16
15
  super
17
16
  end
18
17
 
18
+ # populate the thumbnail slot with a value if one wasn't explicitly provided
19
+ def populate_thumbnail_slot
20
+ thumbnail_content = presenter.thumbnail.render({ alt: presenter.heading }) if presenter.thumbnail.exists?
21
+ unless thumbnail_content.present?
22
+ thumbnail_content = content_tag(
23
+ :div,
24
+ t(:missing_image, scope: %i[blacklight_gallery catalog grid_slideshow]),
25
+ class: 'thumbnail thumbnail-placeholder'
26
+ )
27
+ end
28
+
29
+ thumbnail(thumbnail_content)
30
+ end
31
+
19
32
  def presenter
20
33
  @presenter ||= @view_context.document_presenter(@document)
21
34
  end
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency "rails", '>= 5.1', '< 7'
21
21
  spec.add_dependency 'blacklight', '~> 7.17'
22
- spec.add_dependency "bootstrap", "~> 4.0"
23
22
 
24
23
  spec.add_development_dependency "rake"
25
24
  spec.add_development_dependency 'sqlite3'
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "3.3.0"
3
+ VERSION = "3.5.0"
4
4
  end
5
5
  end
@@ -15,20 +15,30 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
15
15
  Capybara::Node::Simple.new(render)
16
16
  end
17
17
 
18
- let(:blacklight_config) { Blacklight::Configuration.new }
18
+ let(:document) do
19
+ SolrDocument.new(
20
+ id: 'x',
21
+ )
22
+ end
23
+
19
24
  let(:presenter) { Blacklight::IndexPresenter.new(document, view_context, blacklight_config) }
20
25
 
21
26
  before do
27
+ allow(view_context).to receive(:current_search_session).and_return(nil)
28
+ allow(view_context).to receive(:search_session).and_return({})
22
29
  allow(view_context).to receive(:blacklight_config).and_return(blacklight_config)
23
30
  end
24
31
 
25
32
  describe '#slideshow_tag' do
26
33
  subject { rendered }
27
34
 
28
- let(:document) { SolrDocument.new({}) }
29
-
30
35
  context 'with a slideshow method' do
31
- let(:blacklight_config) { Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz } }
36
+ let(:blacklight_config) do
37
+ Blacklight::Configuration.new.tap do |config|
38
+ config.index.slideshow_method = :xyz
39
+ config.track_search_session = false
40
+ end
41
+ end
32
42
 
33
43
  it 'calls the provided slideshow method' do
34
44
  expect(view_context).to receive_messages(xyz: 'some-slideshow')
@@ -41,26 +51,39 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
41
51
  end
42
52
  end
43
53
 
44
- context 'with a field' do
45
- let(:blacklight_config) { Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz } }
46
- let(:document) { SolrDocument.new({ xyz: 'http://example.com/some.jpg' }) }
54
+ context 'with a slideshow field' do
55
+ let(:blacklight_config) do
56
+ Blacklight::Configuration.new.tap do |config|
57
+ config.index.slideshow_field = :xyz
58
+ config.track_search_session = false
59
+ end
60
+ end
61
+ let(:document) { SolrDocument.new({ xyz: 'http://example.com/some.jpg', id: 'x' }) }
47
62
 
48
63
  it { is_expected.to have_selector 'img[src="http://example.com/some.jpg"]' }
49
64
 
50
65
  context 'without data in the field' do
51
- let(:document) { SolrDocument.new({}) }
66
+ let(:document) { SolrDocument.new({id: 'x'}) }
52
67
 
53
68
  it { is_expected.not_to have_selector 'img' }
54
69
  end
55
70
  end
56
71
 
57
- context 'with nothing configured' do
72
+ context 'with no view_config' do
73
+ let(:blacklight_config) { Blacklight::Configuration.new.tap { |config|
74
+ config.track_search_session = false
75
+ } }
58
76
  it { is_expected.not_to have_selector 'img' }
59
77
  end
60
78
 
61
79
  context 'falling back to a thumbnail' do
62
- let(:blacklight_config) { Blacklight::Configuration.new.tap { |config| config.index.thumbnail_field = :xyz } }
63
- let(:document) { SolrDocument.new({ xyz: 'http://example.com/thumb.jpg' }) }
80
+ let(:blacklight_config) do
81
+ Blacklight::Configuration.new.tap do |config|
82
+ config.index.thumbnail_field = :xyz
83
+ config.track_search_session = false
84
+ end
85
+ end
86
+ let(:document) { SolrDocument.new({ xyz: 'http://example.com/thumb.jpg', id: 'x' }) }
64
87
 
65
88
  it { is_expected.to have_selector 'img[src="http://example.com/thumb.jpg"]' }
66
89
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component do
6
+ subject(:component) { described_class.new(document: document, document_counter: 5, presenter: presenter, **attr) }
7
+
8
+ let(:attr) { {} }
9
+ let(:view_context) { controller.view_context }
10
+ let(:render) do
11
+ component.render_in(view_context)
12
+ end
13
+
14
+ let(:rendered) do
15
+ Capybara::Node::Simple.new(render)
16
+ end
17
+
18
+ let(:blacklight_config) { Blacklight::Configuration.new }
19
+ let(:presenter) { Blacklight::IndexPresenter.new(document, view_context, blacklight_config) }
20
+
21
+ before do
22
+ allow(view_context).to receive(:blacklight_config).and_return(blacklight_config)
23
+ allow(view_context).to receive(:current_search_session).and_return(nil)
24
+ allow(view_context).to receive(:search_session).and_return({})
25
+
26
+ # dumb hack to get our stubbing into the thumbnail component
27
+ allow(controller).to receive(:view_context).and_return(view_context)
28
+ end
29
+
30
+ let(:blacklight_config) do
31
+ Blacklight::Configuration.new.tap do |config|
32
+ config.index.thumbnail_field = 'thumbnail_path_ss'
33
+ config.track_search_session = false
34
+ end
35
+ end
36
+
37
+ describe 'default thumbnail' do
38
+ let(:document) { SolrDocument.new(id: 'abc', thumbnail_path_ss: 'http://example.com/image.jpg') }
39
+
40
+ it 'renders the thumbnail' do
41
+ puts render
42
+ expect(rendered).to have_selector '.thumbnail img[@src="http://example.com/image.jpg"]'
43
+ end
44
+
45
+ context 'when the presenter returns nothing' do
46
+ let(:document) { SolrDocument.new(id: 'abc') }
47
+
48
+ subject { rendered }
49
+ it { is_expected.to have_selector '.thumbnail-placeholder', text: 'Missing' }
50
+ end
51
+ end
52
+ 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: 3.3.0
4
+ version: 3.5.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: 2021-04-30 00:00:00.000000000 Z
11
+ date: 2022-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -44,20 +44,6 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '7.17'
47
- - !ruby/object:Gem::Dependency
48
- name: bootstrap
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '4.0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '4.0'
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: rake
63
49
  requirement: !ruby/object:Gem::Requirement
@@ -307,6 +293,7 @@ files:
307
293
  - solr/conf/xslt/luke.xsl
308
294
  - spec/components/blacklight/gallery/document_component_spec.rb
309
295
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
296
+ - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
310
297
  - spec/features/gallery_spec.rb
311
298
  - spec/features/masonry_spec.rb
312
299
  - spec/features/slideshow_spec.rb
@@ -338,13 +325,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
325
  - !ruby/object:Gem::Version
339
326
  version: '0'
340
327
  requirements: []
341
- rubygems_version: 3.2.3
328
+ rubygems_version: 3.2.32
342
329
  signing_key:
343
330
  specification_version: 4
344
331
  summary: Gallery display for Blacklight
345
332
  test_files:
346
333
  - spec/components/blacklight/gallery/document_component_spec.rb
347
334
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
335
+ - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
348
336
  - spec/features/gallery_spec.rb
349
337
  - spec/features/masonry_spec.rb
350
338
  - spec/features/slideshow_spec.rb