blacklight-spotlight 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +153 -48
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js +33 -1
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  5. data/app/assets/javascripts/spotlight/spotlight.js +33 -1
  6. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  7. data/app/assets/stylesheets/spotlight/_admin_users.scss +28 -0
  8. data/app/assets/stylesheets/spotlight/_browse.scss +1 -1
  9. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +1 -1
  10. data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -0
  11. data/app/components/spotlight/admin_users/email_component.html.erb +5 -0
  12. data/app/components/spotlight/admin_users/email_component.rb +22 -0
  13. data/app/components/spotlight/admin_users/exhibit_roles_component.html.erb +28 -0
  14. data/app/components/spotlight/admin_users/exhibit_roles_component.rb +19 -0
  15. data/app/components/spotlight/admin_users/site_admin_component.html.erb +13 -0
  16. data/app/components/spotlight/admin_users/site_admin_component.rb +17 -0
  17. data/app/components/spotlight/analytics/aggregation_component.rb +1 -1
  18. data/app/components/spotlight/analytics/dashboard_component.rb +1 -1
  19. data/app/components/spotlight/breadcrumbs_component.rb +1 -1
  20. data/app/components/spotlight/bulk_action_component.rb +1 -1
  21. data/app/components/spotlight/edit_view_links_component.rb +1 -1
  22. data/app/components/spotlight/header_navigation_link_component.rb +1 -1
  23. data/app/components/spotlight/save_search_component.rb +1 -1
  24. data/app/components/spotlight/select_image_component.rb +1 -1
  25. data/app/components/spotlight/skip_link_component.rb +1 -1
  26. data/app/components/spotlight/solr_document_legacy_embed_component.rb +2 -2
  27. data/app/components/spotlight/tag_list_form_component.rb +1 -1
  28. data/app/components/spotlight/tag_selector_component.rb +1 -1
  29. data/app/components/spotlight/title_component.rb +1 -1
  30. data/app/components/spotlight/translations/subheading_component.rb +1 -1
  31. data/app/components/spotlight/uneditable_non_default_language_component.rb +1 -1
  32. data/app/controllers/spotlight/admin_users_controller.rb +11 -1
  33. data/app/controllers/spotlight/browse_controller.rb +2 -8
  34. data/app/controllers/spotlight/bulk_actions_controller.rb +1 -1
  35. data/app/controllers/spotlight/bulk_updates_controller.rb +22 -7
  36. data/app/controllers/spotlight/catalog_controller.rb +7 -15
  37. data/app/controllers/spotlight/dashboards_controller.rb +2 -6
  38. data/app/controllers/spotlight/exhibits_controller.rb +1 -0
  39. data/app/controllers/spotlight/home_pages_controller.rb +1 -1
  40. data/app/controllers/spotlight/searches_controller.rb +1 -1
  41. data/app/controllers/spotlight/solr_controller.rb +1 -0
  42. data/app/helpers/spotlight/main_app_helpers.rb +1 -5
  43. data/app/helpers/spotlight/rendering_helper.rb +4 -1
  44. data/app/javascript/spotlight/admin/blocks/pages_block.js +2 -0
  45. data/app/javascript/spotlight/user/carousel.js +32 -2
  46. data/app/jobs/spotlight/add_tags_job.rb +1 -0
  47. data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -0
  48. data/app/jobs/spotlight/change_visibility_job.rb +1 -0
  49. data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +1 -0
  50. data/app/jobs/spotlight/reindex_exhibit_job.rb +1 -0
  51. data/app/jobs/spotlight/reindex_job.rb +1 -0
  52. data/app/jobs/spotlight/remove_tags_job.rb +1 -0
  53. data/app/jobs/spotlight/rename_sidecar_field_job.rb +1 -0
  54. data/app/models/concerns/spotlight/user.rb +5 -0
  55. data/app/models/sir_trevor_rails/blocks/browse_block.rb +1 -1
  56. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +1 -1
  57. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +1 -0
  58. data/app/models/spotlight/ability.rb +1 -1
  59. data/app/models/spotlight/about_page.rb +1 -0
  60. data/app/models/spotlight/blacklight_configuration.rb +6 -7
  61. data/app/models/spotlight/contact.rb +2 -1
  62. data/app/models/spotlight/contact_email.rb +1 -0
  63. data/app/models/spotlight/custom_field.rb +1 -0
  64. data/app/models/spotlight/exhibit.rb +2 -9
  65. data/app/models/spotlight/feature_page.rb +1 -0
  66. data/app/models/spotlight/group.rb +2 -1
  67. data/app/models/spotlight/home_page.rb +1 -0
  68. data/app/models/spotlight/job_tracker.rb +1 -1
  69. data/app/models/spotlight/main_navigation.rb +1 -1
  70. data/app/models/spotlight/page.rb +28 -19
  71. data/app/models/spotlight/resource.rb +1 -0
  72. data/app/models/spotlight/resources/iiif_manifest.rb +0 -126
  73. data/app/models/spotlight/resources/iiif_manifest_metadata.rb +161 -0
  74. data/app/models/spotlight/resources/iiif_manifest_v3.rb +41 -0
  75. data/app/models/spotlight/resources/iiif_service.rb +25 -1
  76. data/app/models/spotlight/search.rb +2 -1
  77. data/app/services/spotlight/exhibit_import_export_service.rb +3 -1
  78. data/app/views/spotlight/admin_users/index.html.erb +16 -26
  79. data/app/views/spotlight/catalog/_document_admin_table.html.erb +2 -6
  80. data/app/views/spotlight/catalog/edit.html.erb +1 -6
  81. data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
  82. data/app/views/spotlight/pages/_order_pages.html.erb +1 -1
  83. data/app/views/spotlight/pages/show.html.erb +4 -2
  84. data/app/views/spotlight/resources/csv_upload/_form.html.erb +2 -0
  85. data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +2 -2
  86. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
  87. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +5 -3
  88. data/app/views/spotlight/sir_trevor/blocks/_text_block.html.erb +1 -1
  89. data/config/initializers/devise_rails8_patch.rb +13 -0
  90. data/config/locales/spotlight.en.yml +34 -5
  91. data/config/routes.rb +5 -1
  92. data/lib/spotlight/engine.rb +10 -26
  93. data/lib/spotlight/version.rb +1 -1
  94. data/spec/fixtures/iiif_responses.rb +344 -0
  95. data/spec/support/features/test_features_helpers.rb +4 -6
  96. data/spec/support/stub_iiif_response.rb +1 -0
  97. data/spec/support/with_queue_adapter.rb +17 -0
  98. metadata +42 -29
@@ -0,0 +1,28 @@
1
+ .site-admin-label {
2
+ display: none;
3
+ }
4
+
5
+ .site-admin {
6
+ .site-admin-label {
7
+ display: inline;
8
+ }
9
+ }
10
+
11
+ .user-emails {
12
+ min-width: 300px;
13
+ }
14
+
15
+ .user-exhibit-roles {
16
+ width: 50%;
17
+
18
+ details {
19
+ ul {
20
+ overflow-y: auto;
21
+ max-height: 200px;
22
+ }
23
+
24
+ .exhibit-title {
25
+ font-style: italic;
26
+ }
27
+ }
28
+ }
@@ -80,7 +80,7 @@ $image-overlay-max-height: 300px;
80
80
  justify-content: flex-end;
81
81
 
82
82
  &:hover {
83
- background: linear-gradient(rgba(46, 45, 41, 0.7), 0%, rgba(46, 45, 41, 0.7) 100%);
83
+ background: linear-gradient(rgba(46, 45, 41, 0.8), 0%, rgba(46, 45, 41, 0.8) 100%);
84
84
  }
85
85
 
86
86
  .browse-category-title {
@@ -75,7 +75,7 @@ $xl-sidebar-five-tile-width: ($container-xl-sidebar * 0.2) - $tile-margin;
75
75
  justify-content: flex-end;
76
76
 
77
77
  &:hover {
78
- background: linear-gradient(rgba(46, 45, 41, 0.7), 0%, rgba(46, 45, 41, 0.7) 100%);
78
+ background: linear-gradient(rgba(46, 45, 41, 0.8), 0%, rgba(46, 45, 41, 0.8) 100%);
79
79
  }
80
80
  }
81
81
 
@@ -35,6 +35,7 @@
35
35
  @import "utilities";
36
36
  @import "view_larger";
37
37
  @import "accessibility";
38
+ @import "admin_users";
38
39
  @import "autocomplete";
39
40
 
40
41
 
@@ -0,0 +1,5 @@
1
+ <%= content_tag :div, class: user_badge_classes do %>
2
+ <span class="text-break"><%= user.email %></span>
3
+ <span class="badge bg-secondary site-admin-label"><%= t('spotlight.admin_users.index.site_admin').downcase %></span>
4
+ <span class="badge bg-warning pending-label"><%= t('spotlight.admin_users.index.pending') %></span>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module AdminUsers
5
+ # Display email and badge for user
6
+ class EmailComponent < ViewComponent::Base
7
+ attr_reader :user
8
+
9
+ def initialize(user:)
10
+ super()
11
+ @user = user
12
+ end
13
+
14
+ def user_badge_classes
15
+ classes = []
16
+ classes << 'site-admin' if user.superadmin?
17
+ classes << 'invite-pending' if user.invite_pending?
18
+ classes
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ <% if sorted_exhibit_roles.present? %>
2
+ <div class="d-flex justify-content-between">
3
+ <div><%= sorted_exhibit_roles.map { |r| r.role.titleize }.uniq.join(", ") %></div>
4
+ <div>
5
+ <%= link_to(t('spotlight.admin_users.index.remove_roles'), helpers.spotlight.remove_exhibit_roles_admin_user_path(user),
6
+ data: {
7
+ method: :delete,
8
+ turbo_method: :delete,
9
+ turbo_confirm: t('spotlight.admin_users.index.remove_roles_confirm', email: user.email)
10
+ },
11
+ class: 'btn btn-sm btn-danger ms-3 mb-3 text-nowrap') %>
12
+ </div>
13
+ </div>
14
+ <details>
15
+ <summary><%= t('spotlight.admin_users.index.show_exhibit_roles') %></summary>
16
+ <ul>
17
+ <% sorted_exhibit_roles.each do |exhibit_role| %>
18
+ <li>
19
+ <span class="exhibit-title">
20
+ <%= link_to(exhibit_role.resource.title, helpers.spotlight.exhibit_roles_path(exhibit_role.resource),
21
+ target: :_blank) %>
22
+ </span>
23
+ (<%= exhibit_role.role.titleize %>)
24
+ </li>
25
+ <% end %>
26
+ </ul>
27
+ </details>
28
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module AdminUsers
5
+ # Display all exhibit roles for a user
6
+ class ExhibitRolesComponent < ViewComponent::Base
7
+ attr_reader :user
8
+
9
+ def initialize(user:)
10
+ super()
11
+ @user = user
12
+ end
13
+
14
+ def sorted_exhibit_roles
15
+ @sorted_exhibit_roles ||= user.all_exhibit_roles.sort_by { |r| [r.role, r.resource.title] }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ <% if user.superadmin? %>
2
+ <%= link_to(t('spotlight.admin_users.index.destroy'), helpers.admin_user_path(user),
3
+ data: {
4
+ method: :delete,
5
+ turbo_method: :delete,
6
+ turbo_confirm: t('spotlight.admin_users.index.destroy_confirm', email: user.email)
7
+ },
8
+ class: 'btn btn-sm btn-danger text-nowrap') unless user == current_user %>
9
+ <% else %>
10
+ <%= link_to(t('spotlight.admin_users.index.update'), helpers.admin_user_path(user),
11
+ data: { method: :patch, turbo_method: :patch },
12
+ class: 'btn btn-sm btn-primary text-nowrap') %>
13
+ <% end %>
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module AdminUsers
5
+ # Display site admin role actions for user
6
+ class SiteAdminComponent < ViewComponent::Base
7
+ attr_reader :user
8
+
9
+ delegate :current_user, to: :helpers
10
+
11
+ def initialize(user:)
12
+ super()
13
+ @user = user
14
+ end
15
+ end
16
+ end
17
+ end
@@ -5,7 +5,7 @@ module Spotlight
5
5
  # Display Analytics aggregations as table
6
6
  class AggregationComponent < ViewComponent::Base
7
7
  def initialize(data:, exclude_fields: nil)
8
- super
8
+ super()
9
9
  @exclude_fields = exclude_fields
10
10
  @data = data
11
11
  end
@@ -7,7 +7,7 @@ module Spotlight
7
7
  attr_reader :current_exhibit, :dates
8
8
 
9
9
  def initialize(current_exhibit:)
10
- super
10
+ super()
11
11
  @current_exhibit = current_exhibit
12
12
  @default_start_date = [min_date, 1.year.ago].max
13
13
  @default_end_date = [max_date, Time.zone.today].min
@@ -7,7 +7,7 @@ module Spotlight
7
7
 
8
8
  def initialize(breadcrumbs: [])
9
9
  @breadcrumbs = breadcrumbs
10
- super
10
+ super()
11
11
  end
12
12
 
13
13
  def render?
@@ -6,7 +6,7 @@ module Spotlight
6
6
  def initialize(bulk_actions:, button_classes: 'btn btn-primary dropdown-toggle')
7
7
  @bulk_actions = bulk_actions
8
8
  @button_classes = button_classes
9
- super
9
+ super()
10
10
  end
11
11
 
12
12
  attr_reader :button_classes, :bulk_actions
@@ -6,7 +6,7 @@ module Spotlight
6
6
  attr_reader :page, :classes, :delete_link
7
7
 
8
8
  def initialize(page:, classes: 'page-links', delete_link: false)
9
- super
9
+ super()
10
10
 
11
11
  @page = page
12
12
  @classes = classes
@@ -8,7 +8,7 @@ module Spotlight
8
8
  @path = path
9
9
  @active = active
10
10
  @label = label
11
- super
11
+ super()
12
12
  end
13
13
  end
14
14
  end
@@ -5,7 +5,7 @@ module Spotlight
5
5
  class SaveSearchComponent < ViewComponent::Base
6
6
  def initialize(button_classes: 'btn btn-outline-primary')
7
7
  @button_classes = button_classes
8
- super
8
+ super()
9
9
  end
10
10
 
11
11
  attr_reader :button_classes
@@ -4,7 +4,7 @@ module Spotlight
4
4
  # Component to select section of image
5
5
  class SelectImageComponent < ViewComponent::Base
6
6
  def initialize(index_id, block_item_id)
7
- super
7
+ super()
8
8
  @index_id = index_id
9
9
  @block_item_id = block_item_id
10
10
  end
@@ -6,7 +6,7 @@ module Spotlight
6
6
  def initialize(render_search_link: true)
7
7
  @render_search_link = render_search_link
8
8
 
9
- super
9
+ super()
10
10
  end
11
11
 
12
12
  def link_to_search
@@ -6,13 +6,13 @@ module Spotlight
6
6
  attr_reader :block_context
7
7
 
8
8
  def initialize(*args, block: nil, **kwargs)
9
- super
9
+ super(*args, **kwargs)
10
10
 
11
11
  @block_context = block
12
12
  end
13
13
 
14
14
  def before_render
15
- set_slot(:embed, nil, block_context:) unless embed
15
+ with_embed(block_context: block_context) unless embed
16
16
 
17
17
  super
18
18
  end
@@ -7,7 +7,7 @@ module Spotlight
7
7
 
8
8
  def initialize(form:)
9
9
  @form = form
10
- super
10
+ super()
11
11
  end
12
12
  end
13
13
  end
@@ -11,7 +11,7 @@ module Spotlight
11
11
  @selected_tags_value = selected_tags_value || ''
12
12
  @all_tags = all_tags&.sort_by { |tag| (tag.respond_to?(:name) ? tag.name : tag).downcase }
13
13
 
14
- super
14
+ super()
15
15
  end
16
16
 
17
17
  def selected_tags
@@ -6,7 +6,7 @@ module Spotlight
6
6
  def initialize(title:, subtitle:)
7
7
  @title = title
8
8
  @subtitle = subtitle
9
- super
9
+ super()
10
10
  end
11
11
 
12
12
  def title
@@ -6,7 +6,7 @@ module Spotlight
6
6
  class SubheadingComponent < ViewComponent::Base
7
7
  def initialize(key:)
8
8
  @key = key
9
- super
9
+ super()
10
10
  end
11
11
 
12
12
  def text
@@ -7,7 +7,7 @@ module Spotlight
7
7
  def initialize(current_exhibit:, current_language:)
8
8
  @current_exhibit = current_exhibit
9
9
  @current_language = current_language
10
- super
10
+ super()
11
11
  end
12
12
 
13
13
  def edit_translations_button
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Spotlight
4
4
  ##
5
- # A controller to handle the adminstration of site admin users
5
+ # A controller to handle the administration of users
6
6
  class AdminUsersController < Spotlight::ApplicationController
7
7
  before_action :authenticate_user!
8
8
  before_action :load_site
@@ -48,6 +48,16 @@ module Spotlight
48
48
  redirect_to spotlight.admin_users_path
49
49
  end
50
50
 
51
+ def remove_exhibit_roles
52
+ user = Spotlight::Engine.user_class.find(params[:id])
53
+ if user.all_exhibit_roles.destroy_all
54
+ flash[:notice] = t('.success')
55
+ else
56
+ flash[:error] = t('.error')
57
+ end
58
+ redirect_to spotlight.admin_users_path
59
+ end
60
+
51
61
  private
52
62
 
53
63
  def load_users
@@ -20,11 +20,7 @@ module Spotlight
20
20
  before_action :swap_actions_configuration, only: :show
21
21
 
22
22
  before_action do
23
- if Blacklight::VERSION > '8'
24
- blacklight_config.track_search_session.storage = false
25
- else
26
- blacklight_config.track_search_session = false
27
- end
23
+ blacklight_config.track_search_session.storage = false
28
24
  blacklight_config.view.gallery.classes = 'row-cols-2 row-cols-md-4' if blacklight_config.view.key? :gallery
29
25
  blacklight_config.action_mapping.default = blacklight_config.index
30
26
  blacklight_config.action_mapping.show = blacklight_config.index
@@ -36,9 +32,7 @@ module Spotlight
36
32
  end
37
33
 
38
34
  def show
39
- # For Blacklight 8, @document_list will be nil but
40
- # will be required for Blacklight 7 to work correctly.
41
- @response, @document_list = search_service.search_results do |builder|
35
+ @response = search_service.search_results do |builder|
42
36
  builder.with(params.merge(browse_category_id: @search.id))
43
37
  end
44
38
 
@@ -39,7 +39,7 @@ module Spotlight
39
39
 
40
40
  def solr_response
41
41
  @solr_response ||= begin
42
- response, _docs = search_service.search_results do |builder|
42
+ response = search_service.search_results do |builder|
43
43
  builder.merge(fl: 'id', rows: 0)
44
44
  end
45
45
 
@@ -24,7 +24,7 @@ module Spotlight
24
24
  headers['Content-Disposition'] = "attachment; filename=\"#{current_exhibit.slug}-bulk-update-template.csv\""
25
25
  headers.delete('Content-Length')
26
26
 
27
- self.response_body = csv_template
27
+ stream_csv_template
28
28
  end
29
29
 
30
30
  def update
@@ -43,16 +43,31 @@ module Spotlight
43
43
 
44
44
  private
45
45
 
46
+ def stream_csv_template
47
+ csv_template.each do |row|
48
+ response.stream.write row
49
+ end
50
+ ensure
51
+ response.stream.close
52
+ end
53
+
46
54
  def csv_template
47
- boolean = ActiveModel::Type::Boolean.new
48
- Spotlight::BulkUpdatesCsvTemplateService.new(exhibit: current_exhibit).template(
49
- view_context:,
50
- title: boolean.cast(reference_field_params[:item_title]),
51
- tags: boolean.cast(updatable_field_params[:tags]),
52
- visibility: boolean.cast(updatable_field_params[:visibility])
55
+ @csv_template ||= csv_template_service.template(
56
+ view_context: view_context,
57
+ title: active_model_boolean.cast(reference_field_params[:item_title]),
58
+ visibility: active_model_boolean.cast(updatable_field_params[:visibility]),
59
+ tags: active_model_boolean.cast(updatable_field_params[:tags])
53
60
  )
54
61
  end
55
62
 
63
+ def csv_template_service
64
+ @csv_template_service ||= Spotlight::BulkUpdatesCsvTemplateService.new(exhibit: current_exhibit)
65
+ end
66
+
67
+ def active_model_boolean
68
+ @active_model_boolean ||= ActiveModel::Type::Boolean.new
69
+ end
70
+
56
71
  def reference_field_params
57
72
  params.require(:reference_fields).permit(:item_title)
58
73
  end
@@ -24,14 +24,10 @@ module Spotlight
24
24
  before_action :load_document, only: %i[edit update make_private make_public manifest]
25
25
 
26
26
  before_action only: :show do
27
- # Substitute the default document component with the custom one for Blacklight 8,
28
- # and add the necessary partials for Blacklight 7 (if they haven't configured the document component)
27
+ # Substitute the default document component with the custom one for Blacklight 8
28
+ # (if they haven't configured the document component)
29
29
  if blacklight_config.show.document_component.nil? || blacklight_config.show.document_component == Blacklight::DocumentComponent
30
- if Blacklight::VERSION > '8'
31
- blacklight_config.show.document_component = Spotlight::DocumentComponent
32
- else
33
- blacklight_config.show.partials.unshift 'curation_mode_toggle'
34
- end
30
+ blacklight_config.show.document_component = Spotlight::DocumentComponent
35
31
  end
36
32
  end
37
33
 
@@ -42,13 +38,9 @@ module Spotlight
42
38
  partials: [:index_compact],
43
39
  document_actions: [])
44
40
  end
45
- blacklight_config.view.admin_table.document_component ||= Spotlight::DocumentAdminTableComponent
46
41
 
47
- if Blacklight::VERSION > '8'
48
- blacklight_config.track_search_session.storage = false
49
- else
50
- blacklight_config.track_search_session = false
51
- end
42
+ blacklight_config.view.admin_table.document_component ||= Spotlight::DocumentAdminTableComponent
43
+ blacklight_config.track_search_session.storage = false
52
44
 
53
45
  unless blacklight_config.sort_fields.key? :timestamp
54
46
  blacklight_config.add_sort_field :timestamp, default: true,
@@ -73,7 +65,7 @@ module Spotlight
73
65
  # setup within their index analyzer. This will ensure that this method returns
74
66
  # results when a partial match is passed in the "q" parameter.
75
67
  def autocomplete
76
- @response, = search_service.search_results do |builder|
68
+ @response = search_service.search_results do |builder|
77
69
  builder.with(builder.blacklight_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field, public: true, rows: 100))
78
70
  end
79
71
 
@@ -87,7 +79,7 @@ module Spotlight
87
79
  def admin
88
80
  add_breadcrumb(t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit))
89
81
  add_breadcrumb(t(:'spotlight.curation.sidebar.items'), admin_exhibit_catalog_path(@exhibit))
90
- (@response,) = search_service.search_results
82
+ @response = search_service.search_results
91
83
  @filters = params[:f] || []
92
84
 
93
85
  respond_to do |format|
@@ -16,11 +16,7 @@ module Spotlight
16
16
 
17
17
  blacklight_config.index.document_component = Spotlight::DocumentAdminTableComponent
18
18
  blacklight_config.index.document_actions = []
19
- if Blacklight::VERSION > '8'
20
- blacklight_config.track_search_session.storage = false
21
- else
22
- blacklight_config.track_search_session = false
23
- end
19
+ blacklight_config.track_search_session.storage = false
24
20
  end
25
21
 
26
22
  def show
@@ -57,7 +53,7 @@ module Spotlight
57
53
 
58
54
  def load_recent_solr_documents(count)
59
55
  solr_params = { sort: "#{blacklight_config.index.timestamp_field} desc" }
60
- @response, _docs = search_service.search_results do |builder|
56
+ @response = search_service.search_results do |builder|
61
57
  builder.merge(solr_params)
62
58
  end
63
59
  @response.documents.take(count)
@@ -5,6 +5,7 @@ module Spotlight
5
5
  # Administrative CRUD actions for an exhibit
6
6
  class ExhibitsController < Spotlight::ApplicationController
7
7
  include Spotlight::SearchHelper
8
+
8
9
  before_action :authenticate_user!, except: [:index]
9
10
  before_action :set_tab, only: %i[edit update]
10
11
 
@@ -17,7 +17,7 @@ module Spotlight
17
17
  end
18
18
 
19
19
  def show
20
- @response, @document_list = search_service.search_results if @page.display_sidebar?
20
+ @response = search_service.search_results if @page.display_sidebar?
21
21
 
22
22
  if @page.nil? || !@page.published?
23
23
  render '/catalog/index'
@@ -49,7 +49,7 @@ module Spotlight
49
49
 
50
50
  def autocomplete
51
51
  search_params = autocomplete_params.merge(search_field: Spotlight::Engine.config.autocomplete_search_field)
52
- (response, _document_list) = search_service.search_results do |builder|
52
+ response = search_service.search_results do |builder|
53
53
  builder.with(search_params)
54
54
  end
55
55
 
@@ -9,6 +9,7 @@ module Spotlight
9
9
  # workflows with exhibit-specific content
10
10
  class SolrController < Spotlight::ApplicationController
11
11
  include Spotlight::SearchHelper
12
+
12
13
  before_action :authenticate_user!
13
14
  before_action :validate_writable_index!
14
15
 
@@ -4,11 +4,7 @@ module Spotlight
4
4
  ##
5
5
  # Helpers that are injected into the main application (because they used in layouts)
6
6
  module MainAppHelpers
7
- if Blacklight.version < '8'
8
- include Blacklight::BlacklightHelperBehavior
9
- else
10
- include Blacklight::DocumentHelperBehavior
11
- end
7
+ include Blacklight::DocumentHelperBehavior
12
8
  include Spotlight::NavbarHelper
13
9
  include Spotlight::MastheadHelper
14
10
 
@@ -3,7 +3,10 @@
3
3
  module Spotlight
4
4
  module RenderingHelper # :nodoc:
5
5
  def render_markdown(text)
6
- GitHub::Markup.render('.md', text).html_safe
6
+ # Extend Redcarpet renderer to add HTML anchors to each heading in the output HTML
7
+ renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
8
+ # Use Redcarpet to render markdown as html
9
+ Redcarpet::Markdown.new(renderer).render(text).html_safe
7
10
  end
8
11
  end
9
12
  end
@@ -7,6 +7,8 @@ SirTrevor.Blocks.FeaturedPages = (function(){
7
7
 
8
8
  icon_name: "pages",
9
9
 
10
+ show_image_selection: false,
11
+
10
12
  autocomplete_url: function() { return document.getElementById(this.instanceID).closest('form[data-autocomplete-exhibit-pages-path]').dataset.autocompleteExhibitPagesPath; },
11
13
  autocomplete_fetch: function(url) {
12
14
  return this.fetchOnceAndFilterLocalResults(url);
@@ -1,7 +1,37 @@
1
1
  export default class {
2
2
  connect() {
3
3
  if ($.fn.carousel) {
4
- $('.carousel').carousel();
4
+ const $carousel = $('.carousel');
5
+
6
+ // updates the aria-describedby on the next and prev btns
7
+ const updateAriaDescribedBy = function ($carousel) {
8
+ const $activeItem = $carousel.find('.carousel-item.active');
9
+ const $items = $carousel.find('.carousel-item');
10
+ const curIndex = $items.index($activeItem);
11
+ const prevIndex = (curIndex - 1 + $items.length) % $items.length;
12
+ const nextIndex = (curIndex + 1) % $items.length;
13
+
14
+ const prevDataId = $items.eq(prevIndex).data('id');
15
+ const nextDataId = $items.eq(nextIndex).data('id');
16
+ if (prevDataId) {
17
+ $carousel.find('.carousel-control-prev').attr('aria-describedby', 'carousel-caption-' + prevDataId);
18
+ }
19
+ if (nextDataId) {
20
+ $carousel.find('.carousel-control-next').attr('aria-describedby', 'carousel-caption-' + nextDataId);
21
+ }
22
+ };
23
+
24
+ // on initial page load, set the aria-describedby on the btns for each carousel
25
+ $carousel.each(function () {
26
+ const $this = $(this);
27
+ $this.carousel();
28
+ updateAriaDescribedBy($this);
29
+ });
30
+
31
+ // on slide change
32
+ $carousel.on('slid.bs.carousel', function () {
33
+ updateAriaDescribedBy($(this));
34
+ });
5
35
  }
6
36
  }
7
- }
37
+ }
@@ -5,6 +5,7 @@ module Spotlight
5
5
  class AddTagsJob < Spotlight::ApplicationJob
6
6
  include Spotlight::JobTracking
7
7
  include Spotlight::GatherDocuments
8
+
8
9
  with_job_tracking(resource: ->(job) { job.arguments.last[:exhibit] })
9
10
 
10
11
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@@ -5,6 +5,7 @@ module Spotlight
5
5
  # Process a CSV upload into new Spotlight::Resource::Upload objects
6
6
  class AddUploadsFromCsv < Spotlight::ApplicationJob
7
7
  include Spotlight::JobTracking
8
+
8
9
  with_job_tracking(resource: ->(job) { job.arguments[1] })
9
10
 
10
11
  attr_reader :count, :errors
@@ -5,6 +5,7 @@ module Spotlight
5
5
  class ChangeVisibilityJob < Spotlight::ApplicationJob
6
6
  include Spotlight::JobTracking
7
7
  include Spotlight::GatherDocuments
8
+
8
9
  with_job_tracking(resource: ->(job) { job.arguments.last[:exhibit] })
9
10
 
10
11
  # rubocop:disable Metrics/MethodLength