blacklight-gallery 3.1.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/app/assets/images/blacklight/slideshow.svg +4 -1
- data/app/assets/stylesheets/blacklight_gallery/_gallery.scss +5 -0
- data/app/assets/stylesheets/blacklight_gallery/_slideshow.scss +12 -3
- data/app/components/blacklight/gallery/document_component.html.erb +7 -10
- data/app/components/blacklight/gallery/document_component.rb +5 -0
- data/app/components/blacklight/gallery/slideshow_preview_component.html.erb +2 -2
- data/app/components/blacklight/gallery/slideshow_preview_component.rb +17 -4
- data/app/views/catalog/_document_gallery.html.erb +3 -2
- data/app/views/catalog/_document_masonry.html.erb +3 -2
- data/app/views/catalog/_document_slideshow.html.erb +4 -2
- data/blacklight-gallery.gemspec +1 -2
- data/lib/blacklight/gallery/version.rb +1 -1
- data/spec/components/blacklight/gallery/document_component_spec.rb +4 -1
- data/spec/components/blacklight/gallery/slideshow_component_spec.rb +2 -1
- data/spec/components/blacklight/gallery/slideshow_preview_component_spec.rb +52 -0
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c352955a6ff3422f81258dd566cfe58114da0c93f65241e70ae093ee3a76dfb
|
4
|
+
data.tar.gz: 58707632ea6223e59985771c6cb79f5cfa3a2e410e44cb5f02a631ed24f2c7be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3220d3e51e3a178532a61678631b3d4dba3b0d38042a0bc4b9a62e447daefce4afa3833b4d2d0cce41442088af8004b4791e1e54e2bd42f2dfdfdfa600a7c51
|
7
|
+
data.tar.gz: dda77c2f7e9e80bb37e4783b6559e53cc0acaa6a403e3b17f66fc8a5db3501f01cc2c9f3844747809bf54f1f8e37648b3099102a428e6d169cd30045090f2b15
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
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>
|
@@ -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:
|
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:
|
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:
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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
|
14
|
-
|
15
|
-
|
16
|
-
|
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(
|
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
|
-
|
2
|
-
|
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
|
-
|
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((
|
5
|
+
<%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(documents)) %>
|
4
6
|
</div>
|
5
7
|
|
6
8
|
<%= render layout: 'slideshow_modal' do %>
|
data/blacklight-gallery.gemspec
CHANGED
@@ -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.
|
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'
|
@@ -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.
|
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:
|
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.
|
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.
|
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.
|
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
|