blacklight-gallery 1.7.0 → 3.0.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 +4 -4
- data/.github/workflows/ruby.yml +45 -0
- data/README.md +1 -1
- data/app/assets/images/blacklight/pause_slideshow.svg +1 -0
- data/app/assets/images/blacklight/start_slideshow.svg +1 -0
- data/app/assets/javascripts/blacklight_gallery/default.js +0 -1
- data/app/assets/javascripts/blacklight_gallery/masonry.js +1 -1
- data/app/assets/javascripts/blacklight_gallery/osd_viewer.js +1 -1
- data/app/assets/javascripts/blacklight_gallery/slideshow.js +11 -8
- data/app/assets/stylesheets/blacklight_gallery/_gallery.scss +11 -17
- data/app/assets/stylesheets/blacklight_gallery/_masonry.scss +55 -24
- data/app/assets/stylesheets/blacklight_gallery/_osd_viewer.scss +2 -2
- data/app/assets/stylesheets/blacklight_gallery/_slideshow.scss +11 -3
- data/app/components/blacklight/gallery/document_component.html.erb +20 -0
- data/app/components/blacklight/gallery/document_component.rb +11 -0
- data/app/components/blacklight/gallery/slideshow_component.html.erb +12 -0
- data/app/components/blacklight/gallery/slideshow_component.rb +40 -0
- data/app/components/blacklight/gallery/slideshow_preview_component.html.erb +5 -0
- data/app/components/blacklight/gallery/slideshow_preview_component.rb +28 -0
- data/app/helpers/blacklight/gallery_helper.rb +0 -38
- data/app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb +1 -1
- data/app/views/catalog/_document_gallery.html.erb +4 -3
- data/app/views/catalog/_document_masonry.html.erb +2 -3
- data/app/views/catalog/_document_slideshow.html.erb +26 -9
- data/app/views/catalog/_openseadragon_default.html.erb +14 -15
- data/app/views/catalog/_slideshow_modal.html.erb +2 -2
- data/blacklight-gallery.gemspec +4 -4
- data/config/locales/blacklight-gallery.ar.yml +8 -4
- data/config/locales/blacklight-gallery.en.yml +6 -2
- data/config/locales/blacklight-gallery.es.yml +3 -2
- data/config/locales/blacklight-gallery.fr.yml +3 -2
- data/config/locales/blacklight-gallery.it.yml +3 -2
- data/config/locales/blacklight-gallery.pt-BR.yml +3 -0
- data/config/locales/blacklight-gallery.zh.yml +3 -2
- data/lib/blacklight/gallery/engine.rb +0 -2
- data/lib/blacklight/gallery/version.rb +1 -1
- data/lib/generators/blacklight_gallery/install_generator.rb +10 -3
- data/lib/generators/blacklight_gallery/templates/blacklight_gallery.js +2 -1
- data/spec/components/blacklight/gallery/document_component_spec.rb +46 -0
- data/spec/components/blacklight/gallery/slideshow_component_spec.rb +67 -0
- data/spec/features/gallery_spec.rb +3 -4
- data/spec/features/masonry_spec.rb +2 -3
- data/spec/features/slideshow_spec.rb +0 -2
- data/spec/models/concerns/openseadragon_solr_document_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -11
- data/spec/views/catalog/_document_slideshow.html.erb_spec.rb +15 -5
- metadata +45 -39
- data/.travis.yml +0 -21
- data/app/views/catalog/_grid_slideshow.html.erb +0 -11
- data/app/views/catalog/_index_gallery.html.erb +0 -14
- data/app/views/catalog/_index_masonry.html.erb +0 -8
- data/app/views/catalog/_index_masonry_default.html.erb +0 -1
- data/app/views/catalog/_index_slideshow.html.erb +0 -11
- data/app/views/catalog/_slideshow.html.erb +0 -15
- data/spec/helpers/blacklight/gallery_helper_spec.rb +0 -110
- data/spec/views/catalog/_index_gallery.html.erb_spec.rb +0 -22
- data/spec/views/catalog/_index_masonry.html.erb_spec.rb +0 -34
@@ -4,8 +4,7 @@ describe "Gallery view", :type => :feature do
|
|
4
4
|
before { visit search_catalog_path :q => 'medicine', :view => 'gallery' }
|
5
5
|
|
6
6
|
it "should display results in a galley view" do
|
7
|
-
expect(page).to have_selector("#documents.gallery")
|
8
|
-
expect(page).to have_selector(".
|
9
|
-
expect(page).to have_content("Strong Medicine speaks")
|
7
|
+
expect(page).to have_selector("#documents.documents-gallery")
|
8
|
+
expect(page).to have_selector(".caption", text: "Strong Medicine speaks")
|
10
9
|
end
|
11
|
-
end
|
10
|
+
end
|
@@ -4,8 +4,7 @@ describe "Masonry view", :type => :feature do
|
|
4
4
|
before { visit search_catalog_path :q => 'medicine', :view => 'masonry' }
|
5
5
|
|
6
6
|
it "should display results in a galley view" do
|
7
|
-
expect(page).to have_selector("#documents
|
8
|
-
expect(page).to have_selector(
|
9
|
-
expect(page).to have_selector('.masonry.document .caption', text: "Strong Medicine speaks", visible: false)
|
7
|
+
expect(page).to have_selector("#documents.documents-masonry")
|
8
|
+
expect(page).to have_selector('.document .caption', text: "Strong Medicine speaks", visible: false)
|
10
9
|
end
|
11
10
|
end
|
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
describe "Slideshow", :js, :type => :feature do
|
4
4
|
|
5
5
|
it "should open when one of the grid panes are clicked" do
|
6
|
-
pending 'flappy test'
|
7
6
|
visit search_catalog_path( :q => 'medicine', :view => 'slideshow' )
|
8
7
|
expect(page).to have_content "You searched for:"
|
9
8
|
within ".view-type" do
|
@@ -11,7 +10,6 @@ describe "Slideshow", :js, :type => :feature do
|
|
11
10
|
end
|
12
11
|
|
13
12
|
find('.grid [data-slide-to="0"]').click
|
14
|
-
expect(page).to have_selector '#slideshow', visible: true
|
15
13
|
end
|
16
14
|
|
17
15
|
end
|
@@ -13,7 +13,7 @@ describe Blacklight::Gallery::OpenseadragonSolrDocument do
|
|
13
13
|
|
14
14
|
context 'when not configured for the view' do
|
15
15
|
let(:fields) { { some_field: 'data' } }
|
16
|
-
let(:view_config) { double('ViewConfig') }
|
16
|
+
let(:view_config) { double('ViewConfig', tile_source_field: nil) }
|
17
17
|
it 'returns nil' do
|
18
18
|
expect(subject).to be_nil
|
19
19
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,19 +9,11 @@ require 'rspec/rails'
|
|
9
9
|
require 'rspec/active_model/mocks'
|
10
10
|
|
11
11
|
require 'selenium-webdriver'
|
12
|
-
require '
|
12
|
+
require 'webdrivers'
|
13
13
|
|
14
|
-
Capybara.javascript_driver = :headless_chrome
|
15
14
|
|
16
|
-
Capybara.
|
17
|
-
|
18
|
-
chromeOptions: { args: %w[headless disable-gpu no-sandbox] }
|
19
|
-
)
|
20
|
-
|
21
|
-
Capybara::Selenium::Driver.new(app,
|
22
|
-
browser: :chrome,
|
23
|
-
desired_capabilities: capabilities)
|
24
|
-
end
|
15
|
+
Capybara.javascript_driver = :selenium_chrome_headless
|
16
|
+
Capybara.disable_animation = true
|
25
17
|
|
26
18
|
require 'blacklight'
|
27
19
|
require 'blacklight/gallery'
|
@@ -29,5 +21,6 @@ require 'blacklight/gallery'
|
|
29
21
|
RSpec.configure do |c|
|
30
22
|
c.infer_spec_type_from_file_location!
|
31
23
|
c.full_backtrace = true
|
24
|
+
c.include ViewComponent::TestHelpers, type: :component
|
32
25
|
#onfig.assets.precompile += %w(spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg)
|
33
26
|
end
|
@@ -1,17 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "catalog/_document_slideshow.html.erb", :type => :view do
|
4
|
-
let(:blacklight_config)
|
4
|
+
let(:blacklight_config) do
|
5
|
+
Blacklight::Configuration.new do |config|
|
6
|
+
config.track_search_session = false
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
10
|
let(:document) { stub_model(::SolrDocument) }
|
7
11
|
|
8
12
|
before do
|
9
|
-
allow(view).to receive_messages(
|
10
|
-
|
11
|
-
|
13
|
+
allow(view).to receive_messages(
|
14
|
+
blacklight_config: blacklight_config,
|
15
|
+
documents: [document],
|
16
|
+
document_index_view_type: 'slideshow',
|
17
|
+
document_counter_with_offset: 1
|
18
|
+
)
|
19
|
+
allow(view).to receive(:current_search_session).and_return(nil)
|
20
|
+
allow(view).to receive(:search_session).and_return({})
|
21
|
+
allow(view).to receive(:search_state).and_return(Blacklight::SearchState.new({}, blacklight_config))
|
12
22
|
end
|
13
23
|
|
14
|
-
it
|
24
|
+
it 'has a modal' do
|
15
25
|
render
|
16
26
|
expect(rendered).to have_selector '#slideshow-modal'
|
17
27
|
expect(rendered).to have_selector '[data-slide="prev"]'
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-gallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: blacklight
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
39
|
+
version: '7.12'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '7.
|
46
|
+
version: '7.12'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bootstrap
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +58,6 @@ dependencies:
|
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '4.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: openseadragon
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.2.0
|
69
61
|
- !ruby/object:Gem::Dependency
|
70
62
|
name: rake
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,7 +185,21 @@ dependencies:
|
|
193
185
|
- !ruby/object:Gem::Version
|
194
186
|
version: '0'
|
195
187
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
188
|
+
name: webdrivers
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: rexml
|
197
203
|
requirement: !ruby/object:Gem::Requirement
|
198
204
|
requirements:
|
199
205
|
- - ">="
|
@@ -220,16 +226,16 @@ dependencies:
|
|
220
226
|
- - ">="
|
221
227
|
- !ruby/object:Gem::Version
|
222
228
|
version: 3.13.1
|
223
|
-
description:
|
229
|
+
description:
|
224
230
|
email:
|
225
231
|
- cabeer@stanford.edu
|
226
232
|
executables: []
|
227
233
|
extensions: []
|
228
234
|
extra_rdoc_files: []
|
229
235
|
files:
|
236
|
+
- ".github/workflows/ruby.yml"
|
230
237
|
- ".gitignore"
|
231
238
|
- ".solr_wrapper.yml"
|
232
|
-
- ".travis.yml"
|
233
239
|
- Gemfile
|
234
240
|
- LICENSE.txt
|
235
241
|
- README.md
|
@@ -240,9 +246,11 @@ files:
|
|
240
246
|
- app/assets/images/blacklight/custom_fullscreen.svg
|
241
247
|
- app/assets/images/blacklight/gallery.svg
|
242
248
|
- app/assets/images/blacklight/masonry.svg
|
249
|
+
- app/assets/images/blacklight/pause_slideshow.svg
|
243
250
|
- app/assets/images/blacklight/remove_circle.svg
|
244
251
|
- app/assets/images/blacklight/resize_small.svg
|
245
252
|
- app/assets/images/blacklight/slideshow.svg
|
253
|
+
- app/assets/images/blacklight/start_slideshow.svg
|
246
254
|
- app/assets/javascripts/blacklight_gallery/default.js
|
247
255
|
- app/assets/javascripts/blacklight_gallery/masonry.js
|
248
256
|
- app/assets/javascripts/blacklight_gallery/osd_viewer.js
|
@@ -252,19 +260,19 @@ files:
|
|
252
260
|
- app/assets/stylesheets/blacklight_gallery/_osd_viewer.scss
|
253
261
|
- app/assets/stylesheets/blacklight_gallery/_slideshow.scss
|
254
262
|
- app/assets/stylesheets/blacklight_gallery/default.scss
|
263
|
+
- app/components/blacklight/gallery/document_component.html.erb
|
264
|
+
- app/components/blacklight/gallery/document_component.rb
|
265
|
+
- app/components/blacklight/gallery/slideshow_component.html.erb
|
266
|
+
- app/components/blacklight/gallery/slideshow_component.rb
|
267
|
+
- app/components/blacklight/gallery/slideshow_preview_component.html.erb
|
268
|
+
- app/components/blacklight/gallery/slideshow_preview_component.rb
|
255
269
|
- app/helpers/blacklight/gallery_helper.rb
|
256
270
|
- app/helpers/blacklight/openseadragon_helper.rb
|
257
271
|
- app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb
|
258
272
|
- app/views/catalog/_document_gallery.html.erb
|
259
273
|
- app/views/catalog/_document_masonry.html.erb
|
260
274
|
- app/views/catalog/_document_slideshow.html.erb
|
261
|
-
- app/views/catalog/_grid_slideshow.html.erb
|
262
|
-
- app/views/catalog/_index_gallery.html.erb
|
263
|
-
- app/views/catalog/_index_masonry.html.erb
|
264
|
-
- app/views/catalog/_index_masonry_default.html.erb
|
265
|
-
- app/views/catalog/_index_slideshow.html.erb
|
266
275
|
- app/views/catalog/_openseadragon_default.html.erb
|
267
|
-
- app/views/catalog/_slideshow.html.erb
|
268
276
|
- app/views/catalog/_slideshow_modal.html.erb
|
269
277
|
- blacklight-gallery.gemspec
|
270
278
|
- config/locales/blacklight-gallery.ar.yml
|
@@ -297,17 +305,16 @@ files:
|
|
297
305
|
- solr/conf/xslt/example_atom.xsl
|
298
306
|
- solr/conf/xslt/example_rss.xsl
|
299
307
|
- solr/conf/xslt/luke.xsl
|
308
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
309
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
300
310
|
- spec/features/gallery_spec.rb
|
301
311
|
- spec/features/masonry_spec.rb
|
302
312
|
- spec/features/slideshow_spec.rb
|
303
|
-
- spec/helpers/blacklight/gallery_helper_spec.rb
|
304
313
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
305
314
|
- spec/spec_helper.rb
|
306
315
|
- spec/test_app_templates/Gemfile.extra
|
307
316
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
308
317
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
309
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
310
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
311
318
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
312
319
|
- vendor/assets/javascripts/imagesloaded.min.js
|
313
320
|
- vendor/assets/javascripts/masonry.min.js
|
@@ -315,7 +322,7 @@ homepage: https://github.com/projectblacklight/blacklight-gallery
|
|
315
322
|
licenses:
|
316
323
|
- Apache 2.0
|
317
324
|
metadata: {}
|
318
|
-
post_install_message:
|
325
|
+
post_install_message:
|
319
326
|
rdoc_options: []
|
320
327
|
require_paths:
|
321
328
|
- lib
|
@@ -330,20 +337,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
337
|
- !ruby/object:Gem::Version
|
331
338
|
version: '0'
|
332
339
|
requirements: []
|
333
|
-
rubygems_version: 3.
|
334
|
-
signing_key:
|
340
|
+
rubygems_version: 3.2.3
|
341
|
+
signing_key:
|
335
342
|
specification_version: 4
|
336
343
|
summary: Gallery display for Blacklight
|
337
344
|
test_files:
|
345
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
346
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
338
347
|
- spec/features/gallery_spec.rb
|
339
348
|
- spec/features/masonry_spec.rb
|
340
349
|
- spec/features/slideshow_spec.rb
|
341
|
-
- spec/helpers/blacklight/gallery_helper_spec.rb
|
342
350
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
343
351
|
- spec/spec_helper.rb
|
344
352
|
- spec/test_app_templates/Gemfile.extra
|
345
353
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
346
354
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
347
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
348
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
349
355
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
notifications:
|
5
|
-
email: false
|
6
|
-
|
7
|
-
rvm:
|
8
|
-
- 2.5.3
|
9
|
-
- 2.6.0
|
10
|
-
|
11
|
-
notifications:
|
12
|
-
irc: "irc.freenode.org#blacklight"
|
13
|
-
email:
|
14
|
-
- blacklight-commits@googlegroups.com
|
15
|
-
|
16
|
-
env:
|
17
|
-
global:
|
18
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
19
|
-
- RAILS_VERSION='5.2.3'
|
20
|
-
|
21
|
-
jdk: openjdk11
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div class="document">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= link_to '#', data: { :'slide-to' => document_counter, toggle: "modal", target: "#slideshow-modal" } do %>
|
4
|
-
<% if thumbnail_url(document) %>
|
5
|
-
<%= image_tag thumbnail_url(document), class: 'img-thumbnail' %>
|
6
|
-
<% else %>
|
7
|
-
<%= t('.missing_image', scope: [:blacklight_gallery]) %>
|
8
|
-
<% end %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div class="document col-6 col-md-4">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= render_thumbnail_tag(
|
4
|
-
document,
|
5
|
-
{ class: 'img-thumbnail', alt: '' },
|
6
|
-
counter: document_counter_with_offset(document_counter),
|
7
|
-
'aria-hidden': true,
|
8
|
-
tabindex: -1
|
9
|
-
) %>
|
10
|
-
<div class="caption">
|
11
|
-
<%= render_document_partials document, blacklight_config.view_config(:gallery).partials, :document_counter => document_counter %>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="masonry document col-6 col-md-3">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= render_thumbnail_tag(document, { class: 'img-thumbnail', alt: index_presenter(document).heading }, counter: document_counter_with_offset(document_counter)) %>
|
4
|
-
<div class="caption">
|
5
|
-
<%= render_document_partials document, blacklight_config.view_config(:masonry).partials, :document_counter => document_counter %>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= link_to_document(document, truncate(index_presenter(document).label(document_show_link_field(document)), length: 89)) %>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div class="item<%= ' active' if document_counter == 0 %>">
|
2
|
-
<div class="frame">
|
3
|
-
<%= render_slideshow_tag(document) %>
|
4
|
-
<div class="caption">
|
5
|
-
<%= index_presenter(document).label(document_show_link_field(document)) %>
|
6
|
-
</div>
|
7
|
-
<span class="counter">
|
8
|
-
<%= t :'blacklight_gallery.catalog.modal_slideshow.counter', counter: document_counter + 1, count: count %>
|
9
|
-
</span>
|
10
|
-
</div>
|
11
|
-
</div>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<div id="slideshow" class="slideshow-presenter">
|
2
|
-
<!-- Wrapper for slides -->
|
3
|
-
<div class="slideshow-inner">
|
4
|
-
<%= render collection: documents, as: :document, partial: 'index_slideshow', locals: {count: documents.count} %>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<!-- Controls -->
|
8
|
-
<a class="left carousel-control prev" href="#slideshow" data-slide="prev">
|
9
|
-
<%= blacklight_icon 'chevron_left' %>
|
10
|
-
</a>
|
11
|
-
<a class="right carousel-control next" href="#slideshow" data-slide="next">
|
12
|
-
<%= blacklight_icon 'chevron_right' %>
|
13
|
-
</a>
|
14
|
-
|
15
|
-
</div>
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Blacklight::GalleryHelper, :type => :helper do
|
4
|
-
before do
|
5
|
-
allow(helper).to receive(:blacklight_configuration_context).and_return(double(evaluate_if_unless_configuration: true))
|
6
|
-
end
|
7
|
-
describe "#render_gallery_collection" do
|
8
|
-
let(:template) { double }
|
9
|
-
before do
|
10
|
-
allow(template).to receive(:render).and_return("hello ")
|
11
|
-
allow(helper).to receive(:gallery_wrapper_template).and_return(template)
|
12
|
-
end
|
13
|
-
let(:documents) { [ double, double] }
|
14
|
-
subject { helper.render_gallery_collection documents}
|
15
|
-
|
16
|
-
it { is_expected.to eq 'hello hello ' }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#gallery_wrapper_template" do
|
20
|
-
before do
|
21
|
-
allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
22
|
-
helper.lookup_context.prefixes << "catalog"
|
23
|
-
end
|
24
|
-
|
25
|
-
subject { helper.gallery_wrapper_template SolrDocument.new }
|
26
|
-
|
27
|
-
it "should be the default template" do
|
28
|
-
expect(subject.virtual_path).to eq 'catalog/_index_gallery'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "render_slideshow_tag" do
|
33
|
-
let(:document) { instance_double(SolrDocument) }
|
34
|
-
|
35
|
-
it "calls the provided slideshow method" do
|
36
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
37
|
-
expect(helper).to receive_messages(:xyz => "some-slideshow")
|
38
|
-
expect(helper.render_slideshow_tag(document)).to eq 'some-slideshow'
|
39
|
-
end
|
40
|
-
|
41
|
-
it "creates an image tag from the given field" do
|
42
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
43
|
-
|
44
|
-
allow(document).to receive(:has?).with(:xyz).and_return(true)
|
45
|
-
allow(document).to receive(:first).with(:xyz).and_return("http://example.com/some.jpg")
|
46
|
-
expect(helper.render_slideshow_tag(document)).to match /img/
|
47
|
-
end
|
48
|
-
|
49
|
-
it "does not link to the document if the url options are false" do
|
50
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
51
|
-
allow(helper).to receive_messages(:xyz => "some-slideshow")
|
52
|
-
|
53
|
-
result = helper.render_slideshow_tag document, {}, false
|
54
|
-
expect(result).to eq "some-slideshow"
|
55
|
-
end
|
56
|
-
|
57
|
-
it "does not link to the document if the url options have :suppress_link" do
|
58
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
59
|
-
allow(helper).to receive_messages(:xyz => "some-slideshow")
|
60
|
-
|
61
|
-
result = helper.render_slideshow_tag document, {}, suppress_link: true
|
62
|
-
expect(result).to eq "some-slideshow"
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
it "returns nil if no slideshow is available" do
|
67
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new)
|
68
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it "returns nil if no slideshow is returned from the slideshow method" do
|
72
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
73
|
-
allow(helper).to receive_messages(:xyz => nil)
|
74
|
-
|
75
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
it "returns nil if no slideshow is in the document" do
|
79
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
80
|
-
|
81
|
-
allow(document).to receive(:has?).with(:xyz).and_return(false)
|
82
|
-
|
83
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
84
|
-
end
|
85
|
-
|
86
|
-
it "falls back to a thumbnail" do
|
87
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.thumbnail_method = :xyz })
|
88
|
-
allow(helper).to receive(:xyz).and_return('thumbnail-image')
|
89
|
-
|
90
|
-
expect(helper.render_slideshow_tag document).to eq 'thumbnail-image'
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "slideshow_url" do
|
95
|
-
it "pulls the configured slideshow field out of the document" do
|
96
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
97
|
-
document = instance_double(SolrDocument)
|
98
|
-
allow(document).to receive(:has?).with(:xyz).and_return(true)
|
99
|
-
allow(document).to receive(:first).with(:xyz).and_return("asdf")
|
100
|
-
expect(helper.slideshow_image_url document).to eq("asdf")
|
101
|
-
end
|
102
|
-
|
103
|
-
it "returns nil if the slideshow field doesn't exist" do
|
104
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
105
|
-
document = instance_double(SolrDocument)
|
106
|
-
allow(document).to receive(:has?).with(:xyz).and_return(false)
|
107
|
-
expect(helper.slideshow_image_url document).to be_nil
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|