blacklight-spotlight 3.6.0.beta7 → 3.6.0.beta9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/Rakefile +0 -5
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js +2 -2
  5. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  6. data/app/assets/javascripts/spotlight/spotlight.js +2 -2
  7. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  8. data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +7 -3
  9. data/app/components/spotlight/document_component.rb +3 -1
  10. data/app/controllers/spotlight/catalog_controller.rb +10 -1
  11. data/app/controllers/spotlight/resources/upload_controller.rb +1 -1
  12. data/app/controllers/spotlight/resources_controller.rb +1 -1
  13. data/app/controllers/spotlight/solr_controller.rb +8 -1
  14. data/app/helpers/spotlight/meta_helper.rb +3 -3
  15. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +2 -2
  16. data/app/models/spotlight/blacklight_configuration.rb +21 -9
  17. data/app/models/spotlight/contact.rb +5 -2
  18. data/app/models/spotlight/custom_field.rb +5 -1
  19. data/app/models/spotlight/custom_search_field.rb +5 -1
  20. data/app/models/spotlight/exhibit.rb +5 -2
  21. data/app/models/spotlight/page_content.rb +0 -2
  22. data/app/models/spotlight/resource.rb +5 -1
  23. data/app/models/spotlight/resources/upload.rb +2 -2
  24. data/app/models/spotlight/search.rb +7 -3
  25. data/app/models/spotlight/solr_document_sidecar.rb +8 -2
  26. data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -0
  27. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  28. data/app/views/spotlight/catalog/_tophat_default.html.erb +1 -0
  29. data/lib/generators/spotlight/install_generator.rb +7 -11
  30. data/lib/generators/spotlight/templates/config/initializers/translation.rb +4 -2
  31. data/lib/spotlight/riiif_service.rb +4 -4
  32. data/lib/spotlight/version.rb +1 -1
  33. metadata +23 -7
@@ -35,10 +35,13 @@
35
35
  }
36
36
 
37
37
  .constraint-value {
38
- @include border-right-radius($border-radius-sm);
38
+ border-top-right-radius: $border-radius-sm;
39
+ border-bottom-right-radius: $border-radius-sm;
39
40
  }
40
41
 
41
- .form-control-plaintext { display: none; }
42
+ .form-control-plaintext {
43
+ display: none;
44
+ }
42
45
  }
43
46
 
44
47
  .analytics {
@@ -52,7 +55,8 @@
52
55
  text-align: center;
53
56
  }
54
57
 
55
- th, td {
58
+ th,
59
+ td {
56
60
  &:first-child {
57
61
  border-left: 0;
58
62
  }
@@ -5,7 +5,9 @@ module Spotlight
5
5
  # This overrides the title method to provide an edit link.
6
6
  class DocumentComponent < Blacklight::DocumentComponent
7
7
  def title
8
- safe_join([exhibit_edit_link, super, add_document_meta_content(@document)])
8
+ return safe_join([exhibit_edit_link, super, add_document_meta_content(@document)]) if current_exhibit
9
+
10
+ super
9
11
  end
10
12
 
11
13
  attr_reader :document
@@ -23,7 +23,16 @@ module Spotlight
23
23
  before_action :load_document, only: %i[edit update make_private make_public manifest]
24
24
 
25
25
  before_action only: :show do
26
- blacklight_config.show.document_component = Spotlight::DocumentComponent
26
+ # Substitute the default document component with the custom one for Blacklight 8,
27
+ # and add the necessary partials for Blacklight 7 (if they haven't configured the document component)
28
+ if blacklight_config.show.document_component.nil? || blacklight_config.show.document_component == Blacklight::DocumentComponent
29
+ if Blacklight::VERSION > '8'
30
+ blacklight_config.show.document_component = Spotlight::DocumentComponent
31
+ else
32
+ blacklight_config.show.partials.unshift 'tophat'
33
+ blacklight_config.show.partials.unshift 'curation_mode_toggle'
34
+ end
35
+ end
27
36
  end
28
37
 
29
38
  before_action only: :admin do
@@ -9,7 +9,7 @@ module Spotlight
9
9
  helper :all
10
10
 
11
11
  before_action :authenticate_user!
12
- before_action :set_tab, only: %i[new create]
12
+ before_action :set_tab, only: %i[create]
13
13
 
14
14
  load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
15
15
  before_action :build_resource
@@ -4,7 +4,7 @@ module Spotlight
4
4
  ##
5
5
  # CRUD actions for exhibit resources
6
6
  class ResourcesController < Spotlight::ApplicationController
7
- before_action :authenticate_user!, except: [:show]
7
+ before_action :authenticate_user!
8
8
  before_action :set_tab, only: %i[new create]
9
9
 
10
10
  load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
@@ -20,7 +20,10 @@ module Spotlight
20
20
 
21
21
  data = solr_documents
22
22
 
23
- repository.connection.update params: { commitWithin: 500 }, data: data.to_json, headers: { 'Content-Type' => 'application/json' } unless data.empty?
23
+ unless data.empty?
24
+ repository.connection.update params: { commitWithin: 500 }, data: data.to_json,
25
+ headers: { 'Content-Type' => 'application/json' }
26
+ end
24
27
 
25
28
  if params[:resources_json_upload]
26
29
  redirect_back fallback_location: exhibit_resources_path(@exhibit)
@@ -31,6 +34,10 @@ module Spotlight
31
34
 
32
35
  private
33
36
 
37
+ def repository
38
+ @repository ||= blacklight_config.repository
39
+ end
40
+
34
41
  def solr_documents
35
42
  req = ActiveSupport::JSON.decode(json_content)
36
43
 
@@ -46,7 +46,7 @@ module Spotlight
46
46
  graph.type 'article'
47
47
  graph.site_name application_name
48
48
  graph.title page.title
49
- graph.send('og:image', page.thumbnail.iiif_url) if page.thumbnail
49
+ graph.send('image', page.thumbnail.iiif_url) if page.thumbnail
50
50
  graph.send('article:published_time', page.created_at.iso8601)
51
51
  graph.send('article:modified_time', page.updated_at.iso8601)
52
52
  end
@@ -69,7 +69,7 @@ module Spotlight
69
69
  graph.type 'article'
70
70
  graph.site_name application_name
71
71
  graph.title browse.title
72
- graph.send('og:image', browse.thumbnail.iiif_url) if browse.thumbnail
72
+ graph.send('image', browse.thumbnail.iiif_url) if browse.thumbnail
73
73
  graph.send('article:published_time', browse.created_at.iso8601)
74
74
  graph.send('article:modified_time', browse.updated_at.iso8601)
75
75
  end
@@ -95,7 +95,7 @@ module Spotlight
95
95
  opengraph do |graph|
96
96
  graph.site_name application_name
97
97
  graph.title presenter.heading
98
- graph.send('og:image', document.first(blacklight_config.index.thumbnail_field))
98
+ graph.send('image', document.first(blacklight_config.index.thumbnail_field))
99
99
  end
100
100
  end
101
101
  end
@@ -129,9 +129,9 @@ SirTrevor.Blocks.UploadedItems = (function(){
129
129
  <div class="panels dd nestable-item-grid" data-behavior="nestable" data-max-depth="1">
130
130
  <ol class="dd-list">
131
131
  </ol>
132
- </div>,
132
+ </div>
133
133
  <input type="file" id="uploaded_item_url" name="file[file_0][file_data]" />
134
- </div>'
134
+ </div>
135
135
  <div class="col-md-4">
136
136
  <input name="${this.zpr_key}" type="hidden" value="false" />
137
137
  <input name="${this.zpr_key}" id="${this.formId(this.zpr_key)}" data-key=${this.zpr_key}" type="checkbox" value="true" />
@@ -10,15 +10,27 @@ module Spotlight
10
10
  has_paper_trail
11
11
 
12
12
  belongs_to :exhibit, touch: true, optional: true
13
- serialize :facet_fields, Hash, coder: YAML
14
- serialize :index_fields, Hash, coder: YAML
15
- serialize :search_fields, Hash, coder: YAML
16
- serialize :sort_fields, Hash, coder: YAML
17
- serialize :default_solr_params, Hash, coder: YAML
18
- serialize :show, Hash, coder: YAML
19
- serialize :index, Hash, coder: YAML
20
- serialize :per_page, Array, coder: YAML
21
- serialize :document_index_view_types, Array, coder: YAML
13
+ if Rails.version > '7.1'
14
+ serialize :facet_fields, type: Hash, coder: YAML
15
+ serialize :index_fields, type: Hash, coder: YAML
16
+ serialize :search_fields, type: Hash, coder: YAML
17
+ serialize :sort_fields, type: Hash, coder: YAML
18
+ serialize :default_solr_params, type: Hash, coder: YAML
19
+ serialize :show, type: Hash, coder: YAML
20
+ serialize :index, type: Hash, coder: YAML
21
+ serialize :per_page, type: Array, coder: YAML
22
+ serialize :document_index_view_types, type: Array, coder: YAML
23
+ else
24
+ serialize :facet_fields, Hash, coder: YAML
25
+ serialize :index_fields, Hash, coder: YAML
26
+ serialize :search_fields, Hash, coder: YAML
27
+ serialize :sort_fields, Hash, coder: YAML
28
+ serialize :default_solr_params, Hash, coder: YAML
29
+ serialize :show, Hash, coder: YAML
30
+ serialize :index, Hash, coder: YAML
31
+ serialize :per_page, Array, coder: YAML
32
+ serialize :document_index_view_types, Array, coder: YAML
33
+ end
22
34
 
23
35
  include Spotlight::BlacklightConfigurationDefaults
24
36
 
@@ -7,8 +7,11 @@ module Spotlight
7
7
  belongs_to :exhibit, touch: true, optional: true
8
8
  scope :published, -> { where(show_in_sidebar: true) }
9
9
  default_scope { order('weight ASC') }
10
- serialize :contact_info, Hash, coder: YAML
11
-
10
+ if Rails.version > '7.1'
11
+ serialize :contact_info, type: Hash, coder: YAML
12
+ else
13
+ serialize :contact_info, Hash, coder: YAML
14
+ end
12
15
  extend FriendlyId
13
16
  friendly_id :name, use: %i[slugged scoped finders], scope: :exhibit
14
17
 
@@ -4,7 +4,11 @@ module Spotlight
4
4
  ##
5
5
  # Exhibit custom fields
6
6
  class CustomField < ActiveRecord::Base
7
- serialize :configuration, Hash, coder: YAML
7
+ if Rails.version > '7.1'
8
+ serialize :configuration, type: Hash, coder: YAML
9
+ else
10
+ serialize :configuration, Hash, coder: YAML
11
+ end
8
12
  belongs_to :exhibit, optional: true
9
13
 
10
14
  extend FriendlyId
@@ -3,7 +3,11 @@
3
3
  module Spotlight
4
4
  # Exhibit-specific custom search fields
5
5
  class CustomSearchField < ApplicationRecord
6
- serialize :configuration, Hash, coder: YAML
6
+ if Rails.version > '7.1'
7
+ serialize :configuration, type: Hash, coder: YAML
8
+ else
9
+ serialize :configuration, Hash, coder: YAML
10
+ end
7
11
  belongs_to :exhibit
8
12
 
9
13
  def label=(label)
@@ -35,8 +35,11 @@ module Spotlight
35
35
  acts_as_tagger
36
36
  acts_as_taggable
37
37
  delegate :blacklight_config, to: :blacklight_configuration
38
- serialize :facets, Array, coder: YAML
39
-
38
+ if Rails.version > '7.1'
39
+ serialize :facets, type: Array, coder: YAML
40
+ else
41
+ serialize :facets, Array, coder: YAML
42
+ end
40
43
  # NOTE: friendly id associations need to be 'destroy'ed to reap the slug history
41
44
  has_many :about_pages, -> { for_default_locale }, extend: FriendlyId::FinderMethods
42
45
  has_many :attachments, dependent: :destroy
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spotlight/page_content/sir_trevor'
4
-
5
3
  module Spotlight
6
4
  # Factory for picking the right page content renderer
7
5
  module PageContent
@@ -25,7 +25,11 @@ module Spotlight
25
25
  has_many :solr_document_sidecars
26
26
  has_many :events, as: :resource
27
27
 
28
- serialize :data, Hash, coder: YAML
28
+ if Rails.version > '7.1'
29
+ serialize :data, type: Hash, coder: YAML
30
+ else
31
+ serialize :data, Hash, coder: YAML
32
+ end
29
33
 
30
34
  ##
31
35
  # Persist the record to the database, and trigger a reindex to solr
@@ -43,13 +43,13 @@ module Spotlight
43
43
  def to_solr
44
44
  return {} unless upload&.file_present?
45
45
 
46
- dimensions = Spotlight::Engine.config.iiif_service.info(id)
46
+ dimensions = Spotlight::Engine.config.iiif_service.info(upload.id)
47
47
 
48
48
  {
49
49
  spotlight_full_image_width_ssm: dimensions.width,
50
50
  spotlight_full_image_height_ssm: dimensions.height,
51
51
  Spotlight::Engine.config.thumbnail_field => Spotlight::Engine.config.iiif_service.thumbnail_url(upload),
52
- Spotlight::Engine.config.iiif_manifest_field => Spotlight::Engine.config.iiif_service.manifest_url(exhibit, upload)
52
+ Spotlight::Engine.config.iiif_manifest_field => Spotlight::Engine.config.iiif_service.manifest_url(exhibit, self)
53
53
  }
54
54
  end
55
55
 
@@ -16,10 +16,14 @@ module Spotlight
16
16
  has_many :groups, through: :group_memberships
17
17
  accepts_nested_attributes_for :group_memberships
18
18
  accepts_nested_attributes_for :groups
19
- if defined?(Blacklight::SearchParamsYamlCoder)
20
- serialize :query_params, Blacklight::SearchParamsYamlCoder, default: -> { {} }
19
+ if defined?(Blacklight::SearchParamsYamlCoder) # in Blacklight 7.28.0+
20
+ serialize :query_params, coder: Blacklight::SearchParamsYamlCoder, default: -> { {} }
21
21
  else
22
- serialize :query_params, Hash
22
+ if Rails.version > '7.1' # rubocop:disable Style/IfInsideElse
23
+ serialize :query_params, type: Hash
24
+ else
25
+ serialize :query_params, Hash
26
+ end
23
27
  end
24
28
  default_scope { order('weight ASC') }
25
29
  scope :published, -> { where(published: true) }
@@ -11,8 +11,14 @@ module Spotlight
11
11
  belongs_to :exhibit, optional: false
12
12
  belongs_to :resource, optional: true
13
13
  belongs_to :document, optional: false, polymorphic: true
14
- serialize :data, Hash, coder: YAML
15
- serialize :index_status, Hash, coder: YAML
14
+
15
+ if Rails.version > '7.1'
16
+ serialize :data, type: Hash, coder: YAML
17
+ serialize :index_status, type: Hash, coder: YAML
18
+ else
19
+ serialize :data, Hash, coder: YAML
20
+ serialize :index_status, Hash, coder: YAML
21
+ end
16
22
 
17
23
  delegate :has_key?, :key?, to: :data
18
24
 
@@ -0,0 +1 @@
1
+ <%= exhibit_edit_link document, [:edit, current_exhibit, document], class: 'float-right btn btn-primary' if can?(:curate, current_exhibit) and !current_page? [:edit, current_exhibit, document] %>
@@ -1,6 +1,6 @@
1
1
  <% # header bar for doc items in index view -%>
2
2
  <td>
3
- <%= render_document_partial document, 'spotlight/catalog/admin_thumbnail', document_counter: document_counter %>
3
+ <%= render_document_partial document, 'admin_thumbnail', document_counter: document_counter %>
4
4
  </td>
5
5
  <td>
6
6
  <%= render_document_partial document, 'admin_index_header', document_counter: document_counter %>
@@ -0,0 +1 @@
1
+ <% add_document_meta_content(@document) %>
@@ -152,15 +152,6 @@ module Spotlight
152
152
  end
153
153
  end
154
154
 
155
- def generate_config
156
- directory 'config'
157
- end
158
-
159
- def add_solr_config_resources
160
- copy_file '.solr_wrapper.yml', '.solr_wrapper.yml'
161
- directory 'solr'
162
- end
163
-
164
155
  def generate_devise_invitable
165
156
  gem 'devise_invitable'
166
157
  bundle_install
@@ -168,8 +159,13 @@ module Spotlight
168
159
  generate 'devise_invitable', 'User'
169
160
  end
170
161
 
171
- def add_translations
172
- copy_file 'config/initializers/translation.rb'
162
+ def generate_config
163
+ directory 'config'
164
+ end
165
+
166
+ def add_solr_config_resources
167
+ copy_file '.solr_wrapper.yml', '.solr_wrapper.yml'
168
+ directory 'solr'
173
169
  end
174
170
 
175
171
  def configure_logging
@@ -7,8 +7,10 @@ ActiveSupport::Reloader.to_prepare do
7
7
  # Don't allow initializer to break if DB doesn't exist yet
8
8
  # see: https://github.com/projectblacklight/spotlight/issues/2133
9
9
  if ENV['SKIP_TRANSLATION'].blank?
10
- raise unless Translation.table_exists?
11
-
10
+ unless Translation.table_exists?
11
+ warn "Translation table doesn't exist. Skipping translation config."
12
+ next
13
+ end
12
14
  ##
13
15
  # Sets up the new Spotlight Translation backend, backed by ActiveRecord. To
14
16
  # turn on the ActiveRecord backend, uncomment the following lines.
@@ -16,13 +16,13 @@ module Spotlight
16
16
  end
17
17
 
18
18
  # @param [Spotlight::Exhibit] exhibit
19
- # @param [Spotlight::FeaturedImage] image
19
+ # @param [Spotlight::Resource::Upload] resource
20
20
  # @return [String]
21
- def self.manifest_url(exhibit, image)
22
- Spotlight::Engine.routes.url_helpers.manifest_exhibit_solr_document_path(exhibit, "#{exhibit.id}-#{image.id}")
21
+ def self.manifest_url(exhibit, resource)
22
+ Spotlight::Engine.routes.url_helpers.manifest_exhibit_solr_document_path(exhibit, "#{exhibit.id}-#{resource.id}")
23
23
  end
24
24
 
25
- # @param [String] id
25
+ # @param [String] id the ID string of a Spotlight::FeaturedImage
26
26
  # @return [Hash]
27
27
  def self.info(id)
28
28
  Riiif::Image.new(id).info
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.6.0.beta7'
4
+ VERSION = '3.6.0.beta9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0.beta7
4
+ version: 3.6.0.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-01-30 00:00:00.000000000 Z
14
+ date: 2024-07-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob-status
@@ -183,14 +183,14 @@ dependencies:
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '4.1'
186
+ version: '4.9'
187
187
  type: :runtime
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: '4.1'
193
+ version: '4.9'
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: devise_invitable
196
196
  requirement: !ruby/object:Gem::Requirement
@@ -456,7 +456,7 @@ dependencies:
456
456
  version: '6.1'
457
457
  - - "<"
458
458
  - !ruby/object:Gem::Version
459
- version: '8'
459
+ version: '7.2'
460
460
  type: :runtime
461
461
  prerelease: false
462
462
  version_requirements: !ruby/object:Gem::Requirement
@@ -466,7 +466,7 @@ dependencies:
466
466
  version: '6.1'
467
467
  - - "<"
468
468
  - !ruby/object:Gem::Version
469
- version: '8'
469
+ version: '7.2'
470
470
  - !ruby/object:Gem::Dependency
471
471
  name: redcarpet
472
472
  requirement: !ruby/object:Gem::Requirement
@@ -711,6 +711,20 @@ dependencies:
711
711
  - - "~>"
712
712
  - !ruby/object:Gem::Version
713
713
  version: '1.8'
714
+ - !ruby/object:Gem::Dependency
715
+ name: rubocop-capybara
716
+ requirement: !ruby/object:Gem::Requirement
717
+ requirements:
718
+ - - ">="
719
+ - !ruby/object:Gem::Version
720
+ version: '0'
721
+ type: :development
722
+ prerelease: false
723
+ version_requirements: !ruby/object:Gem::Requirement
724
+ requirements:
725
+ - - ">="
726
+ - !ruby/object:Gem::Version
727
+ version: '0'
714
728
  - !ruby/object:Gem::Dependency
715
729
  name: rubocop-rails
716
730
  requirement: !ruby/object:Gem::Requirement
@@ -1191,6 +1205,7 @@ files:
1191
1205
  - app/views/spotlight/catalog/_admin_header.html.erb
1192
1206
  - app/views/spotlight/catalog/_admin_index_header_default.html.erb
1193
1207
  - app/views/spotlight/catalog/_admin_thumbnail_default.html.erb
1208
+ - app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb
1194
1209
  - app/views/spotlight/catalog/_document.html.erb
1195
1210
  - app/views/spotlight/catalog/_document_admin_table.html.erb
1196
1211
  - app/views/spotlight/catalog/_document_row.html.erb
@@ -1199,6 +1214,7 @@ files:
1199
1214
  - app/views/spotlight/catalog/_edit_sidecar.html.erb
1200
1215
  - app/views/spotlight/catalog/_index_compact_default.html.erb
1201
1216
  - app/views/spotlight/catalog/_reindex_progress_panel.html.erb
1217
+ - app/views/spotlight/catalog/_tophat_default.html.erb
1202
1218
  - app/views/spotlight/catalog/admin.html.erb
1203
1219
  - app/views/spotlight/catalog/edit.html.erb
1204
1220
  - app/views/spotlight/catalog/index.iiif_json.jbuilder
@@ -1550,7 +1566,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1550
1566
  - !ruby/object:Gem::Version
1551
1567
  version: 1.3.1
1552
1568
  requirements: []
1553
- rubygems_version: 3.4.10
1569
+ rubygems_version: 3.4.19
1554
1570
  signing_key:
1555
1571
  specification_version: 4
1556
1572
  summary: Enable librarians, curators, and others who are responsible for digital collections