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
@@ -159,3 +159,19 @@ form.edit_solr_document {
159
159
  }
160
160
  }
161
161
  }
162
+
163
+ .visibility-toggle {
164
+ .no-js & {
165
+ input[type="submit"] {
166
+ display: inline
167
+ }
168
+
169
+ div.toggle-visibility {
170
+ display: none
171
+ }
172
+ }
173
+
174
+ input[type="submit"] {
175
+ display: none;
176
+ }
177
+ }
@@ -6,7 +6,8 @@ module Spotlight
6
6
  module Base
7
7
  extend ActiveSupport::Concern
8
8
 
9
- include Blacklight::Base
9
+ include Blacklight::Configurable
10
+ include Blacklight::SearchContext
10
11
  include Spotlight::Config
11
12
 
12
13
  included do
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spotlight/search_state'
4
+
3
5
  module Spotlight
4
6
  ##
5
7
  # Spotlight controller helpers
@@ -67,6 +69,14 @@ module Spotlight
67
69
  end
68
70
  end
69
71
 
72
+ def search_state
73
+ if current_exhibit
74
+ @search_state ||= Spotlight::SearchState.new(super, current_exhibit)
75
+ else
76
+ super
77
+ end
78
+ end
79
+
70
80
  def search_action_url(*args, **kwargs)
71
81
  if current_exhibit
72
82
  exhibit_search_action_url(*args, **kwargs)
@@ -18,9 +18,9 @@ module Spotlight
18
18
  def create
19
19
  if update_roles
20
20
  Spotlight::InviteUsersService.call(resource: @site)
21
- flash[:notice] = t('spotlight.admin_users.create.success')
21
+ flash[:notice] = t('.success')
22
22
  else
23
- flash[:error] = t('spotlight.admin_users.create.error')
23
+ flash[:error] = t('.error')
24
24
  end
25
25
 
26
26
  redirect_to spotlight.admin_users_path
@@ -41,9 +41,9 @@ module Spotlight
41
41
  def destroy
42
42
  user = Spotlight::Engine.user_class.find(params[:id])
43
43
  if user.roles.where(resource: @site).first.destroy
44
- flash[:notice] = t('spotlight.admin_users.destroy.success')
44
+ flash[:notice] = t('.success')
45
45
  else
46
- flash[:error] = t('spotlight.admin_users.destroy.error')
46
+ flash[:error] = t('.error')
47
47
  end
48
48
  redirect_to spotlight.admin_users_path
49
49
  end
@@ -7,6 +7,12 @@ module Spotlight
7
7
  before_action :authenticate_user!
8
8
  load_and_authorize_resource id_param: :exhibit_id, instance_name: 'exhibit', class: 'Spotlight::Exhibit', parent: false
9
9
 
10
+ def edit
11
+ add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
12
+ add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
13
+ add_breadcrumb t(:'spotlight.configuration.sidebar.appearance'), edit_exhibit_appearance_path(@exhibit)
14
+ end
15
+
10
16
  def update
11
17
  if @exhibit.update(exhibit_params)
12
18
  notice = t(:'helpers.submit.spotlight_default.updated', model: @exhibit.class.model_name.human.downcase)
@@ -16,12 +22,6 @@ module Spotlight
16
22
  end
17
23
  end
18
24
 
19
- def edit
20
- add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
21
- add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
22
- add_breadcrumb t(:'spotlight.configuration.sidebar.appearance'), edit_exhibit_appearance_path(@exhibit)
23
- end
24
-
25
25
  protected
26
26
 
27
27
  def exhibit_params
@@ -7,7 +7,7 @@ module Spotlight
7
7
  class BrowseController < Spotlight::ApplicationController
8
8
  load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
9
9
  include Spotlight::Catalog
10
- include Blacklight::Facet
10
+ include Blacklight::Facet if defined?(Blacklight::Facet)
11
11
 
12
12
  load_and_authorize_resource :group, through: :exhibit
13
13
  load_and_authorize_resource :search, through: %i[group exhibit], parent: false
@@ -20,6 +20,8 @@ module Spotlight
20
20
  before_action :attach_breadcrumbs
21
21
  before_action :add_breadcrumb_with_search_params, only: :index
22
22
 
23
+ before_action :load_document, only: %i[edit update make_private make_public manifest]
24
+
23
25
  before_action only: :show do
24
26
  blacklight_config.show.partials.unshift 'tophat'
25
27
  blacklight_config.show.partials.unshift 'curation_mode_toggle'
@@ -53,13 +55,13 @@ module Spotlight
53
55
  # setup within their index analyzer. This will ensure that this method returns
54
56
  # results when a partial match is passed in the "q" parameter.
55
57
  def autocomplete
56
- (_, @document_list) = search_service.search_results do |builder|
58
+ @response, = search_service.search_results do |builder|
57
59
  builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))
58
60
  end
59
61
 
60
62
  respond_to do |format|
61
63
  format.json do
62
- render json: { docs: autocomplete_json_response(@document_list) }
64
+ render json: { docs: autocomplete_json_response(@response.documents) }
63
65
  end
64
66
  end
65
67
  end
@@ -67,7 +69,7 @@ module Spotlight
67
69
  def admin
68
70
  add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
69
71
  add_breadcrumb t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_path(@exhibit)
70
- (@response, @document_list) = search_service.search_results
72
+ (@response,) = search_service.search_results
71
73
  @filters = params[:f] || []
72
74
 
73
75
  respond_to do |format|
@@ -75,8 +77,9 @@ module Spotlight
75
77
  end
76
78
  end
77
79
 
80
+ def edit; end
81
+
78
82
  def update
79
- @response, @document = search_service.fetch params[:id]
80
83
  @document.update(current_exhibit, solr_document_params)
81
84
  @document.save
82
85
 
@@ -85,12 +88,7 @@ module Spotlight
85
88
  redirect_to polymorphic_path([current_exhibit, @document])
86
89
  end
87
90
 
88
- def edit
89
- @response, @document = search_service.fetch params[:id]
90
- end
91
-
92
91
  def make_private
93
- @response, @document = search_service.fetch params[:id]
94
92
  @document.make_private!(current_exhibit)
95
93
  @document.save
96
94
 
@@ -101,7 +99,6 @@ module Spotlight
101
99
  end
102
100
 
103
101
  def make_public
104
- @response, @document = search_service.fetch params[:id]
105
102
  @document.make_public!(current_exhibit)
106
103
  @document.save
107
104
 
@@ -112,10 +109,8 @@ module Spotlight
112
109
  end
113
110
 
114
111
  def manifest
115
- _, document = search_service.fetch params[:id]
116
-
117
- if document.uploaded_resource?
118
- render json: Spotlight::IiifManifestPresenter.new(document, self).iiif_manifest_json
112
+ if @document.uploaded_resource?
113
+ render json: Spotlight::IiifManifestPresenter.new(@document, self).iiif_manifest_json
119
114
  else
120
115
  head :not_found
121
116
  end
@@ -123,6 +118,16 @@ module Spotlight
123
118
 
124
119
  protected
125
120
 
121
+ def load_document
122
+ result = search_service.fetch params[:id]
123
+
124
+ @document = if result.is_a?(Array)
125
+ result.last
126
+ else
127
+ result
128
+ end
129
+ end
130
+
126
131
  def attach_breadcrumbs
127
132
  if view_context.current_page?({ action: :admin })
128
133
  add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), exhibit_root_path(@exhibit)
@@ -170,7 +175,7 @@ module Spotlight
170
175
  def solr_document_params
171
176
  params.require(:solr_document).permit(:exhibit_tag_list,
172
177
  uploaded_resource: [:url],
173
- sidecar: [:public, data: [editable_solr_document_params]])
178
+ sidecar: [:public, { data: [editable_solr_document_params] }])
174
179
  end
175
180
 
176
181
  def editable_solr_document_params
@@ -13,6 +13,7 @@ module Spotlight
13
13
  included do
14
14
  layout 'spotlight/spotlight'
15
15
 
16
+ helper ::BlacklightHelper
16
17
  helper Spotlight::ApplicationHelper
17
18
 
18
19
  rescue_from CanCan::AccessDenied do |exception|
@@ -14,7 +14,7 @@ module Spotlight
14
14
  current_search_session_page_context
15
15
  end
16
16
  rescue ActiveRecord::RecordNotFound => e
17
- Rails.logger.debug "Unable to get current page context from #{current_search_session.inspect}: #{e}"
17
+ Rails.logger.debug { "Unable to get current page context from #{current_search_session.inspect}: #{e}" }
18
18
  nil
19
19
  end
20
20
 
@@ -24,7 +24,7 @@ module Spotlight
24
24
  current_exhibit.searches.accessible_by(current_ability).find(search_id)
25
25
  end
26
26
  rescue ActiveRecord::RecordNotFound => e
27
- Rails.logger.debug "Unable to get current page context from #{current_search_session.inspect}: #{e}"
27
+ Rails.logger.debug { "Unable to get current page context from #{current_search_session.inspect}: #{e}" }
28
28
  nil
29
29
  end
30
30
 
@@ -18,19 +18,19 @@ module Spotlight
18
18
  add_breadcrumb @contact.name, edit_exhibit_contact_path(@contact.exhibit, @contact)
19
19
  end
20
20
 
21
- def update
21
+ def create
22
22
  if @contact.update(contact_params)
23
- redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.updated', model: @contact.class.model_name.human.downcase)
23
+ redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.created', model: @contact.class.model_name.human.downcase)
24
24
  else
25
- render 'edit'
25
+ render 'new'
26
26
  end
27
27
  end
28
28
 
29
- def create
29
+ def update
30
30
  if @contact.update(contact_params)
31
- redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.created', model: @contact.class.model_name.human.downcase)
31
+ redirect_to exhibit_about_pages_path(@contact.exhibit), notice: t(:'helpers.submit.contact.updated', model: @contact.class.model_name.human.downcase)
32
32
  else
33
- render 'new'
33
+ render 'edit'
34
34
  end
35
35
  end
36
36
 
@@ -52,10 +52,10 @@ module Spotlight
52
52
 
53
53
  def load_recent_solr_documents(count)
54
54
  solr_params = { sort: "#{blacklight_config.index.timestamp_field} desc" }
55
- @response, docs = search_service.search_results do |builder|
55
+ @response, _docs = search_service.search_results do |builder|
56
56
  builder.merge(solr_params)
57
57
  end
58
- docs.take(count)
58
+ @response.documents.take(count)
59
59
  end
60
60
  end
61
61
  end
@@ -20,6 +20,18 @@ module Spotlight
20
20
  end
21
21
  end
22
22
 
23
+ def show
24
+ respond_to do |format|
25
+ format.json do
26
+ authorize! :export, @exhibit
27
+ send_data JSON.pretty_generate(Spotlight::ExhibitImportExportService.new(@exhibit).as_json),
28
+ type: 'application/json',
29
+ disposition: 'attachment',
30
+ filename: "#{@exhibit.friendly_id}-export.json"
31
+ end
32
+ end
33
+ end
34
+
23
35
  def new
24
36
  build_initial_exhibit_contact_emails
25
37
  add_breadcrumb t(:'spotlight.sites.home'), root_url
@@ -34,6 +46,13 @@ module Spotlight
34
46
  end
35
47
  end
36
48
 
49
+ def edit
50
+ add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
51
+ add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
52
+ add_breadcrumb t(:'spotlight.configuration.sidebar.settings'), edit_exhibit_path(@exhibit)
53
+ build_initial_exhibit_contact_emails
54
+ end
55
+
37
56
  def create
38
57
  @exhibit.attributes = exhibit_params
39
58
 
@@ -45,25 +64,6 @@ module Spotlight
45
64
  end
46
65
  end
47
66
 
48
- def show
49
- respond_to do |format|
50
- format.json do
51
- authorize! :export, @exhibit
52
- send_data JSON.pretty_generate(Spotlight::ExhibitImportExportService.new(@exhibit).as_json),
53
- type: 'application/json',
54
- disposition: 'attachment',
55
- filename: "#{@exhibit.friendly_id}-export.json"
56
- end
57
- end
58
- end
59
-
60
- def edit
61
- add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
62
- add_breadcrumb t(:'spotlight.configuration.sidebar.header'), exhibit_dashboard_path(@exhibit)
63
- add_breadcrumb t(:'spotlight.configuration.sidebar.settings'), edit_exhibit_path(@exhibit)
64
- build_initial_exhibit_contact_emails
65
- end
66
-
67
67
  def update
68
68
  if @exhibit.update(exhibit_params)
69
69
  redirect_to edit_exhibit_path(@exhibit, tab: @tab),
@@ -16,7 +16,7 @@ module Spotlight
16
16
  private
17
17
 
18
18
  def tilesource
19
- riiif.info_url(@featured_image)
19
+ Spotlight::Engine.config.iiif_service.info_url(@featured_image, request.host)
20
20
  end
21
21
 
22
22
  # The create action can be called from a number of different forms, so
@@ -10,13 +10,7 @@ module Spotlight
10
10
 
11
11
  before_action :attach_breadcrumbs, except: :show
12
12
 
13
- helper_method :facet_limit_for
14
-
15
- def edit
16
- add_breadcrumb t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)
17
- add_breadcrumb @page.title, [:edit, @exhibit, @page]
18
- super
19
- end
13
+ helper_method :facet_limit_for, :search_facet_path
20
14
 
21
15
  def index
22
16
  redirect_to exhibit_feature_pages_path(@exhibit)
@@ -32,6 +26,12 @@ module Spotlight
32
26
  end
33
27
  end
34
28
 
29
+ def edit
30
+ add_breadcrumb t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)
31
+ add_breadcrumb @page.title, [:edit, @exhibit, @page]
32
+ super
33
+ end
34
+
35
35
  # We're oddly getting an unknown action
36
36
  # error w/o explicitly defining this here
37
37
  def clone
@@ -10,7 +10,7 @@ module Spotlight
10
10
  def destroy
11
11
  @lock.destroy
12
12
 
13
- render plain: '', status: 204
13
+ render plain: '', status: :no_content
14
14
  end
15
15
  end
16
16
  end
@@ -43,8 +43,8 @@ module Spotlight
43
43
  def exhibit_configuration_index_params
44
44
  views = @blacklight_configuration.default_blacklight_config.view.keys | [:show]
45
45
 
46
- @blacklight_configuration.blacklight_config.index_fields.keys.each_with_object({}) do |element, result|
47
- result[element] = (%i[enabled label weight] | views)
46
+ @blacklight_configuration.blacklight_config.index_fields.keys.index_with do |_element|
47
+ (%i[enabled label weight] | views)
48
48
  end
49
49
  end
50
50
  end
@@ -74,7 +74,7 @@ module Spotlight
74
74
  @page.lock&.delete
75
75
 
76
76
  if @page.update(page_params.merge(last_edited_by: current_user))
77
- redirect_to [spotlight, @page.exhibit, @page, format: params.permit(:format)], flash: { html_safe: true }, notice: undo_notice(:updated)
77
+ redirect_to [spotlight, @page.exhibit, @page, { format: params.permit(:format) }], flash: { html_safe: true }, notice: undo_notice(:updated)
78
78
  else
79
79
  render action: 'edit'
80
80
  end
@@ -128,7 +128,8 @@ module Spotlight
128
128
  return unless can? :manage, @page
129
129
  return if @page.versions.blank?
130
130
 
131
- view_context.link_to(t(:'spotlight.versions.undo'), revert_version_path(@page.versions.last), method: :post)
131
+ view_context.link_to(t(:'spotlight.versions.undo'), revert_version_path(@page.versions.last),
132
+ data: { method: :post, turbo_method: :post })
132
133
  end
133
134
 
134
135
  def undo_notice(key)
@@ -150,7 +151,7 @@ module Spotlight
150
151
  end
151
152
 
152
153
  def allowed_page_params
153
- [:title, :content, thumbnail_attributes: featured_image_params]
154
+ [:title, :content, { thumbnail_attributes: featured_image_params }]
154
155
  end
155
156
 
156
157
  def human_name
@@ -48,20 +48,20 @@ module Spotlight
48
48
  end
49
49
 
50
50
  def exhibit_configuration_facet_params
51
- @blacklight_configuration.blacklight_config.facet_fields.keys.each_with_object({}) do |element, result|
52
- result[element] = %i[show label weight sort]
51
+ @blacklight_configuration.blacklight_config.facet_fields.keys.index_with do |_element|
52
+ %i[show label weight sort]
53
53
  end
54
54
  end
55
55
 
56
56
  def exhibit_configuration_search_params
57
- @blacklight_configuration.blacklight_config.search_fields.keys.each_with_object({}) do |element, result|
58
- result[element] = %i[enabled label weight]
57
+ @blacklight_configuration.blacklight_config.search_fields.keys.index_with do |_element|
58
+ %i[enabled label weight]
59
59
  end
60
60
  end
61
61
 
62
62
  def exhibit_configuration_sort_params
63
- @blacklight_configuration.blacklight_config.sort_fields.keys.each_with_object({}) do |element, result|
64
- result[element] = %i[enabled label weight]
63
+ @blacklight_configuration.blacklight_config.sort_fields.keys.index_with do |_element|
64
+ %i[enabled label weight]
65
65
  end
66
66
  end
67
67
  end
@@ -14,6 +14,26 @@ module Spotlight
14
14
  include Spotlight::Base
15
15
  include Spotlight::SearchHelper
16
16
 
17
+ def index
18
+ @groups = @exhibit.groups
19
+ respond_to do |format|
20
+ format.html
21
+ format.json do
22
+ render json: @searches.as_json(methods: %i[full_title count thumbnail_image_url]), root: false
23
+ end
24
+ end
25
+ end
26
+
27
+ def show
28
+ redirect_to exhibit_browse_url(@search.exhibit, @search)
29
+ end
30
+
31
+ def edit
32
+ @groups = @exhibit.groups
33
+ add_breadcrumb @search.full_title, edit_exhibit_search_path(@search.exhibit, @search)
34
+ @exhibit = @search.exhibit
35
+ end
36
+
17
37
  def create
18
38
  @search.assign_attributes(search_params.except((:title unless @search.new_record?)))
19
39
  @search.query_params = query_params
@@ -26,35 +46,19 @@ module Spotlight
26
46
  end
27
47
  end
28
48
 
29
- def index
30
- @groups = @exhibit.groups
31
- respond_to do |format|
32
- format.html
33
- format.json do
34
- render json: @searches.as_json(methods: %i[full_title count thumbnail_image_url]), root: false
35
- end
36
- end
37
- end
38
-
39
49
  def autocomplete
40
50
  search_params = autocomplete_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
41
- (_, document_list) = search_service.search_results do |builder|
51
+ (response, _document_list) = search_service.search_results do |builder|
42
52
  builder.with(search_params)
43
53
  end
44
54
 
45
55
  respond_to do |format|
46
56
  format.json do
47
- render json: { docs: autocomplete_json_response(document_list) }
57
+ render json: { docs: autocomplete_json_response(response.documents) }
48
58
  end
49
59
  end
50
60
  end
51
61
 
52
- def edit
53
- @groups = @exhibit.groups
54
- add_breadcrumb @search.full_title, edit_exhibit_search_path(@search.exhibit, @search)
55
- @exhibit = @search.exhibit
56
- end
57
-
58
62
  def update
59
63
  if @search.update search_params
60
64
  redirect_to exhibit_searches_path(@search.exhibit), notice: t(:'helpers.submit.search.updated', model: @search.class.model_name.human.downcase)
@@ -77,10 +81,6 @@ module Spotlight
77
81
  redirect_back fallback_location: fallback_url, notice: notice
78
82
  end
79
83
 
80
- def show
81
- redirect_to exhibit_browse_url(@search.exhibit, @search)
82
- end
83
-
84
84
  protected
85
85
 
86
86
  def autocomplete_params
@@ -57,7 +57,7 @@ module Spotlight
57
57
  def validate_writable_index!
58
58
  return if Spotlight::Engine.config.writable_index
59
59
 
60
- render plain: 'Spotlight is unable to write to solr', status: 409
60
+ render plain: 'Spotlight is unable to write to solr', status: :conflict
61
61
  end
62
62
 
63
63
  def create_or_update_solr_document_sidecar(doc, data)
@@ -7,6 +7,12 @@ module Spotlight
7
7
  before_action :authenticate_user!, :set_language, :set_tab
8
8
  load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
9
9
 
10
+ def show
11
+ respond_to do |format|
12
+ format.yaml
13
+ end
14
+ end
15
+
10
16
  def edit
11
17
  attach_breadcrumbs
12
18
  end
@@ -21,12 +27,6 @@ module Spotlight
21
27
  end
22
28
  end
23
29
 
24
- def show
25
- respond_to do |format|
26
- format.yaml
27
- end
28
- end
29
-
30
30
  def import
31
31
  if current_exhibit.update(import_exhibit_params)
32
32
  I18n.reload! # reload since we're memoizing
@@ -72,15 +72,13 @@ module Spotlight
72
72
  @tab = params[:tab]
73
73
  end
74
74
 
75
- def unfold(value, key = nil)
75
+ def unfold(value, key = nil, &block)
76
76
  return to_enum(:unfold, value, key) unless block_given?
77
77
 
78
78
  if value.is_a? Hash
79
79
  value.each do |k, v|
80
80
  arr = unfold(v, [key, k].compact.join('.'))
81
- arr.each do |k1, v1|
82
- yield k1, v1
83
- end
81
+ arr.each(&block)
84
82
  end
85
83
  else
86
84
  yield key, value
@@ -32,7 +32,8 @@ module Spotlight
32
32
  view_context.t(:'spotlight.versions.redo')
33
33
  end
34
34
 
35
- view_context.link_to(link_name, revert_version_path(@version.next, redo: !params[:redo]), method: :post)
35
+ view_context.link_to(link_name, revert_version_path(@version.next, redo: !params[:redo]),
36
+ data: { method: :post, turbo_method: :post })
36
37
  end
37
38
  end
38
39
  end