blacklight-gallery 3.1.0 → 3.4.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: 2c352955a6ff3422f81258dd566cfe58114da0c93f65241e70ae093ee3a76dfb
4
+ data.tar.gz: 58707632ea6223e59985771c6cb79f5cfa3a2e410e44cb5f02a631ed24f2c7be
5
5
  SHA512:
6
- metadata.gz: fa1dc30f79963288cfdd629b5a8cb1db1750aed48ce76a2ffb8bf0cc8d97d6bfa8801dfc88d390e763af331ef59084b12c039a5e84af50544de7a9ce3e2617ab
7
- data.tar.gz: e5aa5cd8772332cc98b80d6497875c2899e816baf6e4f5f0f488c98a806b28a6792a005c62a3c12f9bbc8097f4c7712e1248f4a8f198a236937ede9bbf5bae9c
6
+ metadata.gz: b3220d3e51e3a178532a61678631b3d4dba3b0d38042a0bc4b9a62e447daefce4afa3833b4d2d0cce41442088af8004b4791e1e54e2bd42f2dfdfdfa600a7c51
7
+ data.tar.gz: dda77c2f7e9e80bb37e4783b6559e53cc0acaa6a403e3b17f66fc8a5db3501f01cc2c9f3844747809bf54f1f8e37648b3099102a428e6d169cd30045090f2b15
@@ -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:
@@ -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,7 +84,7 @@ $gray-dark: #343a40 !default;
77
84
  }
78
85
 
79
86
  .caption {
80
- font-size: 14px;
87
+ font-size: 1rem;
81
88
  color: $gray-light;
82
89
  margin: 10px auto;
83
90
  min-width: 200px;
@@ -88,7 +95,7 @@ $gray-dark: #343a40 !default;
88
95
  border-radius: 12px;
89
96
  border: 1px solid $gray-light;
90
97
  color: $gray-light;
91
- font-size: 12px;
98
+ font-size: 1rem;
92
99
  overflow: auto;
93
100
  padding: 4px 10px;
94
101
  text-align: center;
@@ -97,6 +104,8 @@ $gray-dark: #343a40 !default;
97
104
  .controls {
98
105
  svg {
99
106
  fill: $gray-light;
107
+ width: 32px;
108
+ height: 32px;
100
109
  }
101
110
  }
102
111
  }
@@ -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,23 @@ 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
+ populate_thumbnail_slot if thumbnail.blank?
15
+ super
16
+ end
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)
17
30
  end
18
31
 
19
32
  def presenter
@@ -1,5 +1,6 @@
1
+ <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
1
2
  <div class="container">
2
- <div id="documents" class="<%= (Array(blacklight_config.view_config(document_index_view_type).classes || 'row-cols-2 row-cols-md-3') + ["row documents-#{document_index_view_type}"]).join(' ') %>">
3
- <%= render documents, as: :document %>
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
5
  </div>
5
6
  </div>
@@ -1,3 +1,4 @@
1
- <div id="documents" class="<%= (Array(blacklight_config.view_config(document_index_view_type).classes) + ["documents-#{document_index_view_type}"]).join(' ') %>">
2
- <%= render documents, as: :document %>
1
+ <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
+ <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
3
+ <%= render documents, as: :document, view_config: view_config %>
3
4
  </div>
@@ -1,6 +1,8 @@
1
- <div id="documents" class="<%= (Array(blacklight_config.view_config(document_index_view_type).classes) + ["documents-#{document_index_view_type}"]).join(' ') %>">
1
+ <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
+
3
+ <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
2
4
  <div class="grid">
3
- <%= render((blacklight_config.view_config(document_index_view_type).preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(documents)) %>
5
+ <%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(documents)) %>
4
6
  </div>
5
7
 
6
8
  <%= render layout: 'slideshow_modal' do %>
@@ -18,8 +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'
22
- spec.add_dependency "bootstrap", "~> 4.0"
21
+ spec.add_dependency 'blacklight', '~> 7.17'
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.1.0"
3
+ VERSION = "3.4.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)
@@ -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.1.0
4
+ version: 3.4.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: 2022-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,28 +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'
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'
46
+ version: '7.17'
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