blacklight-gallery 3.3.0 → 3.3.1

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: b3a18f9fb266e50ea51b326f0a0ef67ef6cfbd3fb7ae999004575e18d849bdfb
4
- data.tar.gz: 2c3b270a4e50b5fc9058b60d2fce4682da9c4c9d5dcab93ae1c83811843ae586
3
+ metadata.gz: 293ba63382be492c6f0e70f34542b75cd37b3c21904ef7f4482ae90e59709a69
4
+ data.tar.gz: 9f930cbb7b02a7353bb98aec29393b7f0bee7febefcff4b53e919ae294becd25
5
5
  SHA512:
6
- metadata.gz: 616b9e895bbfb120fb2d61f51b19d953babb516aa4df4dbb8b36bb745f34b35b6fa944dbb873ef679dfa097aa033ab189651a80643e0b3ce6e4e9cc54a2bb378
7
- data.tar.gz: 4a05826269a68efef37879ecbd745b53e8cf246c3b15018bdb2b082560774eaeab34c35319913da02055ac102bc5f19fbe8334f336ca81a5fa6f9c504c35af15
6
+ metadata.gz: e18434c888670a0925c24fbfd7ad0ca57c341a40dc91ea138bed735ed208ef236989509b76d6971a8856a8126a9b7282fa3c480fbf98677bd624df4d71c62892
7
+ data.tar.gz: 9caafa8f14d044098c1d1b7c94d221b6398004a63d72bd580992498f12ca580882e1417977e3e64b2d61d52ae2caf9d9c79b3a8a1e2c4cc121d93ae5cc7780b0
@@ -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%;
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "3.3.0"
3
+ VERSION = "3.3.1"
4
4
  end
5
5
  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.3.1
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: 2021-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -307,6 +307,7 @@ files:
307
307
  - solr/conf/xslt/luke.xsl
308
308
  - spec/components/blacklight/gallery/document_component_spec.rb
309
309
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
310
+ - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
310
311
  - spec/features/gallery_spec.rb
311
312
  - spec/features/masonry_spec.rb
312
313
  - spec/features/slideshow_spec.rb
@@ -345,6 +346,7 @@ summary: Gallery display for Blacklight
345
346
  test_files:
346
347
  - spec/components/blacklight/gallery/document_component_spec.rb
347
348
  - spec/components/blacklight/gallery/slideshow_component_spec.rb
349
+ - spec/components/blacklight/gallery/slideshow_preview_component_spec.rb
348
350
  - spec/features/gallery_spec.rb
349
351
  - spec/features/masonry_spec.rb
350
352
  - spec/features/slideshow_spec.rb