blacklight-gallery 4.0.2 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +30 -10
  3. data/Gemfile +11 -12
  4. data/app/assets/images/blacklight/pause_slideshow.svg +1 -1
  5. data/app/components/blacklight/gallery/document_component.html.erb +5 -1
  6. data/app/components/blacklight/gallery/icons/add_circle_component.rb +18 -0
  7. data/app/components/blacklight/gallery/icons/chevron_left_component.rb +18 -0
  8. data/app/components/blacklight/gallery/icons/chevron_right_component.rb +18 -0
  9. data/app/components/blacklight/gallery/icons/custom_fullscreen_component.rb +18 -0
  10. data/app/components/blacklight/gallery/icons/gallery_component.rb +18 -0
  11. data/app/components/blacklight/gallery/icons/masonry_component.rb +18 -0
  12. data/app/components/blacklight/gallery/icons/pause_slideshow_component.rb +18 -0
  13. data/app/components/blacklight/gallery/icons/remove_circle_component.rb +18 -0
  14. data/app/components/blacklight/gallery/icons/resize_small_component.rb +18 -0
  15. data/app/components/blacklight/gallery/icons/slideshow_component.rb +18 -0
  16. data/app/components/blacklight/gallery/icons/start_slideshow_component.rb +18 -0
  17. data/app/components/blacklight/gallery/slideshow_preview_component.html.erb +5 -1
  18. data/app/views/catalog/_document_gallery.html.erb +2 -1
  19. data/app/views/catalog/_document_masonry.html.erb +2 -1
  20. data/app/views/catalog/_document_slideshow.html.erb +7 -6
  21. data/app/views/catalog/_openseadragon_default.html.erb +6 -6
  22. data/blacklight-gallery.gemspec +3 -4
  23. data/lib/blacklight/gallery/version.rb +1 -1
  24. data/lib/generators/blacklight_gallery/install_generator.rb +12 -12
  25. data/package.json +26 -0
  26. data/spec/components/blacklight/gallery/document_component_spec.rb +12 -2
  27. data/spec/components/blacklight/gallery/slideshow_component_spec.rb +31 -7
  28. data/spec/components/blacklight/gallery/slideshow_preview_component_spec.rb +12 -3
  29. data/spec/features/gallery_spec.rb +2 -2
  30. data/spec/test_app_templates/Gemfile.extra +5 -0
  31. data/spec/views/catalog/_document_slideshow.html.erb_spec.rb +9 -3
  32. metadata +27 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ffebc1b8d0949d7deaed3ce7d7391815ff694a5c9fe9581043bef8c37917ff3
4
- data.tar.gz: 7e7d766b8d517268b2dd5a5a3b018e02fcac14b1a3730ee62d49d865798156e6
3
+ metadata.gz: d46a1601796a187729339ce0655d2537db43a7319608a2de67cd763b38fcbdcd
4
+ data.tar.gz: b9f28ea874c0908cfc9e19f7134b7dfc29779ed5c7865af8f96f1becab54a478
5
5
  SHA512:
6
- metadata.gz: d344db0389fd834cc709f14af45f215fadcaf3c40b0e2dcc46b40121caa9f7ab60b19cf06b657dde1338c46ab99f5cb2eae1d6e64c9735a0f54b919135743b75
7
- data.tar.gz: 54c51080b3476aaa4d58601623453cfb33d0716c0d8f9f4dd785b46801cc569d2974ad7e373f928dc7468c08d59db8059d8608b798ed6a9b2e5b508c97a53729
6
+ metadata.gz: 38912a52ab2cc3a35ec137d5e326e4e92f90228dd8254f9fa7526dc5f565945c08aefe3fcda4d028191dea8a7615b3073865e3c513a1701824deef9a3d4b092f
7
+ data.tar.gz: 76f328cf6da35f629a2ce99396ec89be2b5d97331f38daee12574201b9a21392f09b366ff38e099b4510bf380a3ed40a9a74509e7be384455d99fb865a73c7b6
@@ -2,26 +2,46 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches: [ main ]
6
6
  pull_request:
7
- branches: [ master ]
7
+ branches: [ main ]
8
8
 
9
9
  jobs:
10
10
  test:
11
11
  runs-on: ubuntu-latest
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }} / blacklight ${{ matrix.blacklight_version }} ${{ matrix.additional_name }})
12
14
  strategy:
13
15
  matrix:
14
- rails_version: [6.1.4.6]
15
- ruby: ['2.7', '3.0']
16
+ ruby: [2.7, '3.0']
17
+ rails_version: ['6.1.7', '7.0.4']
18
+ blacklight_version: ['~> 7.0']
19
+ experimental: [false]
20
+ additional_engine_cart_rails_options: ['']
21
+ additional_name: ['']
16
22
  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'
23
+ - ruby: '3.1'
24
+ rails_version: '7.0.4'
25
+ blacklight_version: '~> 7.0'
26
+ experimental: false
27
+ - ruby: '3.1'
28
+ rails_version: '7.0.4'
29
+ blacklight_version: '8.0.0.beta6'
30
+ experimental: false
31
+ - ruby: '3.1'
32
+ rails_version: '7.0.4'
33
+ blacklight_version: 'github'
34
+ experimental: true
35
+ - ruby: '3.1'
36
+ rails_version: '7.0.4'
37
+ blacklight_version: 'github'
38
+ experimental: true
39
+ additional_engine_cart_rails_options: -a propshaft
40
+ additional_name: '/ Propshaft'
23
41
  env:
24
42
  RAILS_VERSION: ${{ matrix.rails_version }}
43
+ BLACKLIGHT_VERSION: ${{ matrix.blacklight_version }}
44
+ ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test ${{ matrix.additional_engine_cart_rails_options }}"
25
45
  steps:
26
46
  - uses: actions/checkout@v2
27
47
  - name: Set up Ruby ${{ matrix.ruby }}
data/Gemfile CHANGED
@@ -11,8 +11,8 @@ end
11
11
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
12
12
 
13
13
  # BEGIN ENGINE_CART BLOCK
14
- # engine_cart: 1.1.0
15
- # engine_cart stanza: 0.10.0
14
+ # engine_cart: 2.5.0
15
+ # engine_cart stanza: 2.5.0
16
16
  # the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
17
17
  file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
18
18
  if File.exist?(file)
@@ -32,17 +32,16 @@ else
32
32
  else
33
33
  gem 'rails', ENV['RAILS_VERSION']
34
34
  end
35
- end
36
35
 
37
- case ENV['RAILS_VERSION']
38
- when /^5.[12]/
39
- gem 'sass-rails', '~> 5.0'
40
- when /^4.2/
41
- gem 'responders', '~> 2.0'
42
- gem 'sass-rails', '>= 5.0'
43
- gem 'coffee-rails', '~> 4.1.0'
44
- when /^4.[01]/
45
- gem 'sass-rails', '< 5.0'
36
+ case ENV['RAILS_VERSION']
37
+ when /^6.0/
38
+ gem 'sass-rails', '>= 6'
39
+ gem 'webpacker', '~> 4.0'
40
+ when /^5.[12]/
41
+ gem 'sass-rails', '~> 5.0'
42
+ gem 'sprockets', '~> 3.7'
43
+ gem 'thor', '~> 0.20'
44
+ end
46
45
  end
47
46
  end
48
47
  # END ENGINE_CART BLOCK
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 14H9V8h2v8zm4 0h-2V8h2v8z"></path></svg
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 14H9V8h2v8zm4 0h-2V8h2v8z"></path></svg>
@@ -1,4 +1,8 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
1
+ <% component = Blacklight::VERSION > '8' ?
2
+ Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @presenter, counter: @counter) :
3
+ Blacklight::DocumentComponent.new(classes: 'col', component: :div, document: @document, presenter: @presenter, counter: @counter)
4
+ %>
5
+ <%= render(component) do |component| %>
2
6
  <% component.body do %>
3
7
  <div class="thumbnail-container">
4
8
  <%= thumbnail %>
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the icon for the add button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::AddCircleComponent.svg = '<svg>your SVG here</svg>'
9
+ class AddCircleComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::ChevronLeftComponent.svg = '<svg>your SVG here</svg>'
9
+ class ChevronLeftComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::ChevronRightComponent.svg = '<svg>your SVG here</svg>'
9
+ class ChevronRightComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the icon for the fullscreen button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::CustomFullscreenComponent.svg = '<svg>your SVG here</svg>'
9
+ class CustomFullscreenComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path d="M7,14H5v5h5V17H7Zm7-9V7h3v3h2V5Z" /><path d="M22.517,1.524H1.736V22.37H22.517Zm-2,18.845H3.736V3.524H20.517Z" />
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::GalleryComponent.svg = '<svg>your SVG here</svg>'
9
+ class GalleryComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M4 11h5V5H4v6zm0 7h5v-6H4v6zm6 0h5v-6h-5v6zm6 0h5v-6h-5v6zm-6-7h5V5h-5v6zm6-6v6h5V5h-5z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::MasonryComponent.svg = '<svg>your SVG here</svg>'
9
+ class MasonryComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M10 18h5v-6h-5v6zm-6 0h5V5H4v13zm12 0h5v-6h-5v6zM10 5v6h11V5H10z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::PauseSlideshowComponent.svg = '<svg>your SVG here</svg>'
9
+ class PauseSlideshowComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 14H9V8h2v8zm4 0h-2V8h2v8z"></path>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the icon for the remove button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::RemoveCircleComponent.svg = '<svg>your SVG here</svg>'
9
+ class RemoveCircleComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path fill="none" d="M0 0h24v24H0V0z"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the icon for the resize button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::ResizeSmallComponent.svg = '<svg>your SVG here</svg>'
9
+ class ResizeSmallComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path d="M5,16H8v3h2V14H5ZM16,8V5H14v5h5V8Z"/><path d="M22.517,1.524H1.736V22.37H22.517Zm-2,18.845H3.736V3.524H20.517Z"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::SlideshowComponent.svg = '<svg>your SVG here</svg>'
9
+ class SlideshowComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 25 24">
12
+ <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"/>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Gallery
5
+ module Icons
6
+ # This is the gallery icon for the view type button.
7
+ # You can override the default svg by setting:
8
+ # Blacklight::Gallery:Icons::StartSlideshowComponent.svg = '<svg>your SVG here</svg>'
9
+ class StartSlideshowComponent < Blacklight::Icons::IconComponent
10
+ self.svg = <<~SVG
11
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
12
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"></path>
13
+ </svg>
14
+ SVG
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,8 @@
1
- <%= render(Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, counter: @counter, presenter: @presenter)) do |component| %>
1
+ <% component = Blacklight::VERSION > '8' ?
2
+ Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @presenter, counter: @counter) :
3
+ Blacklight::DocumentComponent.new(classes: 'slideshow-preview-thumbnail', component: :div, document: @document, presenter: @presenter, counter: @counter)
4
+ %>
5
+ <%= render(component) do |component| %>
2
6
  <% component.body do %>
3
7
  <%= @view_context.link_to_document(@document, thumbnail, class: 'thumbnail', data: { 'context-href': nil, 'slide-to': @document_counter - 1, toggle: "modal", target: "#slideshow-modal" }) %>
4
8
  <% end %>
@@ -1,6 +1,7 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
  <div class="container">
3
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
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |doc| document_presenter(doc) } : documents %>
5
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
5
6
  </div>
6
7
  </div>
@@ -1,4 +1,5 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
  <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
3
- <%= render documents, as: :document, view_config: view_config %>
3
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |doc| document_presenter(doc) } : documents%>
4
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
4
5
  </div>
@@ -1,31 +1,32 @@
1
1
  <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
2
2
 
3
3
  <div id="documents" class="<%= (Array(view_config.classes) + ["documents-#{view_config.key}"]).join(' ') %>">
4
+ <% document_presenters = Blacklight::VERSION > '8' ? documents.map { |document| document_presenter(document) }: documents %>
4
5
  <div class="grid">
5
- <%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(documents)) %>
6
+ <%= render((view_config.preview_component || Blacklight::Gallery::SlideshowPreviewComponent).with_collection(document_presenters)) %>
6
7
  </div>
7
8
 
8
9
  <%= render layout: 'slideshow_modal' do %>
9
10
  <div id="slideshow" class="slideshow-presenter">
10
11
  <!-- Wrapper for slides -->
11
12
  <div class="slideshow-inner">
12
- <%= render documents, as: :document %>
13
+ <%= render view_config.document_component.with_collection(document_presenters, counter_offset: @response&.start || 0) %>
13
14
  </div>
14
15
 
15
16
  <!-- Controls -->
16
17
  <a class="left carousel-control prev" href="#slideshow" data-slide="prev">
17
- <%= blacklight_icon 'chevron_left', additional_options: { label_context: 'previous_image' } %>
18
+ <%= render Blacklight::Gallery::Icons::ChevronLeftComponent.new additional_options: { label_context: 'previous_image' } %>
18
19
  </a>
19
20
  <a class="right carousel-control next" href="#slideshow" data-slide="next">
20
- <%= blacklight_icon 'chevron_right', additional_options: { label_context: 'next_image' } %>
21
+ <%= render Blacklight::Gallery::Icons::ChevronRightComponent.new additional_options: { label_context: 'next_image' } %>
21
22
  </a>
22
23
 
23
24
  <div class="controls text-center">
24
25
  <button class="btn btn-sm btn-link" data-behavior="pause-slideshow" aria-label="<%= t('blacklight_gallery.catalog.slideshow.pause') %>">
25
- <%= blacklight_icon 'pause_slideshow' %>
26
+ <%= render Blacklight::Gallery::Icons::PauseSlideshowComponent.new %>
26
27
  </button>
27
28
  <button class="btn btn-sm btn-link" data-behavior="start-slideshow" aria-label="<%= t('blacklight_gallery.catalog.slideshow.start') %>">
28
- <%= blacklight_icon 'start_slideshow' %>
29
+ <%= render Blacklight::Gallery::Icons::StartSlideshowComponent.new %>
29
30
  </button>
30
31
  </div>
31
32
  </div>
@@ -29,16 +29,16 @@
29
29
  <div class="col-md-6 pagination">
30
30
  <% if count > 1 %>
31
31
  <% osd_config = osd_config_referencestrip.merge(osd_config) %>
32
- <a id="<%= id_prefix %>-previous"><%= blacklight_icon('chevron_left') %></a>
32
+ <a id="<%= id_prefix %>-previous"><%= render Blacklight::Gallery::Icons::ChevronLeftComponent.new %></a>
33
33
  <span id="<%= id_prefix %>-page">1</span> of <%= count %>
34
- <a id="<%= id_prefix %>-next"><%= blacklight_icon('chevron_right') %></a>
34
+ <a id="<%= id_prefix %>-next"><%= render Blacklight::Gallery::Icons::ChevronRightComponent.new %></a>
35
35
  <% end %>
36
36
  </div>
37
37
  <div class="col-md-6 controls">
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>
38
+ <a id="<%= id_prefix %>-zoom-in"><%= render Blacklight::Gallery::Icons::AddCircleComponent.new %></a>
39
+ <a id="<%= id_prefix %>-zoom-out"><%= render Blacklight::Gallery::Icons::RemoveCircleComponent.new %></a>
40
+ <a id="<%= id_prefix %>-home"><%= render Blacklight::Gallery::Icons::ResizeSmallComponent.new %></a>
41
+ <a id="<%= id_prefix %>-full-page"><%= render Blacklight::Gallery::Icons::CustomFullscreenComponent.new %></a>
42
42
  </div>
43
43
  </div>
44
44
  <%= openseadragon_picture_tag image, class: 'osd-image row', data: { openseadragon: osd_config } %>
@@ -17,12 +17,12 @@ 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', '< 8'
21
- spec.add_dependency 'blacklight', '~> 7.17'
20
+ spec.add_dependency "rails", '>= 6.1', '< 8'
21
+ spec.add_dependency 'blacklight', '>= 7.17', '< 9'
22
22
 
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency 'sqlite3'
25
- spec.add_development_dependency "rspec-rails", "~> 3.1"
25
+ spec.add_development_dependency "rspec-rails", "~> 6"
26
26
  spec.add_development_dependency "rspec-its"
27
27
  spec.add_development_dependency "rspec-activemodel-mocks"
28
28
  spec.add_development_dependency "rspec-collection_matchers"
@@ -30,6 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "engine_cart", "~> 2.0"
31
31
  spec.add_development_dependency "capybara"
32
32
  spec.add_development_dependency 'webdrivers'
33
- spec.add_development_dependency 'rexml' # pending https://github.com/SeleniumHQ/selenium/issues/9001
34
33
  spec.add_development_dependency "selenium-webdriver", '>= 3.13.1'
35
34
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Gallery
3
- VERSION = "4.0.2"
3
+ VERSION = "4.2.0"
4
4
  end
5
5
  end
@@ -5,20 +5,11 @@ module BlacklightGallery
5
5
 
6
6
  source_root File.expand_path('../templates', __FILE__)
7
7
 
8
- def assets
9
- copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
10
- copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
11
-
12
- insert_into_file "app/assets/javascripts/application.js", after: '//= require blacklight/blacklight' do
13
- "\n//= require blacklight_gallery"
14
- end
15
- end
16
-
17
8
  def configuration
18
9
  inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
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)" \
10
+ "\n config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::GalleryComponent)" \
11
+ "\n config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent, icon: Blacklight::Gallery::Icons::MasonryComponent)" \
12
+ "\n config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent, icon: Blacklight::Gallery::Icons::SlideshowComponent)" \
22
13
  "\n config.show.tile_source_field = :content_metadata_image_iiif_info_ssm" \
23
14
  "\n config.show.partials.insert(1, :openseadragon)"
24
15
  end
@@ -35,5 +26,14 @@ module BlacklightGallery
35
26
  Bundler.with_clean_env { run 'bundle install' }
36
27
  generate 'openseadragon:install'
37
28
  end
29
+
30
+ def assets
31
+ copy_file "blacklight_gallery.css.scss", "app/assets/stylesheets/blacklight_gallery.css.scss"
32
+ copy_file "blacklight_gallery.js", "app/assets/javascripts/blacklight_gallery.js"
33
+
34
+ insert_into_file "app/assets/javascripts/application.js", after: '//= require blacklight/blacklight' do
35
+ "\n//= require blacklight_gallery"
36
+ end
37
+ end
38
38
  end
39
39
  end
data/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "blacklight-gallery",
3
+ "version": "4.2.0",
4
+ "description": "Gallery views for Blacklight search results",
5
+ "main": "app/assets/javascripts/blacklight_gallery/default.js",
6
+ "files": [
7
+ "app/assets/javascripts/blacklight_gallery/*.js",
8
+ "vendor/assets/javascripts/*.js",
9
+ "app/assets/stylesheets/blacklight_gallery/*.scss"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/projectblacklight/blacklight-gallery.git"
14
+ },
15
+ "author": "",
16
+ "license": "Apache-2.0",
17
+ "bugs": {
18
+ "url": "https://github.com/projectblacklight/blacklight-gallery/issues"
19
+ },
20
+ "homepage": "https://github.com/projectblacklight/blacklight-gallery#readme",
21
+ "devDependencies": { },
22
+ "dependencies": {
23
+ "blacklight-frontend": ">=7.1.0-alpha",
24
+ "jquery": ">=3.0"
25
+ }
26
+ }
@@ -3,7 +3,13 @@
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, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, **attr)
9
+ else
10
+ described_class.new(document: document, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -27,7 +33,11 @@ RSpec.describe Blacklight::Gallery::DocumentComponent, type: :component do
27
33
 
28
34
  let(:blacklight_config) do
29
35
  CatalogController.blacklight_config.deep_copy.tap do |config|
30
- config.track_search_session = false
36
+ if Blacklight::VERSION > '8'
37
+ config.track_search_session.storage = false
38
+ else
39
+ config.track_search_session = false
40
+ end
31
41
  config.index.thumbnail_field = 'thumbnail_path_ss'
32
42
  end
33
43
  end
@@ -3,7 +3,13 @@
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, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, **attr)
9
+ else
10
+ described_class.new(document: document, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -36,7 +42,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
36
42
  let(:blacklight_config) do
37
43
  Blacklight::Configuration.new.tap do |config|
38
44
  config.index.slideshow_method = :xyz
39
- config.track_search_session = false
45
+ if Blacklight::VERSION > '8'
46
+ config.track_search_session.storage = false
47
+ else
48
+ config.track_search_session = false
49
+ end
40
50
  end
41
51
  end
42
52
 
@@ -55,7 +65,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
55
65
  let(:blacklight_config) do
56
66
  Blacklight::Configuration.new.tap do |config|
57
67
  config.index.slideshow_field = :xyz
58
- config.track_search_session = false
68
+ if Blacklight::VERSION > '8'
69
+ config.track_search_session.storage = false
70
+ else
71
+ config.track_search_session = false
72
+ end
59
73
  end
60
74
  end
61
75
  let(:document) { SolrDocument.new({ xyz: 'http://example.com/some.jpg', id: 'x' }) }
@@ -70,9 +84,15 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
70
84
  end
71
85
 
72
86
  context 'with no view_config' do
73
- let(:blacklight_config) { Blacklight::Configuration.new.tap { |config|
74
- config.track_search_session = false
75
- } }
87
+ let(:blacklight_config) do
88
+ Blacklight::Configuration.new.tap do |config|
89
+ if Blacklight::VERSION > '8'
90
+ config.track_search_session.storage = false
91
+ else
92
+ config.track_search_session = false
93
+ end
94
+ end
95
+ end
76
96
  it { is_expected.not_to have_selector 'img' }
77
97
  end
78
98
 
@@ -80,7 +100,11 @@ RSpec.describe Blacklight::Gallery::SlideshowComponent, type: :component do
80
100
  let(:blacklight_config) do
81
101
  Blacklight::Configuration.new.tap do |config|
82
102
  config.index.thumbnail_field = :xyz
83
- config.track_search_session = false
103
+ if Blacklight::VERSION > '8'
104
+ config.track_search_session.storage = false
105
+ else
106
+ config.track_search_session = false
107
+ end
84
108
  end
85
109
  end
86
110
  let(:document) { SolrDocument.new({ xyz: 'http://example.com/thumb.jpg', id: 'x' }) }
@@ -3,7 +3,13 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component do
6
- subject(:component) { described_class.new(document: document, document_counter: 5, presenter: presenter, **attr) }
6
+ subject(:component) do
7
+ if Blacklight::VERSION > '8'
8
+ described_class.new(document: presenter, document_counter: 5, **attr)
9
+ else
10
+ described_class.new(document: document, document_counter: 5, presenter: presenter, **attr)
11
+ end
12
+ end
7
13
 
8
14
  let(:attr) { {} }
9
15
  let(:view_context) { controller.view_context }
@@ -30,7 +36,11 @@ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component
30
36
  let(:blacklight_config) do
31
37
  Blacklight::Configuration.new.tap do |config|
32
38
  config.index.thumbnail_field = 'thumbnail_path_ss'
33
- config.track_search_session = false
39
+ if Blacklight::VERSION > '8'
40
+ config.track_search_session.storage = false
41
+ else
42
+ config.track_search_session = false
43
+ end
34
44
  end
35
45
  end
36
46
 
@@ -38,7 +48,6 @@ RSpec.describe Blacklight::Gallery::SlideshowPreviewComponent, type: :component
38
48
  let(:document) { SolrDocument.new(id: 'abc', thumbnail_path_ss: 'http://example.com/image.jpg') }
39
49
 
40
50
  it 'renders the thumbnail' do
41
- puts render
42
51
  expect(rendered).to have_selector '.thumbnail img[@src="http://example.com/image.jpg"]'
43
52
  end
44
53
 
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Gallery view", :type => :feature do
3
+ RSpec.describe "Gallery view", :type => :feature do
4
4
  before { visit search_catalog_path :q => 'medicine', :view => 'gallery' }
5
5
 
6
- it "should display results in a galley view" do
6
+ it "displays results in a galley view" do
7
7
  expect(page).to have_selector("#documents.documents-gallery")
8
8
  expect(page).to have_selector(".caption", text: "Strong Medicine speaks")
9
9
  end
@@ -0,0 +1,5 @@
1
+ if ENV['BLACKLIGHT_VERSION'] == 'github'
2
+ gem 'blacklight', github: 'projectblacklight/blacklight'
3
+ elsif ENV['BLACKLIGHT_VERSION'] && !ENV['BLACKLIGHT_VERSION'].empty?
4
+ gem 'blacklight', ENV['BLACKLIGHT_VERSION']
5
+ end
@@ -1,13 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "catalog/_document_slideshow", :type => :view do
3
+ RSpec.describe "catalog/_document_slideshow", :type => :view do
4
4
  let(:blacklight_config) do
5
5
  Blacklight::Configuration.new do |config|
6
- config.track_search_session = false
6
+ if Blacklight::VERSION > '8'
7
+ config.track_search_session.storage = false
8
+ else
9
+ config.track_search_session = false
10
+ end
7
11
  end
8
12
  end
9
13
 
10
14
  let(:document) { stub_model(::SolrDocument) }
15
+ let(:view_config) { Blacklight::Configuration::ViewConfig.new(document_component: Blacklight::Gallery::SlideshowComponent) }
11
16
 
12
17
  before do
13
18
  allow(view).to receive_messages(
@@ -19,10 +24,11 @@ describe "catalog/_document_slideshow", :type => :view do
19
24
  allow(view).to receive(:current_search_session).and_return(nil)
20
25
  allow(view).to receive(:search_session).and_return({})
21
26
  allow(view).to receive(:search_state).and_return(Blacklight::SearchState.new({}, blacklight_config))
27
+ @response = instance_double(Blacklight::Solr::Response, start: 0)
22
28
  end
23
29
 
24
30
  it 'has a modal' do
25
- render
31
+ render 'catalog/document_slideshow', view_config: view_config
26
32
  expect(rendered).to have_selector '#slideshow-modal'
27
33
  expect(rendered).to have_selector '[data-slide="prev"]'
28
34
  expect(rendered).to have_selector '[data-slide="next"]'
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.0.2
4
+ version: 4.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: 2022-10-25 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '5.1'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: blacklight
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '7.17'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '9'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '7.17'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '9'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: rake
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +84,14 @@ dependencies:
78
84
  requirements:
79
85
  - - "~>"
80
86
  - !ruby/object:Gem::Version
81
- version: '3.1'
87
+ version: '6'
82
88
  type: :development
83
89
  prerelease: false
84
90
  version_requirements: !ruby/object:Gem::Requirement
85
91
  requirements:
86
92
  - - "~>"
87
93
  - !ruby/object:Gem::Version
88
- version: '3.1'
94
+ version: '6'
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: rspec-its
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -184,20 +190,6 @@ dependencies:
184
190
  - - ">="
185
191
  - !ruby/object:Gem::Version
186
192
  version: '0'
187
- - !ruby/object:Gem::Dependency
188
- name: rexml
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
193
  - !ruby/object:Gem::Dependency
202
194
  name: selenium-webdriver
203
195
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +240,17 @@ files:
248
240
  - app/assets/stylesheets/blacklight_gallery/default.scss
249
241
  - app/components/blacklight/gallery/document_component.html.erb
250
242
  - app/components/blacklight/gallery/document_component.rb
243
+ - app/components/blacklight/gallery/icons/add_circle_component.rb
244
+ - app/components/blacklight/gallery/icons/chevron_left_component.rb
245
+ - app/components/blacklight/gallery/icons/chevron_right_component.rb
246
+ - app/components/blacklight/gallery/icons/custom_fullscreen_component.rb
247
+ - app/components/blacklight/gallery/icons/gallery_component.rb
248
+ - app/components/blacklight/gallery/icons/masonry_component.rb
249
+ - app/components/blacklight/gallery/icons/pause_slideshow_component.rb
250
+ - app/components/blacklight/gallery/icons/remove_circle_component.rb
251
+ - app/components/blacklight/gallery/icons/resize_small_component.rb
252
+ - app/components/blacklight/gallery/icons/slideshow_component.rb
253
+ - app/components/blacklight/gallery/icons/start_slideshow_component.rb
251
254
  - app/components/blacklight/gallery/slideshow_component.html.erb
252
255
  - app/components/blacklight/gallery/slideshow_component.rb
253
256
  - app/components/blacklight/gallery/slideshow_preview_component.html.erb
@@ -276,6 +279,7 @@ files:
276
279
  - lib/generators/blacklight_gallery/install_generator.rb
277
280
  - lib/generators/blacklight_gallery/templates/blacklight_gallery.css.scss
278
281
  - lib/generators/blacklight_gallery/templates/blacklight_gallery.js
282
+ - package.json
279
283
  - solr/conf/_rest_managed.json
280
284
  - solr/conf/admin-extra.html
281
285
  - solr/conf/elevate.xml
@@ -326,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
330
  - !ruby/object:Gem::Version
327
331
  version: '0'
328
332
  requirements: []
329
- rubygems_version: 3.2.33
333
+ rubygems_version: 3.3.26
330
334
  signing_key:
331
335
  specification_version: 4
332
336
  summary: Gallery display for Blacklight