blacklight-gallery 3.4.0 → 4.0.1
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 +9 -20
- data/README.md +1 -1
- data/app/assets/stylesheets/blacklight_gallery/_gallery.scss +0 -2
- data/app/assets/stylesheets/blacklight_gallery/_slideshow.scss +7 -1
- data/app/components/blacklight/gallery/slideshow_component.html.erb +1 -1
- data/app/components/blacklight/gallery/slideshow_component.rb +4 -4
- data/app/helpers/blacklight/openseadragon_helper.rb +18 -1
- data/app/views/catalog/_openseadragon_default.html.erb +17 -14
- data/blacklight-gallery.gemspec +1 -1
- data/config/locales/blacklight-gallery.de.yml +15 -0
- data/lib/blacklight/gallery/version.rb +1 -1
- data/lib/generators/blacklight_gallery/install_generator.rb +3 -4
- data/spec/components/blacklight/gallery/slideshow_component_spec.rb +34 -11
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/catalog/_document_slideshow.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_openseadragon_default.html.erb_spec.rb +3 -3
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67559224cded645a3d4cdcbacf6d2ee5caa94d6168ebf320e15c317eac00cac6
|
4
|
+
data.tar.gz: 34f56fb978b1db760dc813fc85e5b99cae783b872924824bddeffeccdc09827a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c62a4b9c3cfeba14ee254cb07d6359adbc1b012c13ea8c061760ddf083b27da2c4867dba951100c2af0362e56441635c2099014695bd69a3c525cee22ead8e92
|
7
|
+
data.tar.gz: acf86862e45f1c2537d4047b7d8cc31cc849cb8cedd9678de5aea58a6dd35e018b9641b487a4995be160d8115ae46270f9eb58754e2b977b358e9efce61b3d55
|
data/.github/workflows/ruby.yml
CHANGED
@@ -11,26 +11,15 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
rails_version: [6.1.
|
15
|
-
ruby: [2.7, '3.0']
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
ruby-version: ${{ matrix.ruby }}
|
24
|
-
- name: Install dependencies with Rails ${{ matrix.rails_version }}
|
25
|
-
run: bundle install
|
26
|
-
- name: Run tests
|
27
|
-
run: bundle exec rake
|
28
|
-
test_rails52:
|
29
|
-
runs-on: ubuntu-latest
|
30
|
-
strategy:
|
31
|
-
matrix:
|
32
|
-
rails_version: [5.2.4.4, 6.0.3.4]
|
33
|
-
ruby: [2.7]
|
14
|
+
rails_version: [6.1.4.6]
|
15
|
+
ruby: ['2.7', '3.0']
|
16
|
+
include:
|
17
|
+
- rails_version: 7.0.2.2
|
18
|
+
ruby: '3.0'
|
19
|
+
- rails_version: 5.2.4.4
|
20
|
+
ruby: '2.7'
|
21
|
+
- rails_version: 6.0.3.4
|
22
|
+
ruby: '2.7'
|
34
23
|
env:
|
35
24
|
RAILS_VERSION: ${{ matrix.rails_version }}
|
36
25
|
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)
|
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
|
|
@@ -85,10 +85,16 @@ $gray-dark: #343a40 !default;
|
|
85
85
|
|
86
86
|
.caption {
|
87
87
|
font-size: 1rem;
|
88
|
-
color: $gray-light;
|
89
88
|
margin: 10px auto;
|
90
89
|
min-width: 200px;
|
91
90
|
max-width: 50%;
|
91
|
+
a {
|
92
|
+
color: $gray-light;
|
93
|
+
text-decoration: underline;
|
94
|
+
&:hover, &:focus {
|
95
|
+
color: #ffffff;
|
96
|
+
}
|
97
|
+
}
|
92
98
|
}
|
93
99
|
|
94
100
|
.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
|
-
|
24
|
-
|
25
|
-
|
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
|
27
|
+
presenter.thumbnail.thumbnail_tag(image_options)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -1,7 +1,24 @@
|
|
1
1
|
module Blacklight
|
2
2
|
module OpenseadragonHelper
|
3
|
+
# Somewhat arbitrary number; the only important thing is that
|
4
|
+
# it is bigger than the number of embedded viewers on a page
|
5
|
+
ID_COUNTER_MAX = (2**20) - 1
|
6
|
+
|
7
|
+
# Mint a (sufficiently) unique identifier, so we can associate
|
8
|
+
# the expand/collapse control with labels
|
9
|
+
def self.mint_id
|
10
|
+
@id_counter = ((@id_counter || 0) + 1) % ID_COUNTER_MAX
|
11
|
+
|
12
|
+
# We convert the ID to hex for markup compactness
|
13
|
+
@id_counter.to_s(16)
|
14
|
+
end
|
15
|
+
|
3
16
|
def osd_container_class
|
4
17
|
"col-md-6"
|
5
18
|
end
|
19
|
+
|
20
|
+
def osd_html_id_prefix
|
21
|
+
"osd-#{Blacklight::OpenseadragonHelper.mint_id}".to_param
|
22
|
+
end
|
6
23
|
end
|
7
|
-
end
|
24
|
+
end
|
@@ -1,13 +1,16 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
image = document.to_openseadragon(blacklight_config.view_config(:show))
|
3
|
+
id_prefix = osd_html_id_prefix
|
4
|
+
%>
|
2
5
|
<%
|
3
6
|
osd_config = {
|
4
7
|
crossOriginPolicy: false,
|
5
|
-
zoomInButton: "
|
6
|
-
zoomOutButton: "
|
7
|
-
homeButton: "
|
8
|
-
fullPageButton: "
|
9
|
-
nextButton: "
|
10
|
-
previousButton: "
|
8
|
+
zoomInButton: "#{id_prefix}-zoom-in",
|
9
|
+
zoomOutButton: "#{id_prefix}-zoom-out",
|
10
|
+
homeButton: "#{id_prefix}-home",
|
11
|
+
fullPageButton: "#{id_prefix}-full-page",
|
12
|
+
nextButton: "#{id_prefix}-next",
|
13
|
+
previousButton: "#{id_prefix}-previous"
|
11
14
|
}
|
12
15
|
|
13
16
|
osd_config_referencestrip = {
|
@@ -26,16 +29,16 @@
|
|
26
29
|
<div class="col-md-6 pagination">
|
27
30
|
<% if count > 1 %>
|
28
31
|
<% osd_config = osd_config_referencestrip.merge(osd_config) %>
|
29
|
-
<a id="
|
30
|
-
<span id="
|
31
|
-
<a id="
|
32
|
+
<a id="<%= id_prefix %>-previous"><%= blacklight_icon('chevron_left') %></a>
|
33
|
+
<span id="<%= id_prefix %>-page">1</span> of <%= count %>
|
34
|
+
<a id="<%= id_prefix %>-next"><%= blacklight_icon('chevron_right') %></a>
|
32
35
|
<% end %>
|
33
36
|
</div>
|
34
37
|
<div class="col-md-6 controls">
|
35
|
-
<a id="
|
36
|
-
<a id="
|
37
|
-
<a id="
|
38
|
-
<a id="
|
38
|
+
<a id="<%= id_prefix %>-zoom-in"><%= blacklight_icon('add_circle') %></a>
|
39
|
+
<a id="<%= id_prefix %>-zoom-out"><%= blacklight_icon('remove_circle') %></a>
|
40
|
+
<a id="<%= id_prefix %>-home"><%= blacklight_icon('resize_small') %></a>
|
41
|
+
<a id="<%= id_prefix %>-full-page"><%= blacklight_icon('custom_fullscreen') %></a>
|
39
42
|
</div>
|
40
43
|
</div>
|
41
44
|
<%= openseadragon_picture_tag image, class: 'osd-image row', data: { openseadragon: osd_config } %>
|
data/blacklight-gallery.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "rails", '>= 5.1', '<
|
20
|
+
spec.add_dependency "rails", '>= 5.1', '< 8'
|
21
21
|
spec.add_dependency 'blacklight', '~> 7.17'
|
22
22
|
|
23
23
|
spec.add_development_dependency "rake"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
de:
|
2
|
+
blacklight:
|
3
|
+
search:
|
4
|
+
view:
|
5
|
+
gallery: "Bildergalerie"
|
6
|
+
slideshow: "Diashow"
|
7
|
+
masonry: "Masonry"
|
8
|
+
blacklight_gallery:
|
9
|
+
catalog:
|
10
|
+
grid_slideshow:
|
11
|
+
missing_image: 'fehlend'
|
12
|
+
document_slideshow:
|
13
|
+
header: "Um Bilder als Diashow anzuzeigen, klicken Sie ein Bild"
|
14
|
+
modal_slideshow:
|
15
|
+
counter: "%{counter} von %{count}"
|
@@ -16,10 +16,9 @@ module BlacklightGallery
|
|
16
16
|
|
17
17
|
def configuration
|
18
18
|
inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
|
19
|
-
"\n config.view.gallery
|
20
|
-
"\n
|
21
|
-
"\n config.view.
|
22
|
-
"\n config.view.slideshow.document_component = Blacklight::Gallery::SlideshowComponent" \
|
19
|
+
"\n config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)" \
|
20
|
+
"\n config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent)" \
|
21
|
+
"\n config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent)" \
|
23
22
|
"\n config.show.tile_source_field = :content_metadata_image_iiif_info_ssm" \
|
24
23
|
"\n config.show.partials.insert(1, :openseadragon)"
|
25
24
|
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(:
|
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)
|
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)
|
46
|
-
|
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
|
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)
|
63
|
-
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
gem 'sprockets', '< 4'
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe "catalog/openseadragon_default" do
|
4
4
|
let(:document) { SolrDocument.new }
|
5
5
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
6
|
-
let(:p) { "catalog/openseadragon_default
|
6
|
+
let(:p) { "catalog/openseadragon_default" }
|
7
7
|
|
8
8
|
before do
|
9
9
|
allow(view).to receive_messages(blacklight_config: blacklight_config, openseadragon_picture_tag: "<img />")
|
@@ -14,9 +14,9 @@ describe "catalog/openseadragon_default" do
|
|
14
14
|
render partial: p, locals: { document: document }
|
15
15
|
expect(rendered).to have_selector ".openseadragon-container"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
it "should support passing a container class" do
|
19
19
|
render partial: p, locals: { document: document, osd_container_class: "custom-container" }
|
20
20
|
expect(rendered).to have_selector ".custom-container"
|
21
21
|
end
|
22
|
-
end
|
22
|
+
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:
|
4
|
+
version: 4.0.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: 2022-
|
11
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: blacklight
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- app/views/catalog/_slideshow_modal.html.erb
|
263
263
|
- blacklight-gallery.gemspec
|
264
264
|
- config/locales/blacklight-gallery.ar.yml
|
265
|
+
- config/locales/blacklight-gallery.de.yml
|
265
266
|
- config/locales/blacklight-gallery.en.yml
|
266
267
|
- config/locales/blacklight-gallery.es.yml
|
267
268
|
- config/locales/blacklight-gallery.fr.yml
|