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.
- checksums.yaml +4 -4
- data/README.md +153 -48
- data/app/assets/javascripts/spotlight/spotlight.esm.js +33 -1
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +33 -1
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_admin_users.scss +28 -0
- data/app/assets/stylesheets/spotlight/_browse.scss +1 -1
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +1 -1
- data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -0
- data/app/components/spotlight/admin_users/email_component.html.erb +5 -0
- data/app/components/spotlight/admin_users/email_component.rb +22 -0
- data/app/components/spotlight/admin_users/exhibit_roles_component.html.erb +28 -0
- data/app/components/spotlight/admin_users/exhibit_roles_component.rb +19 -0
- data/app/components/spotlight/admin_users/site_admin_component.html.erb +13 -0
- data/app/components/spotlight/admin_users/site_admin_component.rb +17 -0
- data/app/components/spotlight/analytics/aggregation_component.rb +1 -1
- data/app/components/spotlight/analytics/dashboard_component.rb +1 -1
- data/app/components/spotlight/breadcrumbs_component.rb +1 -1
- data/app/components/spotlight/bulk_action_component.rb +1 -1
- data/app/components/spotlight/edit_view_links_component.rb +1 -1
- data/app/components/spotlight/header_navigation_link_component.rb +1 -1
- data/app/components/spotlight/save_search_component.rb +1 -1
- data/app/components/spotlight/select_image_component.rb +1 -1
- data/app/components/spotlight/skip_link_component.rb +1 -1
- data/app/components/spotlight/solr_document_legacy_embed_component.rb +2 -2
- data/app/components/spotlight/tag_list_form_component.rb +1 -1
- data/app/components/spotlight/tag_selector_component.rb +1 -1
- data/app/components/spotlight/title_component.rb +1 -1
- data/app/components/spotlight/translations/subheading_component.rb +1 -1
- data/app/components/spotlight/uneditable_non_default_language_component.rb +1 -1
- data/app/controllers/spotlight/admin_users_controller.rb +11 -1
- data/app/controllers/spotlight/browse_controller.rb +2 -8
- data/app/controllers/spotlight/bulk_actions_controller.rb +1 -1
- data/app/controllers/spotlight/bulk_updates_controller.rb +22 -7
- data/app/controllers/spotlight/catalog_controller.rb +7 -15
- data/app/controllers/spotlight/dashboards_controller.rb +2 -6
- data/app/controllers/spotlight/exhibits_controller.rb +1 -0
- data/app/controllers/spotlight/home_pages_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +1 -1
- data/app/controllers/spotlight/solr_controller.rb +1 -0
- data/app/helpers/spotlight/main_app_helpers.rb +1 -5
- data/app/helpers/spotlight/rendering_helper.rb +4 -1
- data/app/javascript/spotlight/admin/blocks/pages_block.js +2 -0
- data/app/javascript/spotlight/user/carousel.js +32 -2
- data/app/jobs/spotlight/add_tags_job.rb +1 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -0
- data/app/jobs/spotlight/change_visibility_job.rb +1 -0
- data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +1 -0
- data/app/jobs/spotlight/reindex_exhibit_job.rb +1 -0
- data/app/jobs/spotlight/reindex_job.rb +1 -0
- data/app/jobs/spotlight/remove_tags_job.rb +1 -0
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +1 -0
- data/app/models/concerns/spotlight/user.rb +5 -0
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +1 -0
- data/app/models/spotlight/ability.rb +1 -1
- data/app/models/spotlight/about_page.rb +1 -0
- data/app/models/spotlight/blacklight_configuration.rb +6 -7
- data/app/models/spotlight/contact.rb +2 -1
- data/app/models/spotlight/contact_email.rb +1 -0
- data/app/models/spotlight/custom_field.rb +1 -0
- data/app/models/spotlight/exhibit.rb +2 -9
- data/app/models/spotlight/feature_page.rb +1 -0
- data/app/models/spotlight/group.rb +2 -1
- data/app/models/spotlight/home_page.rb +1 -0
- data/app/models/spotlight/job_tracker.rb +1 -1
- data/app/models/spotlight/main_navigation.rb +1 -1
- data/app/models/spotlight/page.rb +28 -19
- data/app/models/spotlight/resource.rb +1 -0
- data/app/models/spotlight/resources/iiif_manifest.rb +0 -126
- data/app/models/spotlight/resources/iiif_manifest_metadata.rb +161 -0
- data/app/models/spotlight/resources/iiif_manifest_v3.rb +41 -0
- data/app/models/spotlight/resources/iiif_service.rb +25 -1
- data/app/models/spotlight/search.rb +2 -1
- data/app/services/spotlight/exhibit_import_export_service.rb +3 -1
- data/app/views/spotlight/admin_users/index.html.erb +16 -26
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +2 -6
- data/app/views/spotlight/catalog/edit.html.erb +1 -6
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
- data/app/views/spotlight/pages/_order_pages.html.erb +1 -1
- data/app/views/spotlight/pages/show.html.erb +4 -2
- data/app/views/spotlight/resources/csv_upload/_form.html.erb +2 -0
- data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +5 -3
- data/app/views/spotlight/sir_trevor/blocks/_text_block.html.erb +1 -1
- data/config/initializers/devise_rails8_patch.rb +13 -0
- data/config/locales/spotlight.en.yml +34 -5
- data/config/routes.rb +5 -1
- data/lib/spotlight/engine.rb +10 -26
- data/lib/spotlight/version.rb +1 -1
- data/spec/fixtures/iiif_responses.rb +344 -0
- data/spec/support/features/test_features_helpers.rb +4 -6
- data/spec/support/stub_iiif_response.rb +1 -0
- data/spec/support/with_queue_adapter.rb +17 -0
- 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.
|
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.
|
78
|
+
background: linear-gradient(rgba(46, 45, 41, 0.8), 0%, rgba(46, 45, 41, 0.8) 100%);
|
79
79
|
}
|
80
80
|
}
|
81
81
|
|
@@ -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
|
@@ -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
|
-
|
15
|
+
with_embed(block_context: block_context) unless embed
|
16
16
|
|
17
17
|
super
|
18
18
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Spotlight
|
4
4
|
##
|
5
|
-
# A controller to handle the
|
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
|
-
|
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
|
-
|
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
|
|
@@ -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
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
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
|
-
#
|
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
|
-
|
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
|
-
|
48
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
56
|
+
@response = search_service.search_results do |builder|
|
61
57
|
builder.merge(solr_params)
|
62
58
|
end
|
63
59
|
@response.documents.take(count)
|
@@ -17,7 +17,7 @@ module Spotlight
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def show
|
20
|
-
@response
|
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
|
-
|
52
|
+
response = search_service.search_results do |builder|
|
53
53
|
builder.with(search_params)
|
54
54
|
end
|
55
55
|
|
@@ -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
|
-
|
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
|
-
|
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')
|
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
|