blacklight-gallery 3.1.0 → 3.2.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: d9ee96cd4e180caff7bc9589599eba86cba367459e594f79f5e33feac2030bb7
4
- data.tar.gz: 3f088a83957abc39d2a099e8ddd337c09b62bbae65aae26b4ce73d11eaf9c9f6
3
+ metadata.gz: 6fa835b95df717be0278b6031180faaca3bf3ed4ba24750d28d40f83e87ae1ab
4
+ data.tar.gz: d2ee6eb17f865fe2c86dacd146b961c4c11b79275808a7c123639e69cc749f9e
5
5
  SHA512:
6
- metadata.gz: fa1dc30f79963288cfdd629b5a8cb1db1750aed48ce76a2ffb8bf0cc8d97d6bfa8801dfc88d390e763af331ef59084b12c039a5e84af50544de7a9ce3e2617ab
7
- data.tar.gz: e5aa5cd8772332cc98b80d6497875c2899e816baf6e4f5f0f488c98a806b28a6792a005c62a3c12f9bbc8097f4c7712e1248f4a8f198a236937ede9bbf5bae9c
6
+ metadata.gz: d8ccda7a52197a151cee67a6ecb8b131b5cfbe6242ad822fcb7f16a103993757366d36c533ac788c7ab09063b38e29eee52a1bd6a143b3215ba89cadc4075311
7
+ data.tar.gz: c1392ebf0be147afdfcefb9fa929c4115f784854c64bf1342573bee8e2ab374f206394c1f098f89c886277d4840e207edab8ba7017d0f6a840c4ab0ae31ba913
@@ -1,19 +1,16 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, counter: @counter)) do |component| %>
2
- <% component.with(:body) do %>
1
+ <%= render(Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
2
+ <% component.body do %>
3
3
  <div class="thumbnail-container">
4
- <% # Checking if #thumbnail takes any args before passing image_options. #thumbnail did not take any args in version 7.14.1 and earlier %>
5
- <%= method(:thumbnail).arity.zero? ? thumbnail : thumbnail(class: 'img-thumbnail') %>
4
+ <%= thumbnail %>
6
5
 
7
6
  <div class="caption-area">
8
7
  <div class="caption container">
9
- <header class="documentHeader row">
10
- <%= content_tag @title_component, class: 'index_title document-title-heading' do %>
11
- <%= before_title %><%= title %><%= after_title %>
12
- <% end %>
13
- <%= actions %>
14
- </header>
8
+ <%= title %>
15
9
  <%= content %>
16
10
  <%= metadata %>
11
+ <% metadata_sections.each do |section| %>
12
+ <%= section %>
13
+ <% end %>
17
14
  </div>
18
15
  </div>
19
16
  </div>
@@ -3,6 +3,11 @@
3
3
  module Blacklight
4
4
  module Gallery
5
5
  class DocumentComponent < Blacklight::DocumentComponent
6
+ def before_render
7
+ thumbnail(image_options: { class: 'img-thumbnail' }) unless thumbnail.present?
8
+ super
9
+ end
10
+
6
11
  def render_document_class(*args)
7
12
  @view_context.render_document_class(*args)
8
13
  end
@@ -1,5 +1,5 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, counter: @counter)) do |component| %>
2
- <% component.with(:body) do %>
1
+ <%= render(Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
2
+ <% component.body do %>
3
3
  <%= @view_context.link_to_document(@document, thumbnail, class: 'thumbnail', data: { 'context-href': nil, 'slide-to': @document_counter - 1, toggle: "modal", target: "#slideshow-modal" }) %>
4
4
  <% end %>
5
5
  <% end %>
@@ -10,10 +10,10 @@ module Blacklight
10
10
  @document_counter = document_counter || @counter
11
11
  end
12
12
 
13
- def thumbnail
14
- @thumbnail ||
15
- (presenter.thumbnail.exists? && presenter.thumbnail.render({ alt: presenter.heading })) ||
16
- content_tag(:div, t('.missing_image', scope: [:blacklight_gallery]), class: 'thumbnail thumbnail-placeholder')
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?
16
+ super
17
17
  end
18
18
 
19
19
  def presenter
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "rails", '>= 5.1', '< 7'
21
- spec.add_dependency 'blacklight', '~> 7.12'
21
+ spec.add_dependency 'blacklight', '~> 7.17'
22
22
  spec.add_dependency "bootstrap", "~> 4.0"
23
23
 
24
24
  spec.add_development_dependency "rake"
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "3.1.0"
3
+ VERSION = "3.2.0"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@
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, **attr) }
6
+ subject(:component) { described_class.new(document: document, presenter: presenter, **attr) }
7
7
 
8
8
  let(:attr) { {} }
9
9
  let(:view_context) { controller.view_context }
@@ -23,6 +23,8 @@ RSpec.describe Blacklight::Gallery::DocumentComponent, type: :component do
23
23
  )
24
24
  end
25
25
 
26
+ let(:presenter) { Blacklight::IndexPresenter.new(document, view_context, blacklight_config) }
27
+
26
28
  let(:blacklight_config) do
27
29
  CatalogController.blacklight_config.deep_copy.tap do |config|
28
30
  config.track_search_session = false
@@ -34,6 +36,7 @@ RSpec.describe Blacklight::Gallery::DocumentComponent, type: :component do
34
36
  allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
35
37
  allow(view_context).to receive(:current_search_session).and_return(nil)
36
38
  allow(view_context).to receive(:search_session).and_return({})
39
+ allow(view_context).to receive(:blacklight_config).and_return(blacklight_config)
37
40
 
38
41
  # dumb hack to get our stubbing into the thumbnail component
39
42
  allow(controller).to receive(:view_context).and_return(view_context)
@@ -3,7 +3,7 @@
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, **attr) }
6
+ subject(:component) { described_class.new(document: document, presenter: presenter, **attr) }
7
7
 
8
8
  let(:attr) { {} }
9
9
  let(:view_context) { controller.view_context }
@@ -16,6 +16,7 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
16
16
  end
17
17
 
18
18
  let(:blacklight_config) { Blacklight::Configuration.new }
19
+ let(:presenter) { Blacklight::IndexPresenter.new(document, view_context, blacklight_config) }
19
20
 
20
21
  before do
21
22
  allow(view_context).to receive(:blacklight_config).and_return(blacklight_config)
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.1.0
4
+ version: 3.2.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-02 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '7.12'
39
+ version: '7.17'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.12'
46
+ version: '7.17'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bootstrap
49
49
  requirement: !ruby/object:Gem::Requirement