blacklight-spotlight 3.5.0.4 → 3.6.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -0
  3. data/Rakefile +6 -7
  4. data/app/assets/config/spotlight/manifest.js +1 -0
  5. data/app/assets/javascripts/spotlight/application.js +14 -14
  6. data/app/assets/javascripts/spotlight/spotlight.esm.js +7148 -0
  7. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -0
  8. data/app/assets/javascripts/spotlight/spotlight.js +7148 -15
  9. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -0
  10. data/app/assets/stylesheets/spotlight/_catalog.scss +16 -0
  11. data/app/controllers/concerns/spotlight/base.rb +2 -1
  12. data/app/controllers/concerns/spotlight/controller.rb +10 -0
  13. data/app/controllers/spotlight/admin_users_controller.rb +4 -4
  14. data/app/controllers/spotlight/appearances_controller.rb +6 -6
  15. data/app/controllers/spotlight/browse_controller.rb +1 -1
  16. data/app/controllers/spotlight/catalog_controller.rb +20 -15
  17. data/app/controllers/spotlight/concerns/application_controller.rb +1 -0
  18. data/app/controllers/spotlight/concerns/catalog_search_context.rb +2 -2
  19. data/app/controllers/spotlight/contacts_controller.rb +6 -6
  20. data/app/controllers/spotlight/dashboards_controller.rb +2 -2
  21. data/app/controllers/spotlight/exhibits_controller.rb +19 -19
  22. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  23. data/app/controllers/spotlight/home_pages_controller.rb +7 -7
  24. data/app/controllers/spotlight/lock_controller.rb +1 -1
  25. data/app/controllers/spotlight/metadata_configurations_controller.rb +2 -2
  26. data/app/controllers/spotlight/pages_controller.rb +4 -3
  27. data/app/controllers/spotlight/search_configurations_controller.rb +6 -6
  28. data/app/controllers/spotlight/searches_controller.rb +22 -22
  29. data/app/controllers/spotlight/solr_controller.rb +1 -1
  30. data/app/controllers/spotlight/translations_controller.rb +8 -10
  31. data/app/controllers/spotlight/versions_controller.rb +2 -1
  32. data/app/helpers/spotlight/application_helper.rb +33 -17
  33. data/app/helpers/spotlight/crud_link_helpers.rb +12 -2
  34. data/app/helpers/spotlight/pages_helper.rb +1 -1
  35. data/app/helpers/spotlight/roles_helper.rb +2 -2
  36. data/app/helpers/spotlight/title_helper.rb +1 -1
  37. data/app/helpers/spotlight/translations_helper.rb +1 -3
  38. data/app/javascript/spotlight/admin/add_another.es6 +24 -0
  39. data/app/javascript/spotlight/admin/add_image_selector.es6 +38 -0
  40. data/app/javascript/spotlight/admin/add_new_button.es6 +77 -0
  41. data/app/javascript/spotlight/admin/appearance.es6 +22 -0
  42. data/app/javascript/spotlight/admin/blacklight_configuration.es6 +65 -0
  43. data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/autocompleteable.js +8 -8
  44. data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/formable.js +1 -1
  45. data/app/javascript/spotlight/admin/block_mixins/plustextable.js +58 -0
  46. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/block.js +2 -1
  47. data/app/javascript/spotlight/admin/blocks/browse_block.js +86 -0
  48. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
  49. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/iframe_block.js +7 -11
  50. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/link_to_search_block.js +0 -2
  51. data/app/javascript/spotlight/admin/blocks/oembed_block.js +41 -0
  52. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/pages_block.js +1 -1
  53. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/resources_block.js +45 -42
  54. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/rule_block.js +2 -4
  55. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/search_result_block.js +7 -9
  56. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_base_block.js +22 -22
  57. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_block.js +7 -7
  58. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_carousel_block.js +14 -15
  59. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +147 -0
  60. data/app/javascript/spotlight/admin/checkbox_submit.es6 +75 -0
  61. data/app/javascript/spotlight/admin/copy_email_addresses.es6 +5 -0
  62. data/app/{assets/javascripts/spotlight/admin/crop.es6 → javascript/spotlight/admin/crop.js} +5 -4
  63. data/app/javascript/spotlight/admin/croppable.es6 +10 -0
  64. data/app/{assets/javascripts/spotlight/admin/edit_in_place.js → javascript/spotlight/admin/edit_in_place.es6} +6 -13
  65. data/app/javascript/spotlight/admin/exhibit_tag_autocomplete.es6 +39 -0
  66. data/app/javascript/spotlight/admin/exhibits.es6 +59 -0
  67. data/app/{assets/javascripts/spotlight/admin/form_observer.js → javascript/spotlight/admin/form_observer.es6} +23 -21
  68. data/app/javascript/spotlight/admin/index.js +85 -0
  69. data/app/javascript/spotlight/admin/locks.es6 +12 -0
  70. data/app/{assets/javascripts → javascript}/spotlight/admin/multi_image_selector.js +2 -1
  71. data/app/javascript/spotlight/admin/pages.es6 +42 -0
  72. data/app/{assets/javascripts/spotlight/admin/progress_monitor.js → javascript/spotlight/admin/progress_monitor.es6} +5 -9
  73. data/app/javascript/spotlight/admin/readonly_checkbox.es6 +8 -0
  74. data/app/{assets/javascripts → javascript}/spotlight/admin/search_typeahead.js +3 -46
  75. data/app/{assets/javascripts/spotlight/admin/select_related_input.js → javascript/spotlight/admin/select_related_input.es6} +6 -3
  76. data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_controls.js +6 -4
  77. data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_limits.js +2 -0
  78. data/app/{assets/javascripts → javascript}/spotlight/admin/spotlight_nestable.js +4 -8
  79. data/app/javascript/spotlight/admin/tabs.es6 +8 -0
  80. data/app/{assets/javascripts/spotlight/admin/translation_progress.js → javascript/spotlight/admin/translation_progress.es6} +6 -13
  81. data/app/{assets/javascripts/spotlight/admin/users.js → javascript/spotlight/admin/users.es6} +7 -17
  82. data/app/javascript/spotlight/admin/visibility_toggle.es6 +23 -0
  83. data/app/javascript/spotlight/index.js +10 -0
  84. data/app/javascript/spotlight/spotlight.js +32 -0
  85. data/app/{assets/javascripts/spotlight/user/analytics.js → javascript/spotlight/user/analytics.es6} +4 -4
  86. data/app/{assets/javascripts/spotlight/user/browse_group_categories.js → javascript/spotlight/user/browse_group_categories.es6} +4 -13
  87. data/app/javascript/spotlight/user/carousel.es6 +5 -0
  88. data/app/{assets/javascripts/spotlight/user/clear_form_button.js → javascript/spotlight/user/clear_form_button.es6} +5 -9
  89. data/app/javascript/spotlight/user/index.js +17 -0
  90. data/app/{assets/javascripts/spotlight/user/report_a_problem.js → javascript/spotlight/user/report_a_problem.es6} +6 -15
  91. data/app/javascript/spotlight/user/zpr_links.es6 +44 -0
  92. data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -2
  93. data/app/models/concerns/spotlight/browse_category_search_builder.rb +1 -10
  94. data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
  95. data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
  96. data/app/models/concerns/spotlight/resources/web.rb +1 -1
  97. data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +1 -1
  98. data/app/models/concerns/spotlight/solr_document/finder.rb +2 -2
  99. data/app/models/concerns/spotlight/solr_document.rb +2 -2
  100. data/app/models/concerns/spotlight/translatables.rb +1 -1
  101. data/app/models/sir_trevor_rails/blocks/displayable.rb +2 -2
  102. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +17 -6
  103. data/app/models/spotlight/analytics/ga.rb +5 -5
  104. data/app/models/spotlight/blacklight_configuration.rb +12 -12
  105. data/app/models/spotlight/bulk_update.rb +1 -0
  106. data/app/models/spotlight/contact_email.rb +1 -1
  107. data/app/models/spotlight/contact_form.rb +1 -1
  108. data/app/models/spotlight/exhibit.rb +1 -1
  109. data/app/models/spotlight/featured_image.rb +1 -2
  110. data/app/models/spotlight/lock.rb +1 -1
  111. data/app/models/spotlight/main_navigation.rb +1 -5
  112. data/app/models/spotlight/page.rb +1 -1
  113. data/app/models/spotlight/resources/iiif_manifest.rb +4 -4
  114. data/app/models/spotlight/resources/iiif_service.rb +1 -1
  115. data/app/models/spotlight/resources/upload.rb +3 -6
  116. data/app/models/spotlight/search.rb +2 -2
  117. data/app/models/translation.rb +2 -0
  118. data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -1
  119. data/app/services/spotlight/etl/solr_loader.rb +1 -1
  120. data/app/services/spotlight/iiif_resource_resolver.rb +10 -10
  121. data/app/uploaders/spotlight/bulk_updates_uploader.rb +1 -0
  122. data/app/views/layouts/spotlight/base.html.erb +1 -0
  123. data/app/views/shared/_exhibit_navbar.html.erb +6 -1
  124. data/app/views/spotlight/admin_users/index.html.erb +9 -3
  125. data/app/views/spotlight/browse/show.html.erb +2 -2
  126. data/app/views/spotlight/catalog/_admin_header.html.erb +3 -1
  127. data/app/views/spotlight/catalog/_document_visibility_control.html.erb +21 -2
  128. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  129. data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -1
  130. data/app/views/spotlight/exhibits/_contact.html.erb +5 -1
  131. data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +2 -0
  132. data/app/views/spotlight/shared/_report_a_problem.html.erb +1 -1
  133. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
  134. data/app/views/spotlight/translations/_page.html.erb +6 -1
  135. data/config/locales/spotlight.en.yml +4 -9
  136. data/lib/generators/spotlight/install_generator.rb +15 -23
  137. data/lib/generators/spotlight/scaffold_resource_generator.rb +12 -12
  138. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -0
  139. data/lib/generators/spotlight/templates/solr/conf/_rest_managed.json +3 -0
  140. data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -0
  141. data/lib/generators/spotlight/templates/solr/conf/elevate.xml +36 -0
  142. data/lib/generators/spotlight/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  143. data/lib/generators/spotlight/templates/solr/conf/protwords.txt +21 -0
  144. data/lib/generators/spotlight/templates/solr/{config → conf}/schema.xml +17 -0
  145. data/lib/generators/spotlight/templates/solr/conf/scripts.conf +24 -0
  146. data/lib/generators/spotlight/templates/solr/{config → conf}/solrconfig.xml +55 -24
  147. data/lib/generators/spotlight/templates/solr/conf/spellings.txt +2 -0
  148. data/lib/generators/spotlight/templates/solr/conf/stopwords.txt +58 -0
  149. data/lib/generators/spotlight/templates/solr/conf/stopwords_en.txt +58 -0
  150. data/lib/generators/spotlight/templates/solr/conf/synonyms.txt +31 -0
  151. data/lib/generators/spotlight/templates/solr/conf/xslt/example.xsl +132 -0
  152. data/lib/generators/spotlight/templates/solr/conf/xslt/example_atom.xsl +67 -0
  153. data/lib/generators/spotlight/templates/solr/conf/xslt/example_rss.xsl +66 -0
  154. data/lib/generators/spotlight/templates/solr/conf/xslt/luke.xsl +337 -0
  155. data/lib/generators/spotlight/templates/spotlight.js +1 -1
  156. data/lib/migration/iiif.rb +3 -7
  157. data/lib/spotlight/engine.rb +18 -16
  158. data/lib/spotlight/riiif_service.rb +31 -0
  159. data/lib/spotlight/search_state.rb +19 -0
  160. data/lib/spotlight/upload_field_config.rb +1 -1
  161. data/lib/spotlight/version.rb +1 -1
  162. data/lib/tasks/spotlight_tasks.rake +1 -1
  163. data/spec/factories/searches.rb +0 -12
  164. data/spec/fixtures/iiif_responses.rb +64 -64
  165. data/vendor/assets/javascripts/nestable.js +1 -1
  166. data/vendor/assets/javascripts/parameterize.js +2 -2
  167. data/vendor/assets/javascripts/sir-trevor.js +22460 -20591
  168. data/vendor/assets/stylesheets/sir-trevor/_icons.scss +0 -0
  169. data/vendor/assets/stylesheets/sir-trevor/_variables.scss +16 -18
  170. data/vendor/assets/stylesheets/sir-trevor/base.scss +11 -0
  171. data/vendor/assets/stylesheets/sir-trevor/block-addition-top.scss +4 -1
  172. data/vendor/assets/stylesheets/sir-trevor/block-addition.scss +3 -2
  173. data/vendor/assets/stylesheets/sir-trevor/block-controls.scss +4 -0
  174. data/vendor/assets/stylesheets/sir-trevor/block-positioner.scss +0 -0
  175. data/vendor/assets/stylesheets/sir-trevor/block-replacer.scss +0 -0
  176. data/vendor/assets/stylesheets/sir-trevor/block-ui.scss +10 -0
  177. data/vendor/assets/stylesheets/sir-trevor/block.scss +19 -5
  178. data/vendor/assets/stylesheets/sir-trevor/errors.scss +0 -0
  179. data/vendor/assets/stylesheets/sir-trevor/format-bar.scss +0 -0
  180. data/vendor/assets/stylesheets/sir-trevor/inputs.scss +0 -0
  181. data/vendor/assets/stylesheets/sir-trevor/main.scss +0 -0
  182. data/vendor/assets/stylesheets/sir-trevor/patterns/ui-popup.scss +0 -0
  183. data/vendor/assets/stylesheets/sir-trevor/utils.scss +0 -0
  184. metadata +118 -131
  185. data/app/assets/javascripts/spotlight/admin/add_another.js +0 -22
  186. data/app/assets/javascripts/spotlight/admin/add_new_button.js +0 -81
  187. data/app/assets/javascripts/spotlight/admin/appearance.js +0 -24
  188. data/app/assets/javascripts/spotlight/admin/attachments.js +0 -2
  189. data/app/assets/javascripts/spotlight/admin/blacklight_configuration.js +0 -63
  190. data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +0 -57
  191. data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +0 -87
  192. data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +0 -88
  193. data/app/assets/javascripts/spotlight/admin/blocks/oembed_block.js +0 -40
  194. data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +0 -145
  195. data/app/assets/javascripts/spotlight/admin/catalog_edit.js +0 -16
  196. data/app/assets/javascripts/spotlight/admin/copy_email_addresses.js +0 -9
  197. data/app/assets/javascripts/spotlight/admin/croppable.js +0 -25
  198. data/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +0 -37
  199. data/app/assets/javascripts/spotlight/admin/exhibits.js +0 -58
  200. data/app/assets/javascripts/spotlight/admin/index.js +0 -16
  201. data/app/assets/javascripts/spotlight/admin/locks.js +0 -12
  202. data/app/assets/javascripts/spotlight/admin/pages.js.erb +0 -40
  203. data/app/assets/javascripts/spotlight/admin/readonly_checkbox.js +0 -6
  204. data/app/assets/javascripts/spotlight/admin/tabs.js +0 -6
  205. data/app/assets/javascripts/spotlight/user/carousel.js +0 -3
  206. data/app/assets/javascripts/spotlight/user/index.js +0 -8
  207. data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +0 -45
  208. data/vendor/assets/javascripts/MutationObserver.js +0 -625
  209. data/vendor/assets/javascripts/eventable.js +0 -205
  210. data/vendor/assets/javascripts/polyfill.min.js +0 -4
  211. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_embed_block.js +0 -0
  212. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_features_block.js +0 -0
  213. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_grid_block.js +0 -0
  214. /data/app/{assets/javascripts/spotlight/admin/iiif.es6 → javascript/spotlight/admin/iiif.js} +0 -0
  215. /data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/locales.js +0 -0
@@ -69,8 +69,7 @@ module Spotlight
69
69
  if self[:iiif_tilesource]
70
70
  self[:iiif_tilesource]
71
71
  elsif file_present?
72
- riiif = Riiif::Engine.routes.url_helpers
73
- riiif.info_path(self)
72
+ Spotlight::Engine.config.iiif_service.info_url(self)
74
73
  end
75
74
  end
76
75
 
@@ -16,7 +16,7 @@ module Spotlight
16
16
  end
17
17
 
18
18
  def stale?
19
- created_at < (Time.zone.now - 12.hours)
19
+ created_at < (12.hours.ago)
20
20
  end
21
21
  end
22
22
  end
@@ -19,11 +19,7 @@ module Spotlight
19
19
  end
20
20
 
21
21
  def label_or_default
22
- if label.present?
23
- label
24
- else
25
- default_label
26
- end
22
+ label.presence || default_label
27
23
  end
28
24
 
29
25
  def default_label(**options)
@@ -7,7 +7,7 @@ module Spotlight
7
7
  MAX_PAGES = Spotlight::Engine.config.max_pages
8
8
 
9
9
  extend FriendlyId
10
- # Note: This configuration also needs to be duplicated on the
10
+ # NOTE: This configuration also needs to be duplicated on the
11
11
  # STI models ({Spotlight::AboutPage}, {Spotlight::FeaturePage}, {Spotlight::HomePage})
12
12
  friendly_id :title, use: %i[slugged scoped finders history], scope: %i[exhibit locale], treat_reserved_as_conflict: true do |config|
13
13
  config.reserved_words&.concat(%w[update_all contacts])
@@ -115,8 +115,8 @@ module Spotlight
115
115
  end
116
116
 
117
117
  def exhibit_custom_fields
118
- @exhibit_custom_fields ||= exhibit.custom_fields.each_with_object({}) do |value, hash|
119
- hash[value.label] = value
118
+ @exhibit_custom_fields ||= exhibit.custom_fields.index_by do |value|
119
+ value.label
120
120
  end
121
121
  end
122
122
 
@@ -243,14 +243,14 @@ module Spotlight
243
243
  # If any of the values have a language associated with them, the client must display all of the values associated with the language that best
244
244
  # matches the language preference.
245
245
  elsif value.any? { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }
246
- value.select { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }.map { |v| v['@value'] }
246
+ value.select { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }.pluck('@value')
247
247
  # If all of the values have a language associated with them, and none match the language preference, the client must select a language
248
248
  # and display all of the values associated with that language.
249
249
  elsif value.all? { |v| v.is_a?(Hash) && v.key?('@language') }
250
250
  selected_json_ld_language = value.find { |v| v.is_a?(Hash) && v.key?('@language') }
251
251
 
252
252
  value.select { |v| v.is_a?(Hash) && v['@language'] == selected_json_ld_language['@language'] }
253
- .map { |v| v['@value'] }
253
+ .pluck('@value')
254
254
  # If some of the values have a language associated with them, but none match the language preference, the client must display all of the values
255
255
  # that do not have a language associated with them.
256
256
  else
@@ -31,7 +31,7 @@ module Spotlight
31
31
 
32
32
  def self.http_client
33
33
  Faraday.new do |b|
34
- b.use FaradayMiddleware::FollowRedirects
34
+ b.response :follow_redirects
35
35
  b.adapter Faraday.default_adapter
36
36
  end
37
37
  end
@@ -43,16 +43,13 @@ module Spotlight
43
43
  def to_solr
44
44
  return {} unless upload&.file_present?
45
45
 
46
- spotlight_routes = Spotlight::Engine.routes.url_helpers
47
- riiif = Riiif::Engine.routes.url_helpers
48
-
49
- dimensions = Riiif::Image.new(upload_id).info
46
+ dimensions = Spotlight::Engine.config.iiif_service.info(id)
50
47
 
51
48
  {
52
49
  spotlight_full_image_width_ssm: dimensions.width,
53
50
  spotlight_full_image_height_ssm: dimensions.height,
54
- Spotlight::Engine.config.thumbnail_field => riiif.image_path(upload, size: '!400,400'),
55
- Spotlight::Engine.config.iiif_manifest_field => spotlight_routes.manifest_exhibit_solr_document_path(exhibit, compound_id)
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)
56
53
  }
57
54
  end
58
55
 
@@ -45,14 +45,14 @@ module Spotlight
45
45
  thumbnail.iiif_url
46
46
  end
47
47
 
48
- def documents
48
+ def documents(&block)
49
49
  start = 0
50
50
  response = repository.search(search_params.start(start))
51
51
 
52
52
  return to_enum(:documents) { response['response']['numFound'] } unless block_given?
53
53
 
54
54
  while response.documents.present?
55
- response.documents.each { |x| yield x }
55
+ response.documents.each(&block)
56
56
  start += response.documents.length
57
57
  response = repository.search(search_params.start(start))
58
58
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'i18n/backend/active_record'
4
+
3
5
  unless defined?(Translation)
4
6
  Translation = I18n::Backend::ActiveRecord::Translation
5
7
  Translation.include Spotlight::CustomTranslationExtension
@@ -79,7 +79,8 @@ module Spotlight
79
79
 
80
80
  def iiif_url
81
81
  # yes this is hacky, and we are appropriately ashamed.
82
- controller.riiif.info_url(uploaded_resource.upload).sub(%r{/info\.json\Z}, '')
82
+ Spotlight::Engine.config.iiif_service.info_url(uploaded_resource.upload)
83
+ .sub(%r{/info\.json\Z}, '')
83
84
  end
84
85
  end
85
86
  end
@@ -53,7 +53,7 @@ module Spotlight
53
53
  data: [document].to_json,
54
54
  headers: { 'Content-Type' => 'application/json' }
55
55
  rescue StandardError => e
56
- pipeline&.on_error(e, document.to_json)
56
+ pipeline&.on_error(self, e, document.to_json)
57
57
  end
58
58
 
59
59
  def blacklight_solr
@@ -57,20 +57,20 @@ module Spotlight
57
57
 
58
58
  def response
59
59
  @response ||= begin
60
- Spotlight::Resources::IiifService.http_client.get(iiif_manifest_url).body
61
- rescue Faraday::Error => e
62
- Rails.logger.warn("#{self.class.name} failed to fetch #{iiif_manifest_url} with: #{e}")
63
- '{}'
64
- end
60
+ Spotlight::Resources::IiifService.http_client.get(iiif_manifest_url).body
61
+ rescue Faraday::Error => e
62
+ Rails.logger.warn("#{self.class.name} failed to fetch #{iiif_manifest_url} with: #{e}")
63
+ '{}'
64
+ end
65
65
  end
66
66
 
67
67
  def manifest
68
68
  @manifest ||= begin
69
- JSON.parse(response)
70
- rescue JSON::ParserError => e
71
- Rails.logger.warn("#{self.class.name} failed to parse #{iiif_manifest_url} with: #{e}")
72
- {}
73
- end
69
+ JSON.parse(response)
70
+ rescue JSON::ParserError => e
71
+ Rails.logger.warn("#{self.class.name} failed to parse #{iiif_manifest_url} with: #{e}")
72
+ {}
73
+ end
74
74
  end
75
75
 
76
76
  class ManifestError < RuntimeError; end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
+ # :nodoc:
4
5
  class BulkUpdatesUploader < CarrierWave::Uploader::Base
5
6
  storage Spotlight::Engine.config.uploader_storage
6
7
  end
@@ -19,6 +19,7 @@
19
19
  <%= description %>
20
20
  <%= twitter_card %>
21
21
  <%= opengraph %>
22
+ <%= javascript_tag "Spotlight.sirTrevorIcon = '#{asset_path('spotlight/blocks/sir-trevor-icons.svg')}'" %>
22
23
  <%= javascript_tag '$.fx.off = true;' if Rails.env.test? %>
23
24
  </head>
24
25
  <body class="<%= render_body_class %>">
@@ -12,7 +12,12 @@
12
12
  </ul>
13
13
  <% if should_render_spotlight_search_bar? %>
14
14
  <div class="navbar-right navbar-nav exhibit-search-form mt-3 mt-md-0">
15
- <%= render_search_bar %>
15
+ <%= render Blacklight::SearchBarComponent.new(
16
+ url: search_action_url,
17
+ advanced_search_url: search_action_url(action: 'advanced_search'),
18
+ params: search_state.params_for_search.except(:qt),
19
+ autocomplete_path: suggest_index_catalog_path
20
+ ) %>
16
21
  </div>
17
22
  <% end %>
18
23
  </div>
@@ -16,7 +16,9 @@
16
16
  <span class='badge badge-warning pending-label'><%= t('.pending') %></span>
17
17
  </td>
18
18
  <td>
19
- <%= link_to(t('.destroy'), admin_user_path(user), method: :delete, class: 'btn btn-sm btn-danger float-right') unless user == current_user %>
19
+ <%= link_to(t('.destroy'), admin_user_path(user),
20
+ data: { method: :delete, turbo_method: :delete },
21
+ class: 'btn btn-sm btn-danger float-right') unless user == current_user %>
20
22
  </td>
21
23
  </tr>
22
24
  <% end %>
@@ -81,9 +83,13 @@
81
83
  </td>
82
84
  <td class="text-right">
83
85
  <% if user.superadmin? %>
84
- <%= link_to(t('.destroy'), admin_user_path(user), method: :delete, class: 'btn btn-sm btn-danger') unless user == current_user %>
86
+ <%= link_to(t('.destroy'), admin_user_path(user),
87
+ data: { method: :delete, turbo_method: :delete },
88
+ class: 'btn btn-sm btn-danger') unless user == current_user %>
85
89
  <% else %>
86
- <%= link_to(t('.update'), admin_user_path(user), method: :patch, class: 'btn btn-sm btn-secondary') %>
90
+ <%= link_to(t('.update'), admin_user_path(user),
91
+ data: { method: :patch, turbo_method: :patch },
92
+ class: 'btn btn-sm btn-secondary') %>
87
93
  <% end %>
88
94
  </td>
89
95
  </tr>
@@ -20,8 +20,8 @@
20
20
  <%= render partial: 'search_box', locals: {search: @search} %>
21
21
  <% end %>
22
22
  <% if @search.default_index_view_type && params[:view].blank? %>
23
- <%= render_document_index_with_view(@search.default_index_view_type, @document_list) %>
23
+ <%= render_document_index_with_view(@search.default_index_view_type, @response.documents) %>
24
24
  <% else %>
25
- <%= render_document_index(@document_list) %>
25
+ <%= render_document_index(@response.documents) %>
26
26
  <% end %>
27
27
  <%= render 'results_pagination' %>
@@ -4,7 +4,9 @@
4
4
  </div>
5
5
  <div class="add-items-nav clearfix">
6
6
  <div class="float-right">
7
- <%= link_to t('.reindex'), reindex_all_exhibit_resources_path(current_exhibit), method: :post, class: 'btn btn-secondary' %>
7
+ <%= link_to t('.reindex'), reindex_all_exhibit_resources_path(current_exhibit),
8
+ data: { method: :post, turbo_method: :post },
9
+ class: 'btn btn-secondary' %>
8
10
  <% if Spotlight::Engine.config.resource_partials.any? %>
9
11
  <%= link_to t('.new_resource'), new_exhibit_resource_path(current_exhibit), class: 'btn btn-primary' %>
10
12
  <% end %>
@@ -1,5 +1,24 @@
1
1
  <% action = document.private?(current_exhibit) ? :make_public : :make_private %>
2
2
 
3
- <%= form_tag( [:visibility, current_exhibit, document], :method => document.private?(current_exhibit) ? :put : :delete, :class => "visiblity_toggle", "data-doc-id" => document.id, :'data-present' => t('.make_private.label'), :'data-absent' => t('.make_public.label'), :'data-inprogress' => t('.inprogress.label'), :'data-label-toggle-target' => "[data-label-toggle='#{document.id}']") do %>
4
- <%= submit_tag(t(".#{action}.button"), :id => "visibility_toggle_#{document.id.to_s.parameterize}", :class => "visibility_#{action}") %>
3
+ <%= form_tag([:visibility, current_exhibit, document],
4
+ method: document.private?(current_exhibit) ? :put : :delete,
5
+ class: 'visibility-toggle',
6
+ data: {
7
+ 'doc-id': document.id,
8
+ present: t('.make_private'),
9
+ absent: t('.make_public'),
10
+ inprogress: t('.inprogress'),
11
+ }) do %>
12
+
13
+ <div class="checkbox toggle-visibility">
14
+ <label class="toggle-visibility" data-checkboxsubmit-target="label">
15
+ <input type="checkbox" class="toggle-visibility" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if document.public?(current_exhibit) %>>
16
+ <span data-checkboxsubmit-target="span" class="sr-only">
17
+ <%= document.private?(current_exhibit) ? t('.make_public') : t('.make_private') %>
18
+ </span>
19
+ </label>
20
+ </div>
21
+
22
+ <%= submit_tag(t(".#{action}"), id: "visibility_toggle_#{document.id.to_s.parameterize}", class: "visibility-#{action}") %>
23
+
5
24
  <% end %>
@@ -6,7 +6,7 @@
6
6
  <%= render_document_partial document, 'admin_index_header', document_counter: document_counter %>
7
7
 
8
8
  <div class="page-links">
9
- <%= view_link document, url_for_document(document) %> &middot;
9
+ <%= view_link document, search_state.url_for_document(document) %> &middot;
10
10
  <%= exhibit_edit_link document, [:edit, current_exhibit, document] %>
11
11
  </div>
12
12
  </td>
@@ -4,6 +4,8 @@
4
4
  <% elsif contact_email.recently_sent? %>
5
5
  <span class="confirmed"><%= blacklight_icon('check_circle') %> <%= t('.confirmation_sent') %></span>
6
6
  <% else %>
7
- <span class="unconfirmed"><%= blacklight_icon('error') %> <%= t('.not_validated') %></span> <%= link_to t('.resend'), contact_email_confirmation_path(contact_email: {email: contact_email.email}), method: :post %>
7
+ <span class="unconfirmed"><%= blacklight_icon('error') %> <%= t('.not_validated') %></span>
8
+ <%= link_to t('.resend'), contact_email_confirmation_path(contact_email: {email: contact_email.email}),
9
+ data: { method: :post, turbo_method: :post } %>
8
10
  <% end %>
9
11
  </div>
@@ -12,7 +12,11 @@
12
12
  <div class="col-md-4">
13
13
  <% if contact.object.id %>
14
14
  <span class="contact-email-delete-wrapper">
15
- <%= link_to exhibit_contact_email_path(exhibit_id: exhibit.id, id: contact.object.id), class: 'contact-email-delete btn btn-sm btn-danger', method: :delete, data: { confirm: t('.email_delete_confirmation'), remote: true } do %>
15
+ <%= link_to exhibit_contact_email_path(exhibit_id: exhibit.id, id: contact.object.id), class: 'contact-email-delete btn btn-sm btn-danger',
16
+ data: { method: :delete, turbo_method: :delete,
17
+ confirm: t('.email_delete_confirmation'),
18
+ turbo_confirm: t('.email_delete_confirmation'),
19
+ remote: true } do %>
16
20
  <%= t('.email_delete_button') %>
17
21
  <% end %>
18
22
  </span>
@@ -1,7 +1,9 @@
1
1
  <h2 class="sr-only"><%= t(:'.header') %></h2>
2
2
  <ul class="nav sidenav top-level flex-column">
3
3
  <%= nav_link t(:'spotlight.curation.sidebar.dashboard'), spotlight.exhibit_dashboard_path(current_exhibit) %>
4
+ <% if current_exhibit.analytics_provider&.enabled? %>
4
5
  <%= nav_link t(:'spotlight.curation.sidebar.analytics'), spotlight.analytics_exhibit_dashboard_path(current_exhibit) %>
6
+ <% end %>
5
7
  </ul>
6
8
  <%= render 'spotlight/shared/configuration_sidebar' if can? :update, current_exhibit %>
7
9
  <%= render 'spotlight/shared/curation_sidebar' %>
@@ -3,7 +3,7 @@
3
3
  <% contact_form ||= Spotlight::ContactForm.new current_url: request.original_url %>
4
4
  <%= bootstrap_form_for contact_form, url: spotlight.exhibit_contact_form_path(current_exhibit, contact_form), layout: :horizontal, label_col: 'col-sm-3', control_col: 'col-sm-9', html: { class: 'col-md-offset-2 col-md-8 my-3 '} do |f| %>
5
5
  <h2><%= t(:'.title') %></h2>
6
- <div class="alert alert-primary"><%= t('.reporting_from', url: contact_form.current_url) %></div>
6
+ <div class="alert alert-info"><%= t('.reporting_from', url: contact_form.current_url) %></div>
7
7
  <%= f.text_area :message, rows: 4 %>
8
8
  <%= f.text_field :name %>
9
9
  <%= render '/spotlight/shared/honeypot_field', f: f %>
@@ -1,7 +1,7 @@
1
1
  <% if search_results_block.searches? %>
2
2
  <div class="content-block documents">
3
3
  <% response, document_list = get_search_widget_search_results(search_results_block) %>
4
- <%- unless document_list.present? %>
4
+ <%- unless response.documents.present? %>
5
5
  <div class="alert alert-warning">
6
6
  <strong>No items to display.</strong> There are currently no items in this exhibit that match the curator's search criteria.
7
7
  </div>
@@ -18,7 +18,7 @@
18
18
  <% end %>
19
19
 
20
20
  <h2 class="sr-only visually-hidden"><%= t('blacklight.search.search_results') %></h2>
21
- <%= render_document_index_with_view(block_document_index_view_type(search_results_block), document_list) %>
21
+ <%= render_document_index_with_view(block_document_index_view_type(search_results_block), response.documents) %>
22
22
  <%= render 'results_pagination' %>
23
23
  <%- end %>
24
24
  </div>
@@ -40,7 +40,12 @@
40
40
  <%= link_to(t('.recreate'), polymorphic_path([:clone, current_exhibit, page], language: @language), data: { confirm: t('.recreate_are_you_sure') }) %>
41
41
  <% if page.feature_page? || page.about_page? %>
42
42
  &middot;
43
- <%= link_to(t('.destroy'), polymorphic_path([current_exhibit, translated_page], locale: @language), method: :delete, data: { confirm: t('.destroy_are_you_sure') }) %>
43
+ <%= link_to(t('.destroy'), polymorphic_path([current_exhibit, translated_page], locale: @language),
44
+ data: {
45
+ method: :delete,
46
+ turbo_method: :delete,
47
+ confirm: t('.destroy_are_you_sure'),
48
+ turbo_confirm: t('.destroy_are_you_sure') }) %>
44
49
  <% end %>
45
50
  <% end %>
46
51
  </td>
@@ -373,14 +373,9 @@ en:
373
373
  breadcrumb:
374
374
  index: Search results
375
375
  document_visibility_control:
376
- inprogress:
377
- label: ''
378
- make_private:
379
- button: Make private
380
- label: ''
381
- make_public:
382
- button: Make public
383
- label: ''
376
+ inprogress: In progress
377
+ make_private: Make private
378
+ make_public: Make public
384
379
  edit_default:
385
380
  url-field:
386
381
  help: 'Valid file types: %{extensions}'
@@ -801,7 +796,7 @@ en:
801
796
  note_provenance_tesim: Provenance
802
797
  note_references_tesim: References
803
798
  note_source_tesim: Source
804
- personal_name_ssim: Personal names
799
+ personal_name_ssm: Personal names
805
800
  search:
806
801
  all_fields: Everything
807
802
  author: Author
@@ -10,29 +10,17 @@ module Spotlight
10
10
  class_option :solr_update_class, type: :string, default: 'Spotlight::SolrDocument::AtomicUpdates'
11
11
  class_option :mailer_default_url_host, type: :string, default: '' # e.g. localhost:3000
12
12
 
13
- # we're not (yet) using webpacker, so we need to re-add sprockets functionality
13
+ # we're not using webpacker, so we need to re-add sprockets functionality
14
14
  def add_js_rails6
15
15
  return unless Rails.version.to_i == 6
16
16
 
17
- gem 'coffee-rails', '~> 4.2'
18
- gem 'uglifier', '>= 1.3.0'
19
-
20
- append_to_file 'app/assets/config/manifest.js', "\n//= link_directory ../javascripts .js\n"
21
- append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
17
+ # By default rails generates javascript_pack_tag, we'll change this to javascript_include_tag
22
18
  gsub_file 'app/views/layouts/application.html.erb', /pack/, 'include'
23
- inject_into_file 'config/environments/production.rb', after: ' # config.assets.css_compressor = :sass' do
24
- "\n config.assets.js_compressor = :uglifier"
25
- end
26
-
27
- # but since webpacker exists in the gemfile, we still need to run the
28
- # install before rails will start
29
- run 'bundle exec rails webpacker:install'
30
19
  end
31
20
 
32
- def add_js_rails7
33
- return unless Rails.version.to_i == 7
34
-
21
+ def add_manifest
35
22
  append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
23
+ append_to_file 'app/assets/config/manifest.js', "\n//= link spotlight/manifest.js"
36
24
  end
37
25
 
38
26
  def inject_spotlight_routes
@@ -67,9 +55,9 @@ module Spotlight
67
55
 
68
56
  copy_file 'config/sitemap.rb', 'config/sitemap.rb'
69
57
 
70
- say <<-EOS.strip_heredoc, :red
71
- Added a default sitemap_generator configuration in config/sitemap.rb; please
72
- update the default host to match your environment
58
+ say <<~EOS, :red
59
+ Added a default sitemap_generator configuration in config/sitemap.rb; please
60
+ update the default host to match your environment
73
61
  EOS
74
62
  end
75
63
 
@@ -132,14 +120,18 @@ module Spotlight
132
120
  end
133
121
 
134
122
  def add_osd_viewer
135
- gem 'blacklight-gallery', '~> 4.0'
136
- bundle_install
123
+ unless Bundler.locked_gems.dependencies.key? 'blacklight-gallery'
124
+ gem 'blacklight-gallery', '~> 4.0'
125
+ bundle_install
126
+ end
137
127
  generate 'blacklight_gallery:install'
138
128
  end
139
129
 
140
130
  def add_oembed
141
- gem 'blacklight-oembed', '~> 1.0'
142
- bundle_install
131
+ unless Bundler.locked_gems.dependencies.key? 'blacklight-oembed'
132
+ gem 'blacklight-oembed', '~> 1.0'
133
+ bundle_install
134
+ end
143
135
  generate 'blacklight_oembed:install'
144
136
  copy_file 'config/initializers/oembed.rb'
145
137
  end
@@ -9,7 +9,7 @@ module Spotlight
9
9
  source_root File.expand_path('templates', __dir__)
10
10
 
11
11
  def create_model
12
- create_file "app/models/#{file_name}_resource.rb", <<-FILE.strip_heredoc
12
+ create_file "app/models/#{file_name}_resource.rb", <<~FILE
13
13
  class #{class_name}Resource < Spotlight::Resource
14
14
  def self.indexing_pipeline
15
15
  @indexing_pipeline ||= super.dup.tap do |pipeline|
@@ -21,7 +21,7 @@ module Spotlight
21
21
  end
22
22
 
23
23
  def create_controller
24
- create_file "app/controllers/#{file_name}_resources_controller.rb", <<-FILE.strip_heredoc
24
+ create_file "app/controllers/#{file_name}_resources_controller.rb", <<~FILE
25
25
  class #{class_name}ResourcesController < Spotlight::ResourcesController
26
26
  private
27
27
 
@@ -33,16 +33,16 @@ module Spotlight
33
33
  end
34
34
 
35
35
  def create_form
36
- create_file "app/views/#{file_name}_resources/_form.html.erb", <<-FILE.strip_heredoc
37
- <%= bootstrap_form_for([current_exhibit, @resource.becomes(#{class_name}Resource)], as: :resource) do |f| %>
38
- <%= f.text_field :url %>
39
- <div class="form-actions">
40
- <div class="primary-actions">
41
- <%= cancel_link @resource, :back, class: 'btn btn-secondary' %>
42
- <%= f.submit t('.add_item'), class: 'btn btn-primary' %>
36
+ create_file "app/views/#{file_name}_resources/_form.html.erb", <<~FILE
37
+ <%= bootstrap_form_for([current_exhibit, @resource.becomes(#{class_name}Resource)], as: :resource) do |f| %>
38
+ <%= f.text_field :url %>
39
+ <div class="form-actions">
40
+ <div class="primary-actions">
41
+ <%= cancel_link @resource, :back, class: 'btn btn-secondary' %>
42
+ <%= f.submit t('.add_item'), class: 'btn btn-primary' %>
43
+ </div>
43
44
  </div>
44
- </div>
45
- <% end if can? :manage, @resource %>
45
+ <% end if can? :manage, @resource %>
46
46
  FILE
47
47
  end
48
48
  end
@@ -54,7 +54,7 @@ module Spotlight
54
54
  end
55
55
 
56
56
  def create_routes
57
- route <<-FILE.strip_heredoc
57
+ route <<~FILE
58
58
  resources :exhibits, only: [] do
59
59
  resources :#{file_name}_resources, only: [:create, :update] do
60
60
  end
@@ -21,6 +21,9 @@
21
21
  # Spotlight::Engine.config.default_browse_index_view_type = :gallery
22
22
  # Spotlight::Engine.config.default_contact_email = nil
23
23
 
24
+ # ==> IIIF configuration
25
+ # Spotlight::Engine.config.iiif_service = Spotlight::RIIIFService
26
+
24
27
  # ==> Solr configuration
25
28
  # Spotlight::Engine.config.writable_index = true
26
29
  # Spotlight::Engine.config.solr_batch_size = 20
@@ -0,0 +1,3 @@
1
+ {
2
+ "initArgs":{},
3
+ "managedList":[]}
@@ -0,0 +1,31 @@
1
+ <!--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ <!-- The content of this page will be statically included into the top
19
+ of the admin page. Uncomment this as an example to see there the content
20
+ will show up.
21
+
22
+ <hr>
23
+ <i>This line will appear before the first table</i>
24
+ <tr>
25
+ <td colspan="2">
26
+ This row will be appended to the end of the first table
27
+ </td>
28
+ </tr>
29
+ <hr>
30
+
31
+ -->
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ -->
18
+
19
+ <!-- If this file is found in the config directory, it will only be
20
+ loaded once at startup. If it is found in Solr's data
21
+ directory, it will be re-loaded every commit.
22
+ -->
23
+
24
+ <elevate>
25
+ <query text="foo bar">
26
+ <doc id="1" />
27
+ <doc id="2" />
28
+ <doc id="3" />
29
+ </query>
30
+
31
+ <query text="ipod">
32
+ <doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
33
+ <doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
34
+ </query>
35
+
36
+ </elevate>