blacklight-spotlight 6.0.0.rc1 → 6.0.0.rc2
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 +21 -0
- data/app/components/spotlight/custom_field_form_group_component.rb +40 -0
- data/app/components/spotlight/edit_sidecar_component.html.erb +18 -0
- data/app/components/spotlight/edit_sidecar_component.rb +41 -0
- data/app/components/spotlight/sidecar_form_field_component.html.erb +18 -0
- data/app/components/spotlight/sidecar_form_field_component.rb +71 -0
- data/app/components/spotlight/upload_field_form_group_component.rb +33 -0
- data/app/controllers/spotlight/browse_controller.rb +0 -4
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/resources/upload_controller.rb +1 -1
- data/app/controllers/spotlight/solr_controller.rb +5 -1
- data/app/helpers/spotlight/application_helper.rb +0 -23
- data/app/helpers/spotlight/crud_link_helpers.rb +0 -12
- data/app/jobs/spotlight/add_uploads_from_csv.rb +3 -1
- data/app/jobs/spotlight/cleanup_job_trackers_job.rb +5 -3
- data/app/models/concerns/spotlight/solr_document.rb +1 -47
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +0 -4
- data/app/models/spotlight/custom_field.rb +17 -0
- data/app/models/spotlight/job_tracker.rb +0 -18
- data/app/models/spotlight/resources/iiif_manifest.rb +0 -4
- data/app/models/spotlight/resources/upload.rb +6 -0
- data/app/models/spotlight/search.rb +0 -4
- data/app/models/spotlight/solr_document_sidecar.rb +18 -0
- data/app/views/spotlight/catalog/_edit_default.html.erb +1 -1
- data/app/views/spotlight/resources/upload/_form.html.erb +2 -2
- data/config/i18n-tasks.yml +1 -1
- data/config/locales/spotlight.en.yml +0 -4
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +8 -0
- data/lib/spotlight/engine.rb +5 -2
- data/lib/spotlight/upload_field_config.rb +19 -1
- data/lib/spotlight/version.rb +1 -1
- metadata +15 -25
- data/app/components/blacklight/icons/info_component.rb +0 -15
- data/app/components/blacklight/icons/zoom_in_component.rb +0 -15
- data/app/components/blacklight/icons/zoom_out_component.rb +0 -15
- data/app/mailers/spotlight/invitation_mailer.rb +0 -21
- data/app/views/catalog/_image_default.html.erb +0 -6
- data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +0 -1
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +0 -24
- data/app/views/spotlight/custom_fields/form_group/_text.html.erb +0 -23
- data/app/views/spotlight/custom_fields/form_group/_vocab.html.erb +0 -23
- data/app/views/spotlight/invitation_mailer/exhibit_invitation_notification.html.erb +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2ccaa324ed47dd6da8761196f53797ba20acb7f6e4f608bde04232914893355
|
|
4
|
+
data.tar.gz: dba5c6c8b3321365e3f6e34fcabb02ff602076bc40db8e61d21e2030874af2c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bc205606b6d53e8550be7eb271ceb3521a26d37c611234eda479a9105d28f59be9b5738ff9543ade508726f80098f76c0d2c5858582e8bd1d590e2982e72969
|
|
7
|
+
data.tar.gz: 77e04246b8932d4b6a243090f4a56de2375437b988cbc13d96717db70f2979017cf13f004b895da9b2fc850ac1c09d2fc9ed8cd53e3ea51e3517761e96280803
|
data/README.md
CHANGED
|
@@ -75,6 +75,27 @@ Go to http://localhost:3000 in your browser.
|
|
|
75
75
|
|
|
76
76
|
Spotlight introduces functionality that depends on being able to send emails to exhibit curators and contacts. Be sure to configure your application's environments appropriately (see the Rails Guide for [Action Mailer Configuration](https://guides.rubyonrails.org/v7.2/action_mailer_basics.html#action-mailer-configuration)).
|
|
77
77
|
|
|
78
|
+
### Cleaning up job trackers
|
|
79
|
+
|
|
80
|
+
Spotlight records a `Spotlight::JobTracker` row for each background job it runs (reindexing, CSV uploads, bulk updates, and so on) so curators can see the job's progress. These rows are never removed automatically, so the `spotlight_job_trackers` table grows over time.
|
|
81
|
+
|
|
82
|
+
`Spotlight::CleanupJobTrackersJob` deletes completed job trackers that were last updated longer ago than `Spotlight::Engine.config.reindex_progress_window` (one hour by default). Failed and in-progress job trackers are kept. Spotlight does not enqueue this job itself, so schedule it to run periodically (for example, daily) with whatever scheduler your application uses.
|
|
83
|
+
|
|
84
|
+
With [Solid Queue](https://github.com/rails/solid_queue), add it to `config/recurring.yml`:
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
production:
|
|
88
|
+
cleanup_job_trackers:
|
|
89
|
+
class: Spotlight::CleanupJobTrackersJob
|
|
90
|
+
schedule: every day at 3am
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Or, with cron:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
0 3 * * * cd /path/to/app && bin/rails runner -e production 'Spotlight::CleanupJobTrackersJob.perform_later'
|
|
97
|
+
```
|
|
98
|
+
|
|
78
99
|
See the [Spotlight wiki](https://github.com/projectblacklight/spotlight/wiki) for more detailed information on configuring Spotlight.
|
|
79
100
|
|
|
80
101
|
## Translations
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spotlight
|
|
4
|
+
# Renders an exhibit custom field on the catalog edit and upload forms through its configured component
|
|
5
|
+
class CustomFieldFormGroupComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :form, :field, :value, :inline
|
|
7
|
+
|
|
8
|
+
def initialize(form:, field:, value: nil, inline: false)
|
|
9
|
+
@form = form
|
|
10
|
+
@field = field
|
|
11
|
+
@value = value
|
|
12
|
+
@inline = inline
|
|
13
|
+
super()
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
return render_deprecated_partial if deprecated_partial?
|
|
18
|
+
|
|
19
|
+
render field.component.new(form:, id: field.slug, label: field.label, value:, field_type: field.form_field_type,
|
|
20
|
+
multiple: field.is_multiple?, readonly: field.readonly_field?, inline:)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# Applications could previously customize custom field inputs by overriding these partials
|
|
26
|
+
def deprecated_partial
|
|
27
|
+
"spotlight/custom_fields/form_group/#{field.field_type}"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def deprecated_partial?
|
|
31
|
+
helpers.lookup_context.exists?(deprecated_partial, [], true)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def render_deprecated_partial
|
|
35
|
+
Spotlight.deprecator.warn "Rendering deprecated partial #{deprecated_partial}. " \
|
|
36
|
+
'Configure a component in Spotlight::Engine.config.custom_field_types instead'
|
|
37
|
+
render(partial: deprecated_partial, locals: { inline:, f: form, field:, value: })
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= form.fields_for :sidecar, sidecar do |c| %>
|
|
2
|
+
<%= c.fields_for :data do |d| %>
|
|
3
|
+
<% if document.uploaded_resource? %>
|
|
4
|
+
<%= d.fields_for :configured_fields do |e| %>
|
|
5
|
+
<% upload_fields.each do |config| %>
|
|
6
|
+
<%= render Spotlight::UploadFieldFormGroupComponent.new(form: e, config:, value: upload_field_value(config)) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
|
|
11
|
+
<% custom_fields.each do |field| %>
|
|
12
|
+
<%= render Spotlight::CustomFieldFormGroupComponent.new(form: d, field:, value: custom_field_value(field)) %>
|
|
13
|
+
<% unless field.configured_to_display? %>
|
|
14
|
+
<p class="bg-warning form-text"><%= blank_field_warning %></p>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spotlight
|
|
4
|
+
# Renders the sidecar (exhibit-specific metadata) fields on the catalog edit form
|
|
5
|
+
class EditSidecarComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :form, :document, :exhibit
|
|
7
|
+
|
|
8
|
+
def initialize(form:, document:, exhibit:)
|
|
9
|
+
@form = form
|
|
10
|
+
@document = document
|
|
11
|
+
@exhibit = exhibit
|
|
12
|
+
super()
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def upload_fields
|
|
16
|
+
Spotlight::Resources::Upload.fields(exhibit)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def sidecar
|
|
20
|
+
@sidecar ||= document.sidecar(exhibit)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Using `includes(:exhibit)` to ensure all fields are using the same exhibit object to take advantage of memoization
|
|
24
|
+
def custom_fields
|
|
25
|
+
exhibit.custom_fields.includes(:exhibit)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def upload_field_value(config)
|
|
29
|
+
(sidecar.data['configured_fields'] || {})[config.field_name.to_s]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def custom_field_value(field)
|
|
33
|
+
sidecar.data[field.slug.to_s] || sidecar.data[field.field.to_s]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def blank_field_warning
|
|
37
|
+
t('spotlight.catalog.edit_sidecar.blank_field_warning_html',
|
|
38
|
+
link: link_to(t('spotlight.configuration.sidebar.metadata'), helpers.spotlight.edit_exhibit_metadata_configuration_path(exhibit)))
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= tag.div class: wrapper_class do %>
|
|
2
|
+
<% value_list.each_with_index do |v, index| %>
|
|
3
|
+
<%= form.label field_id, label, namespace: "f#{index}", class: label_class(hidden: index.positive?) %>
|
|
4
|
+
<%= tag.div class: value_wrapper_class(first: index.zero?) do %>
|
|
5
|
+
<%= render_input(value: v, namespace: "f#{index}") %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% if multiple && !readonly %>
|
|
10
|
+
<%= content_tag :template, id: template_id do %>
|
|
11
|
+
<%= form.label field_id, label, class: label_class(hidden: true) %>
|
|
12
|
+
<%= tag.div class: value_wrapper_class(first: false) do %>
|
|
13
|
+
<%= render_input %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<%= content_tag :button, t('helpers.action.add_another'), class: 'btn btn-info btn-sm col-auto h-100', data: { action: 'add-another', template_id: template_id } %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spotlight
|
|
4
|
+
# Allow for mulivalued field entry on catalog edit and upload forms
|
|
5
|
+
class SidecarFormFieldComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :form, :field_id, :label, :value_list, :multiple, :readonly, :inline
|
|
7
|
+
|
|
8
|
+
# rubocop:disable Metrics/ParameterLists
|
|
9
|
+
def initialize(form:, id:, label:, value: nil, field_type: 'text_field', multiple: false, readonly: false, inline: false)
|
|
10
|
+
super()
|
|
11
|
+
@form = form
|
|
12
|
+
@field_id = id
|
|
13
|
+
@label = label
|
|
14
|
+
@value_list = Array(value || '')
|
|
15
|
+
@field_type = field_type.to_s
|
|
16
|
+
@multiple = multiple
|
|
17
|
+
@readonly = readonly
|
|
18
|
+
@inline = inline
|
|
19
|
+
end
|
|
20
|
+
# rubocop:enable Metrics/ParameterLists
|
|
21
|
+
|
|
22
|
+
def render_input(value: nil, namespace: nil)
|
|
23
|
+
options = { value: value, class: "form-control field-#{field_id}" }
|
|
24
|
+
|
|
25
|
+
# Add multiple to options only if multiple is true
|
|
26
|
+
options[:multiple] = true if multiple
|
|
27
|
+
# Add readonly to options only if readonly is true
|
|
28
|
+
options[:readonly] = true if readonly
|
|
29
|
+
# Add namespace to options only if namespace is present
|
|
30
|
+
options[:namespace] = namespace if namespace.present?
|
|
31
|
+
|
|
32
|
+
form.send("#{@field_type}_without_bootstrap", field_id, **options)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def template_id
|
|
36
|
+
"spotlight-field-template-#{field_id}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# add_another.js finds the field's existing values through the .form-group wrapper
|
|
40
|
+
def wrapper_class
|
|
41
|
+
inline ? 'form-group mb-3 row gy-2' : 'form-group mb-3'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def label_class(hidden: false)
|
|
45
|
+
classes = inline ? ['col-form-label', label_col] : ['form-label']
|
|
46
|
+
classes << 'visually-hidden' if hidden
|
|
47
|
+
classes.join(' ')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# In a horizontal form only the first input sits beside the label, so later inputs are offset to line up under it
|
|
51
|
+
def value_wrapper_class(first:)
|
|
52
|
+
if inline
|
|
53
|
+
first ? control_col : "#{offset_col} #{control_col}"
|
|
54
|
+
elsif multiple
|
|
55
|
+
'mb-2'
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def label_col
|
|
60
|
+
form&.label_col
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def control_col
|
|
64
|
+
form&.control_col
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def offset_col
|
|
68
|
+
label_col.sub('col', 'offset')
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spotlight
|
|
4
|
+
# Renders an upload field (Spotlight::UploadFieldConfig) on the catalog edit and upload forms through its configured component
|
|
5
|
+
class UploadFieldFormGroupComponent < ViewComponent::Base
|
|
6
|
+
attr_reader :form, :config, :value, :inline
|
|
7
|
+
|
|
8
|
+
def initialize(form:, config:, value: nil, inline: false)
|
|
9
|
+
@form = form
|
|
10
|
+
@config = config
|
|
11
|
+
@value = value
|
|
12
|
+
@inline = inline
|
|
13
|
+
super()
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
render config.component.new(
|
|
18
|
+
form:,
|
|
19
|
+
id: config.field_name,
|
|
20
|
+
label:,
|
|
21
|
+
value:,
|
|
22
|
+
field_type: config.form_field_type,
|
|
23
|
+
multiple: config.is_multiple?,
|
|
24
|
+
inline:
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def label
|
|
29
|
+
solr_field = Array(config.solr_field || config.field_name).first.to_s
|
|
30
|
+
helpers.blacklight_config.index_fields[solr_field]&.label || config.label || solr_field
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -199,7 +199,7 @@ module Spotlight
|
|
|
199
199
|
|
|
200
200
|
def uploaded_resource_params
|
|
201
201
|
if @document.uploaded_resource?
|
|
202
|
-
[{ configured_fields: Spotlight::Resources::Upload.
|
|
202
|
+
[{ configured_fields: Spotlight::Resources::Upload.as_strong_params(current_exhibit) }]
|
|
203
203
|
else
|
|
204
204
|
[]
|
|
205
205
|
end
|
|
@@ -50,7 +50,7 @@ module Spotlight
|
|
|
50
50
|
|
|
51
51
|
create_or_update_solr_document_sidecar(doc, r)
|
|
52
52
|
|
|
53
|
-
doc.to_solr.merge(@exhibit.solr_data).merge(other_field_data)
|
|
53
|
+
doc.to_solr.stringify_keys.merge(@exhibit.solr_data.stringify_keys).merge(other_field_data)
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -69,6 +69,10 @@ module Spotlight
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def create_or_update_solr_document_sidecar(doc, data)
|
|
72
|
+
# The sidecar already records the unique key as its document_id. (The payload is a raw
|
|
73
|
+
# Solr document, so here "id" is always the unique key; in other sidecar data it may be
|
|
74
|
+
# the slug of an "ID" custom field.)
|
|
75
|
+
data = data.except(doc.class.unique_key.to_s)
|
|
72
76
|
return if data.blank?
|
|
73
77
|
|
|
74
78
|
sidecar = doc.sidecar(@exhibit)
|
|
@@ -136,13 +136,6 @@ module Spotlight
|
|
|
136
136
|
selected_view || default_document_index_view_type
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
-
# Return the list of views that are configured to display for a block
|
|
140
|
-
def selected_search_block_views(block)
|
|
141
|
-
block.as_json[:data].select do |_key, value|
|
|
142
|
-
value == 'on'
|
|
143
|
-
end.keys.map(&:to_s)
|
|
144
|
-
end
|
|
145
|
-
|
|
146
139
|
# Create checkbox for selecting/deselecting metadata fields for a given view in metadata configuration
|
|
147
140
|
def select_deselect_action(id)
|
|
148
141
|
check_box_tag(
|
|
@@ -154,26 +147,10 @@ module Spotlight
|
|
|
154
147
|
)
|
|
155
148
|
end
|
|
156
149
|
|
|
157
|
-
def uploaded_field_label(config)
|
|
158
|
-
solr_field = Array(config.solr_field || config.field_name).first.to_s
|
|
159
|
-
blacklight_config.index_fields[solr_field]&.label || config.label || t(".#{solr_field}")
|
|
160
|
-
end
|
|
161
|
-
|
|
162
150
|
def available_view_fields
|
|
163
151
|
current_exhibit.blacklight_configuration.default_blacklight_config.view.to_h.reject { |_k, v| v.if == false }
|
|
164
152
|
end
|
|
165
153
|
|
|
166
|
-
def render_search_bar
|
|
167
|
-
return super if defined?(super)
|
|
168
|
-
|
|
169
|
-
render((blacklight_config&.view_config(document_index_view_type)&.search_bar_component || Blacklight::SearchBarComponent).new(
|
|
170
|
-
url: search_action_url,
|
|
171
|
-
advanced_search_url: search_action_url(action: 'advanced_search'),
|
|
172
|
-
params: search_state.params_for_search.except(:qt),
|
|
173
|
-
autocomplete_path: suggest_index_catalog_path
|
|
174
|
-
))
|
|
175
|
-
end
|
|
176
|
-
|
|
177
154
|
def render_constraints(localized_params = nil, local_search_state = nil)
|
|
178
155
|
return super if defined?(super)
|
|
179
156
|
|
|
@@ -20,24 +20,12 @@ module Spotlight
|
|
|
20
20
|
link_to action_default_value(model, :view), link, link_to_options
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def create_link(model, *args)
|
|
24
|
-
link_to_options = args.extract_options!
|
|
25
|
-
link = args.first || polymorphic_path([spotlight, model], action: :new)
|
|
26
|
-
link_to action_default_value(model), link, link_to_options
|
|
27
|
-
end
|
|
28
|
-
|
|
29
23
|
def exhibit_create_link(model, *args)
|
|
30
24
|
link_to_options = args.extract_options!
|
|
31
25
|
link = args.first || polymorphic_path([spotlight, current_exhibit, model], action: :new)
|
|
32
26
|
link_to action_default_value(model), link, link_to_options
|
|
33
27
|
end
|
|
34
28
|
|
|
35
|
-
def edit_link(model, *args)
|
|
36
|
-
link_to_options = args.extract_options!
|
|
37
|
-
link = args.first || polymorphic_path([spotlight, model], action: :edit)
|
|
38
|
-
link_to action_default_value(model), link, link_to_options
|
|
39
|
-
end
|
|
40
|
-
|
|
41
29
|
def exhibit_edit_link(model, *args)
|
|
42
30
|
link_to_options = args.extract_options!
|
|
43
31
|
link = args.first || polymorphic_path([spotlight, model.exhibit, model], action: :edit)
|
|
@@ -79,7 +79,9 @@ module Spotlight
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def multivalued_fields(exhibit)
|
|
82
|
-
exhibit.
|
|
82
|
+
upload_fields = Spotlight::Resources::Upload.fields(exhibit).filter_map { |field| field.field_name.to_s if field.is_multiple? }
|
|
83
|
+
custom_fields = exhibit.custom_fields.filter_map { |field| field.slug.to_s if field.is_multiple? }
|
|
84
|
+
upload_fields + custom_fields
|
|
83
85
|
end
|
|
84
86
|
end
|
|
85
87
|
end
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Spotlight
|
|
4
4
|
###
|
|
5
|
-
#
|
|
6
|
-
#
|
|
5
|
+
# Deletes completed job trackers that were last updated before
|
|
6
|
+
# Spotlight::Engine.config.reindex_progress_window. Spotlight does not
|
|
7
|
+
# enqueue this job itself; applications should schedule it to run
|
|
8
|
+
# periodically (see the README).
|
|
7
9
|
###
|
|
8
10
|
class CleanupJobTrackersJob < Spotlight::ApplicationJob
|
|
9
11
|
def perform
|
|
10
|
-
Spotlight::JobTracker.where(status: 'completed', updated_at: Time.zone.at(0)...Spotlight::Engine.config.reindex_progress_window.
|
|
12
|
+
Spotlight::JobTracker.where(status: 'completed', updated_at: Time.zone.at(0)...Spotlight::Engine.config.reindex_progress_window.ago).delete_all
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -54,7 +54,7 @@ module Spotlight
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def update(current_exhibit, new_attributes)
|
|
57
|
-
attributes =
|
|
57
|
+
attributes = new_attributes.stringify_keys
|
|
58
58
|
|
|
59
59
|
custom_data = attributes.delete('sidecar')
|
|
60
60
|
tags = attributes.delete('exhibit_tag_list')
|
|
@@ -117,10 +117,6 @@ module Spotlight
|
|
|
117
117
|
self[self.class.resource_type_field].include?('spotlight/resources/uploads')
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
-
def attribute_present?(*_args)
|
|
121
|
-
false
|
|
122
|
-
end
|
|
123
|
-
|
|
124
120
|
protected
|
|
125
121
|
|
|
126
122
|
def tags_to_solr
|
|
@@ -145,48 +141,6 @@ module Spotlight
|
|
|
145
141
|
self.class.exhibit_slug_field => slugs
|
|
146
142
|
}
|
|
147
143
|
end
|
|
148
|
-
|
|
149
|
-
def convert_incoming_attributes(attributes)
|
|
150
|
-
attributes = attributes.stringify_keys
|
|
151
|
-
|
|
152
|
-
# convert blank strings to nil
|
|
153
|
-
attributes = deep_transform_values(attributes, &:presence)
|
|
154
|
-
|
|
155
|
-
# trim excess nils from arrays
|
|
156
|
-
deep_compact(attributes)
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def deep_transform_values(object, &)
|
|
160
|
-
# Available in Rails 6
|
|
161
|
-
if object.respond_to?(:deep_transform_values)
|
|
162
|
-
object.deep_transform_values(&)
|
|
163
|
-
else
|
|
164
|
-
_deep_transform_values(object, &)
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
# Shimmed from Rails 6
|
|
169
|
-
def _deep_transform_values(object, &block)
|
|
170
|
-
case object
|
|
171
|
-
when Hash
|
|
172
|
-
object.transform_values { |value| deep_transform_values(value, &block) }
|
|
173
|
-
when Array
|
|
174
|
-
object.map { |e| deep_transform_values(e, &block) }
|
|
175
|
-
else
|
|
176
|
-
yield(object)
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def deep_compact(object)
|
|
181
|
-
case object
|
|
182
|
-
when Hash
|
|
183
|
-
object.transform_values { |value| deep_compact(value) }
|
|
184
|
-
when Array
|
|
185
|
-
object.compact
|
|
186
|
-
else
|
|
187
|
-
object
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
144
|
end
|
|
191
145
|
end
|
|
192
146
|
|
|
@@ -13,10 +13,6 @@ module SirTrevorRails
|
|
|
13
13
|
@solr_helper = solr_helper
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def search_options(id)
|
|
17
|
-
items.detect { |x| x[:id] == id } || {}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
16
|
def searches
|
|
21
17
|
@searches ||= parent.exhibit.searches.published.where(slug: item_ids).sort do |a, b|
|
|
22
18
|
ordered_items.index(a.slug) <=> ordered_items.index(b.slug)
|
|
@@ -59,6 +59,19 @@ module Spotlight
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
# The component used to render the field on the upload and edit forms,
|
|
63
|
+
# from the `component` option of the field's entry in Spotlight::Engine.config.custom_field_types
|
|
64
|
+
def component
|
|
65
|
+
component = field_type_config[:component]
|
|
66
|
+
return Spotlight::SidecarFormFieldComponent if component.blank?
|
|
67
|
+
|
|
68
|
+
component.is_a?(String) ? component.constantize : component
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def form_field_type
|
|
72
|
+
field_type_config.fetch(:form_field_type, :text_field)
|
|
73
|
+
end
|
|
74
|
+
|
|
62
75
|
def solr_field
|
|
63
76
|
if field&.starts_with?(solr_field_prefix)
|
|
64
77
|
# backwards compatibility with pre-0.9 custom fields
|
|
@@ -70,6 +83,10 @@ module Spotlight
|
|
|
70
83
|
|
|
71
84
|
protected
|
|
72
85
|
|
|
86
|
+
def field_type_config
|
|
87
|
+
Spotlight::Engine.config.custom_field_types.fetch(field_type.to_s.to_sym, {})
|
|
88
|
+
end
|
|
89
|
+
|
|
73
90
|
def blacklight_configuration
|
|
74
91
|
exhibit&.blacklight_configuration
|
|
75
92
|
end
|
|
@@ -43,12 +43,6 @@ module Spotlight
|
|
|
43
43
|
@job_status ||= ActiveJob::Status.get(job_id)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
def progress_label
|
|
47
|
-
return number_with_delimiter(progress) unless total?
|
|
48
|
-
|
|
49
|
-
"#{number_with_delimiter(progress)} / #{number_with_delimiter(total)}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
46
|
def progress
|
|
53
47
|
data[:progress] || job_status[:progress] || 0
|
|
54
48
|
end
|
|
@@ -61,12 +55,6 @@ module Spotlight
|
|
|
61
55
|
total(default: 0).positive?
|
|
62
56
|
end
|
|
63
57
|
|
|
64
|
-
def percent
|
|
65
|
-
return nil unless total?
|
|
66
|
-
|
|
67
|
-
(100.0 * progress) / total
|
|
68
|
-
end
|
|
69
|
-
|
|
70
58
|
def status
|
|
71
59
|
@status ||= super
|
|
72
60
|
@status ||= 'missing'
|
|
@@ -104,11 +92,5 @@ module Spotlight
|
|
|
104
92
|
self
|
|
105
93
|
end
|
|
106
94
|
end
|
|
107
|
-
|
|
108
|
-
private
|
|
109
|
-
|
|
110
|
-
def number_with_delimiter(*)
|
|
111
|
-
ActiveSupport::NumberHelper.number_to_delimited(*)
|
|
112
|
-
end
|
|
113
95
|
end
|
|
114
96
|
end
|
|
@@ -23,6 +23,12 @@ module Spotlight
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
def self.as_strong_params(exhibit)
|
|
27
|
+
fields(exhibit).map do |field|
|
|
28
|
+
field.is_multiple? ? { field.field_name => [] } : field.field_name
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
26
32
|
def self.indexing_pipeline
|
|
27
33
|
@indexing_pipeline ||= super.dup.tap do |pipeline|
|
|
28
34
|
pipeline.transforms = [
|
|
@@ -22,6 +22,8 @@ module Spotlight
|
|
|
22
22
|
|
|
23
23
|
delegate :has_key?, :key?, to: :data
|
|
24
24
|
|
|
25
|
+
before_save :strip_blank_values_from_data
|
|
26
|
+
|
|
25
27
|
def to_solr
|
|
26
28
|
{ document.class.unique_key.to_sym => document.id,
|
|
27
29
|
visibility_field => public? }
|
|
@@ -48,6 +50,22 @@ module Spotlight
|
|
|
48
50
|
|
|
49
51
|
private
|
|
50
52
|
|
|
53
|
+
# Remove blank entries (e.g. from an empty "Add another value" input) from multivalued fields
|
|
54
|
+
def strip_blank_values_from_data
|
|
55
|
+
self.data = strip_blank_values(data)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def strip_blank_values(value)
|
|
59
|
+
case value
|
|
60
|
+
when Array
|
|
61
|
+
value.compact_blank
|
|
62
|
+
when Hash
|
|
63
|
+
value.transform_values { |v| strip_blank_values(v) }
|
|
64
|
+
else
|
|
65
|
+
value
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
51
69
|
def document_type_class
|
|
52
70
|
return default_document_type unless document_type.is_a?(String)
|
|
53
71
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<%= r.url_field :url, type: "file", help: t('.url-field.help', extensions: Spotlight::Engine.config.allowed_upload_extensions.join(' ')), label: "File" %>
|
|
10
10
|
<% end if document.uploaded_resource? %>
|
|
11
11
|
|
|
12
|
-
<%= render
|
|
12
|
+
<%= render Spotlight::EditSidecarComponent.new(form: f, document: document, exhibit: current_exhibit) %>
|
|
13
13
|
|
|
14
14
|
<% if can? :tag, current_exhibit %>
|
|
15
15
|
<div class="edit-tags">
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<%= f.url_field :url, type: "file", help: t('.url-field.help', extensions: Spotlight::Engine.config.allowed_upload_extensions.join(' ')), label: "File" %>
|
|
3
3
|
<%= f.fields_for :data do |d| %>
|
|
4
4
|
<% Spotlight::Resources::Upload.fields(current_exhibit).each do |config| %>
|
|
5
|
-
<%=
|
|
5
|
+
<%= render Spotlight::UploadFieldFormGroupComponent.new(form: d, config:, inline: true) %>
|
|
6
6
|
<% end %>
|
|
7
7
|
|
|
8
8
|
<% current_exhibit.custom_fields.each do |custom_field| %>
|
|
9
|
-
<%= render
|
|
9
|
+
<%= render Spotlight::CustomFieldFormGroupComponent.new(form: d, field: custom_field, inline: true) %>
|
|
10
10
|
<% end %>
|
|
11
11
|
<% end %>
|
|
12
12
|
<div class="form-actions">
|
data/config/i18n-tasks.yml
CHANGED
|
@@ -78,7 +78,7 @@ ignore_unused:
|
|
|
78
78
|
# TODO Look into these as its unclear
|
|
79
79
|
- activerecord.models.spotlight.page
|
|
80
80
|
#- # perhaps removed here? https://github.com/projectblacklight/spotlight/commit/d4fdf04565ab3d648f0cb2a1238d84f262509fcd
|
|
81
|
-
- devise.mailer.*.*
|
|
81
|
+
- devise.mailer.*.*
|
|
82
82
|
- helpers.submit.solr_document.{batch_error,batch_updated,create,created,destroyed,submit,update,updated} # Do we need this?
|
|
83
83
|
- helpers.submit.user.{batch_error,batch_updated,create,created,destroyed,submit,update,updated} # Do we need this?
|
|
84
84
|
- helpers.action.destroy # no idea here
|
|
@@ -665,12 +665,10 @@ en:
|
|
|
665
665
|
all: All
|
|
666
666
|
exhibits_admin_invitation_mailer:
|
|
667
667
|
invitation_instructions:
|
|
668
|
-
accept: Accept invitation
|
|
669
668
|
accept_invitation: You can accept this invitation by selecting the link below.
|
|
670
669
|
hello: Hello!
|
|
671
670
|
ignore: If you don't want to accept the invitation, please ignore this email. Your exhibits administrator account won't be created until you access the link above.
|
|
672
671
|
someone_invited_you: The Exhibits Administrator has invited you to help manage exhibits.
|
|
673
|
-
subject: Invitation to manage \"%{exhibit_name}\"
|
|
674
672
|
feature_pages:
|
|
675
673
|
page_options:
|
|
676
674
|
published: Publish
|
|
@@ -724,8 +722,6 @@ en:
|
|
|
724
722
|
hello: Hello!
|
|
725
723
|
ignore: If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above.
|
|
726
724
|
someone_invited_you: The Exhibits Administrator has invited you to help work on the "%{exhibit_name}" exhibit.
|
|
727
|
-
subject: Invitation to manage \"%{exhibit_name}\"
|
|
728
|
-
visit: Visit exhibit
|
|
729
725
|
job_trackers:
|
|
730
726
|
show:
|
|
731
727
|
headers:
|
|
@@ -37,10 +37,18 @@
|
|
|
37
37
|
# Spotlight::Engine.config.solr_fields.string_suffix = '_ssim'.freeze
|
|
38
38
|
# Spotlight::Engine.config.solr_fields.text_suffix = '_tesim'.freeze
|
|
39
39
|
# Spotlight::Engine.config.resource_global_id_field = :"#{config.solr_fields.prefix}spotlight_resource_id#{config.solr_fields.string_suffix}"
|
|
40
|
+
# Exhibit custom field types; `form_field_type` and `component` control how the field renders on the upload and edit forms
|
|
41
|
+
# Spotlight::Engine.config.custom_field_types = {
|
|
42
|
+
# vocab: { suffix: '_ssim', facetable: true },
|
|
43
|
+
# text: { suffix: '_tesim', form_field_type: :text_area, component: 'Spotlight::SidecarFormFieldComponent' }
|
|
44
|
+
# }
|
|
40
45
|
# Spotlight::Engine.config.full_image_field = :full_image_url_ssm
|
|
41
46
|
# Spotlight::Engine.config.thumbnail_field = :thumbnail_url_ssm
|
|
42
47
|
|
|
43
48
|
# ==> Uploaded item configuration
|
|
49
|
+
# Add `is_multiple: true` to Spotlight::UploadFieldConfig arguments to allow for multivalued field data
|
|
50
|
+
# Add `component: MyFieldComponent` to render the field with a custom component (default: Spotlight::SidecarFormFieldComponent)
|
|
51
|
+
# If is_multiple is enabled, Spotlight will send the field to Solr as an array, so ensure that your Solr configurations support this
|
|
44
52
|
# Spotlight::Engine.config.upload_fields = [
|
|
45
53
|
# Spotlight::UploadFieldConfig.new(
|
|
46
54
|
# field_name: Spotlight::Engine.config.upload_description_field,
|
data/lib/spotlight/engine.rb
CHANGED
|
@@ -117,10 +117,13 @@ module Spotlight
|
|
|
117
117
|
config.solr_fields.string_suffix = '_ssim'
|
|
118
118
|
config.solr_fields.text_suffix = '_tesim'
|
|
119
119
|
|
|
120
|
-
# Suffixes for exhibit-specific solr fields
|
|
120
|
+
# Suffixes for exhibit-specific solr fields. Each type may also set:
|
|
121
|
+
# form_field_type: the form builder method used for the input (default: :text_field)
|
|
122
|
+
# component: the component used to render the field on the upload and edit forms
|
|
123
|
+
# (default: Spotlight::SidecarFormFieldComponent)
|
|
121
124
|
config.custom_field_types = {
|
|
122
125
|
vocab: { suffix: '_ssim', facetable: true },
|
|
123
|
-
text: { suffix: '_tesim' }
|
|
126
|
+
text: { suffix: '_tesim', form_field_type: :text_area }
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
config.resource_global_id_field = :"#{config.solr_fields.prefix}spotlight_resource_id#{config.solr_fields.string_suffix}"
|
|
@@ -9,13 +9,18 @@ module Spotlight
|
|
|
9
9
|
class UploadFieldConfig
|
|
10
10
|
attr_reader :blacklight_options, :field_name, :form_field_type
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
# rubocop:disable Metrics/ParameterLists
|
|
13
|
+
def initialize(field_name:, blacklight_options: {}, form_field_type: :text_field, solr_fields: nil, label: nil, is_multiple: false,
|
|
14
|
+
component: nil)
|
|
13
15
|
@blacklight_options = blacklight_options
|
|
14
16
|
@field_name = field_name
|
|
15
17
|
@form_field_type = form_field_type
|
|
16
18
|
@solr_fields = solr_fields
|
|
17
19
|
@label = label || field_name
|
|
20
|
+
@is_multiple = is_multiple
|
|
21
|
+
@component = component
|
|
18
22
|
end
|
|
23
|
+
# rubocop:enable Metrics/ParameterLists
|
|
19
24
|
|
|
20
25
|
# Allows a proc to be set as the label
|
|
21
26
|
def label
|
|
@@ -24,6 +29,19 @@ module Spotlight
|
|
|
24
29
|
@label
|
|
25
30
|
end
|
|
26
31
|
|
|
32
|
+
# rubocop:disable Naming/PredicatePrefix
|
|
33
|
+
def is_multiple?
|
|
34
|
+
@is_multiple
|
|
35
|
+
end
|
|
36
|
+
# rubocop:enable Naming/PredicatePrefix
|
|
37
|
+
|
|
38
|
+
# The component used to render the field on the upload and edit forms
|
|
39
|
+
def component
|
|
40
|
+
return Spotlight::SidecarFormFieldComponent if @component.blank?
|
|
41
|
+
|
|
42
|
+
@component.is_a?(String) ? @component.constantize : @component
|
|
43
|
+
end
|
|
44
|
+
|
|
27
45
|
# aliasing for backwards compatability and consistency with blacklight config
|
|
28
46
|
alias solr_field field_name
|
|
29
47
|
|
data/lib/spotlight/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blacklight-spotlight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
requirements:
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: 8.
|
|
55
|
+
version: 8.12.0
|
|
56
56
|
- - "<"
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
58
|
version: '10'
|
|
@@ -62,7 +62,7 @@ dependencies:
|
|
|
62
62
|
requirements:
|
|
63
63
|
- - ">="
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: 8.
|
|
65
|
+
version: 8.12.0
|
|
66
66
|
- - "<"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '10'
|
|
@@ -72,7 +72,7 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '5.1'
|
|
76
76
|
- - "<"
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
78
|
version: '7'
|
|
@@ -82,7 +82,7 @@ dependencies:
|
|
|
82
82
|
requirements:
|
|
83
83
|
- - ">="
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: '
|
|
85
|
+
version: '5.1'
|
|
86
86
|
- - "<"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '7'
|
|
@@ -432,22 +432,16 @@ dependencies:
|
|
|
432
432
|
name: view_component
|
|
433
433
|
requirement: !ruby/object:Gem::Requirement
|
|
434
434
|
requirements:
|
|
435
|
-
- - "
|
|
436
|
-
- !ruby/object:Gem::Version
|
|
437
|
-
version: '2.66'
|
|
438
|
-
- - "<"
|
|
435
|
+
- - "~>"
|
|
439
436
|
- !ruby/object:Gem::Version
|
|
440
|
-
version: '
|
|
437
|
+
version: '4.0'
|
|
441
438
|
type: :runtime
|
|
442
439
|
prerelease: false
|
|
443
440
|
version_requirements: !ruby/object:Gem::Requirement
|
|
444
441
|
requirements:
|
|
445
|
-
- - "
|
|
446
|
-
- !ruby/object:Gem::Version
|
|
447
|
-
version: '2.66'
|
|
448
|
-
- - "<"
|
|
442
|
+
- - "~>"
|
|
449
443
|
- !ruby/object:Gem::Version
|
|
450
|
-
version: '
|
|
444
|
+
version: '4.0'
|
|
451
445
|
- !ruby/object:Gem::Dependency
|
|
452
446
|
name: axe-core-rspec
|
|
453
447
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -793,12 +787,9 @@ files:
|
|
|
793
787
|
- app/components/blacklight/icons/edit_component.rb
|
|
794
788
|
- app/components/blacklight/icons/error_component.rb
|
|
795
789
|
- app/components/blacklight/icons/highlight_off_component.rb
|
|
796
|
-
- app/components/blacklight/icons/info_component.rb
|
|
797
790
|
- app/components/blacklight/icons/pause_component.rb
|
|
798
791
|
- app/components/blacklight/icons/play_arrow_component.rb
|
|
799
792
|
- app/components/blacklight/icons/warning_component.rb
|
|
800
|
-
- app/components/blacklight/icons/zoom_in_component.rb
|
|
801
|
-
- app/components/blacklight/icons/zoom_out_component.rb
|
|
802
793
|
- app/components/spotlight/admin_users/email_component.html.erb
|
|
803
794
|
- app/components/spotlight/admin_users/email_component.rb
|
|
804
795
|
- app/components/spotlight/admin_users/exhibit_roles_component.html.erb
|
|
@@ -813,9 +804,12 @@ files:
|
|
|
813
804
|
- app/components/spotlight/breadcrumbs_component.rb
|
|
814
805
|
- app/components/spotlight/bulk_action_component.html.erb
|
|
815
806
|
- app/components/spotlight/bulk_action_component.rb
|
|
807
|
+
- app/components/spotlight/custom_field_form_group_component.rb
|
|
816
808
|
- app/components/spotlight/document_admin_table_component.html.erb
|
|
817
809
|
- app/components/spotlight/document_admin_table_component.rb
|
|
818
810
|
- app/components/spotlight/document_component.rb
|
|
811
|
+
- app/components/spotlight/edit_sidecar_component.html.erb
|
|
812
|
+
- app/components/spotlight/edit_sidecar_component.rb
|
|
819
813
|
- app/components/spotlight/edit_view_links_component.html.erb
|
|
820
814
|
- app/components/spotlight/edit_view_links_component.rb
|
|
821
815
|
- app/components/spotlight/exhibit_navbar_component.html.erb
|
|
@@ -830,6 +824,8 @@ files:
|
|
|
830
824
|
- app/components/spotlight/save_search_component.rb
|
|
831
825
|
- app/components/spotlight/select_image_component.html.erb
|
|
832
826
|
- app/components/spotlight/select_image_component.rb
|
|
827
|
+
- app/components/spotlight/sidecar_form_field_component.html.erb
|
|
828
|
+
- app/components/spotlight/sidecar_form_field_component.rb
|
|
833
829
|
- app/components/spotlight/skip_link_component.rb
|
|
834
830
|
- app/components/spotlight/solr_document_legacy_embed_component.html.erb
|
|
835
831
|
- app/components/spotlight/solr_document_legacy_embed_component.rb
|
|
@@ -844,6 +840,7 @@ files:
|
|
|
844
840
|
- app/components/spotlight/translations/subheading_component.rb
|
|
845
841
|
- app/components/spotlight/uneditable_non_default_language_component.html.erb
|
|
846
842
|
- app/components/spotlight/uneditable_non_default_language_component.rb
|
|
843
|
+
- app/components/spotlight/upload_field_form_group_component.rb
|
|
847
844
|
- app/controllers/concerns/spotlight/base.rb
|
|
848
845
|
- app/controllers/concerns/spotlight/catalog.rb
|
|
849
846
|
- app/controllers/concerns/spotlight/config.rb
|
|
@@ -986,7 +983,6 @@ files:
|
|
|
986
983
|
- app/mailers/spotlight/confirmation_mailer.rb
|
|
987
984
|
- app/mailers/spotlight/contact_mailer.rb
|
|
988
985
|
- app/mailers/spotlight/indexing_complete_mailer.rb
|
|
989
|
-
- app/mailers/spotlight/invitation_mailer.rb
|
|
990
986
|
- app/models/ability.rb
|
|
991
987
|
- app/models/breadcrumb.rb
|
|
992
988
|
- app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb
|
|
@@ -1093,7 +1089,6 @@ files:
|
|
|
1093
1089
|
- app/views/catalog/_bulk_actions.html.erb
|
|
1094
1090
|
- app/views/catalog/_change_visibility.html.erb
|
|
1095
1091
|
- app/views/catalog/_curator_actions.html.erb
|
|
1096
|
-
- app/views/catalog/_image_default.html.erb
|
|
1097
1092
|
- app/views/catalog/_remove_tags.html.erb
|
|
1098
1093
|
- app/views/catalog/_save_search.html.erb
|
|
1099
1094
|
- app/views/devise/confirmations/new.html.erb
|
|
@@ -1133,12 +1128,10 @@ files:
|
|
|
1133
1128
|
- app/views/spotlight/bulk_updates/_upload.html.erb
|
|
1134
1129
|
- app/views/spotlight/bulk_updates/edit.html.erb
|
|
1135
1130
|
- app/views/spotlight/catalog/_admin_header.html.erb
|
|
1136
|
-
- app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb
|
|
1137
1131
|
- app/views/spotlight/catalog/_document.html.erb
|
|
1138
1132
|
- app/views/spotlight/catalog/_document_admin_table.html.erb
|
|
1139
1133
|
- app/views/spotlight/catalog/_document_visibility_control.html.erb
|
|
1140
1134
|
- app/views/spotlight/catalog/_edit_default.html.erb
|
|
1141
|
-
- app/views/spotlight/catalog/_edit_sidecar.html.erb
|
|
1142
1135
|
- app/views/spotlight/catalog/_reindex_progress_panel.html.erb
|
|
1143
1136
|
- app/views/spotlight/catalog/admin.html.erb
|
|
1144
1137
|
- app/views/spotlight/catalog/edit.html.erb
|
|
@@ -1152,8 +1145,6 @@ files:
|
|
|
1152
1145
|
- app/views/spotlight/contacts/new.html.erb
|
|
1153
1146
|
- app/views/spotlight/custom_fields/_form.html.erb
|
|
1154
1147
|
- app/views/spotlight/custom_fields/edit.html.erb
|
|
1155
|
-
- app/views/spotlight/custom_fields/form_group/_text.html.erb
|
|
1156
|
-
- app/views/spotlight/custom_fields/form_group/_vocab.html.erb
|
|
1157
1148
|
- app/views/spotlight/custom_fields/new.html.erb
|
|
1158
1149
|
- app/views/spotlight/custom_search_fields/_form.html.erb
|
|
1159
1150
|
- app/views/spotlight/custom_search_fields/edit.html.erb
|
|
@@ -1192,7 +1183,6 @@ files:
|
|
|
1192
1183
|
- app/views/spotlight/home_pages/_page_options.html.erb
|
|
1193
1184
|
- app/views/spotlight/home_pages/_sidebar.html.erb
|
|
1194
1185
|
- app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb
|
|
1195
|
-
- app/views/spotlight/invitation_mailer/exhibit_invitation_notification.html.erb
|
|
1196
1186
|
- app/views/spotlight/job_trackers/show.html.erb
|
|
1197
1187
|
- app/views/spotlight/locks/_lock.html.erb
|
|
1198
1188
|
- app/views/spotlight/metadata_configurations/_metadata_field.html.erb
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Blacklight
|
|
4
|
-
module Icons
|
|
5
|
-
# Icon for Info
|
|
6
|
-
class InfoComponent < Blacklight::Icons::IconComponent
|
|
7
|
-
self.svg = <<~SVG
|
|
8
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
|
9
|
-
<path fill="none" d="M0 0h24v24H0V0z"/>
|
|
10
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
|
|
11
|
-
</svg>
|
|
12
|
-
SVG
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Blacklight
|
|
4
|
-
module Icons
|
|
5
|
-
# Icon for ZoomIn
|
|
6
|
-
class ZoomInComponent < Blacklight::Icons::IconComponent
|
|
7
|
-
self.svg = <<~SVG
|
|
8
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
9
|
-
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
10
|
-
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm.5-7H9v2H7v1h2v2h1v-2h2V9h-2z"/>
|
|
11
|
-
</svg>
|
|
12
|
-
SVG
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Blacklight
|
|
4
|
-
module Icons
|
|
5
|
-
# Icon for ZoomOut
|
|
6
|
-
class ZoomOutComponent < Blacklight::Icons::IconComponent
|
|
7
|
-
self.svg = <<~SVG
|
|
8
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
9
|
-
<path d="M0 0h24v24H0V0z" fill="none"/>
|
|
10
|
-
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7V9z"/>
|
|
11
|
-
</svg>
|
|
12
|
-
SVG
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Spotlight
|
|
4
|
-
# Mailer for contacting new exhibit curators or administrators
|
|
5
|
-
class InvitationMailer < ActionMailer::Base
|
|
6
|
-
include Devise::Mailers::Helpers
|
|
7
|
-
|
|
8
|
-
def exhibit_invitation_notification(role)
|
|
9
|
-
initialize_from_record(role.user)
|
|
10
|
-
@role = role
|
|
11
|
-
@key = if @role.resource.is_a?(Spotlight::Site)
|
|
12
|
-
'exhibits_admin_invitation_mailer'
|
|
13
|
-
else
|
|
14
|
-
'invitation_mailer'
|
|
15
|
-
end
|
|
16
|
-
mail(to: role.user.email,
|
|
17
|
-
from: mailer_sender(devise_mapping),
|
|
18
|
-
subject: I18n.t("spotlight.#{@key}.invitation_instructions.subject", exhibit_name: @role.resource.title))
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<%# looks suspiciously similar to blacklight's _thumbnail, but skips all the search context + linking -%>
|
|
2
|
-
<%- if has_thumbnail?(document) && tn = render_thumbnail_tag(document, { alt: '' }, :suppress_link => true) %>
|
|
3
|
-
<div class="img-thumbnail">
|
|
4
|
-
<%= tn %>
|
|
5
|
-
</div>
|
|
6
|
-
<%- end %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= exhibit_edit_link document, [:edit, current_exhibit, document], class: 'float-end btn btn-primary' if can?(:curate, current_exhibit) and !current_page? [:edit, current_exhibit, document] %>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<%= f.fields_for :sidecar, document.sidecar(current_exhibit) do |c| %>
|
|
2
|
-
<%= c.fields_for :data do |d| %>
|
|
3
|
-
<% if document.uploaded_resource? %>
|
|
4
|
-
<%= d.fields_for :configured_fields do |e| %>
|
|
5
|
-
<% Spotlight::Resources::Upload.fields(current_exhibit).each do |config| %>
|
|
6
|
-
<%= e.send(config.form_field_type, config.field_name, value: (document.sidecar(current_exhibit).data["configured_fields"] || {})[config.field_name.to_s], label: uploaded_field_label(config)) %>
|
|
7
|
-
<% end %>
|
|
8
|
-
<% end %>
|
|
9
|
-
<% end %>
|
|
10
|
-
|
|
11
|
-
<%# Using `includes(:exhibit)` to ensure all fields are using the same exhibit object to take advantage of memoization %>
|
|
12
|
-
<% current_exhibit.custom_fields.includes(:exhibit).each do |field| %>
|
|
13
|
-
<% data = document.sidecar(current_exhibit).data %>
|
|
14
|
-
<%= render partial: "spotlight/custom_fields/form_group/#{field.field_type}", locals: { f: d, field: field, value: data[field.slug.to_s] || data[field.field.to_s] } %>
|
|
15
|
-
|
|
16
|
-
<% unless field.configured_to_display? %>
|
|
17
|
-
<p class="bg-warning form-text">
|
|
18
|
-
<%= t(:'.blank_field_warning_html',
|
|
19
|
-
link: link_to(t(:'spotlight.configuration.sidebar.metadata'), spotlight.edit_exhibit_metadata_configuration_path(current_exhibit))) %>
|
|
20
|
-
</p>
|
|
21
|
-
<% end %>
|
|
22
|
-
<% end %>
|
|
23
|
-
<% end %>
|
|
24
|
-
<% end %>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<% inline = local_assigns[:inline].presence %>
|
|
2
|
-
<% label_col = f&.label_col %>
|
|
3
|
-
<% control_col = f&.control_col %>
|
|
4
|
-
<% offset_col = label_col.sub('col', 'offset') %>
|
|
5
|
-
|
|
6
|
-
<div class="form-group mb-3 <%= "row" if inline %>">
|
|
7
|
-
<% Array(value || '').each_with_index do |v, index| %>
|
|
8
|
-
<%= f.label field.slug, field.label, namespace: "f#{index}", class: "col-form-label #{label_col if inline} #{'visually-hidden' if index > 0}" %>
|
|
9
|
-
<div class="mb-3 <%= control_col if inline %>">
|
|
10
|
-
<%= f.text_area_without_bootstrap field.slug, namespace: "f#{index}",multiple: field.is_multiple?, value: v, class: "form-control field-#{field.slug}", readonly: field.readonly_field? %>
|
|
11
|
-
</div>
|
|
12
|
-
<% end %>
|
|
13
|
-
|
|
14
|
-
<% if field.is_multiple? && !field.readonly_field? %>
|
|
15
|
-
<%= content_tag :template, id: "spotlight-field-template-#{field.slug}" do %>
|
|
16
|
-
<%= f.label field.slug, field.label, class: "col-form-label #{label_col if inline} visually-hidden" %>
|
|
17
|
-
<div class="mb-3 <%= "#{offset_col} #{control_col}" if inline %>">
|
|
18
|
-
<%= f.text_area_without_bootstrap field.slug, multiple: field.is_multiple?, value: nil, class: "form-control field-#{field.slug}" %>
|
|
19
|
-
</div>
|
|
20
|
-
<% end %>
|
|
21
|
-
<%= content_tag :button, t('helpers.action.add_another'), class: 'btn btn-info btn-sm col-auto h-100', data: { action: 'add-another', template_id: "spotlight-field-template-#{field.slug}" } %>
|
|
22
|
-
<% end %>
|
|
23
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<% inline = local_assigns[:inline].presence %>
|
|
2
|
-
<% label_col = f&.label_col %>
|
|
3
|
-
<% control_col = f&.control_col %>
|
|
4
|
-
<% offset_col = label_col.sub('col', 'offset') %>
|
|
5
|
-
|
|
6
|
-
<div class="form-group mb-3 <%= "row" if inline %>">
|
|
7
|
-
<% Array(value || '').each_with_index do |v, index| %>
|
|
8
|
-
<%= f.label field.slug, field.label, namespace: "f#{index}", class: "col-form-label #{label_col if inline} #{'visually-hidden' if index > 0}" %>
|
|
9
|
-
<div class="mb-3 <%= control_col if inline %>">
|
|
10
|
-
<%= f.text_field_without_bootstrap field.slug, namespace: "f#{index}", multiple: field.is_multiple?, value: v, class: "form-control field-#{field.slug}", readonly: field.readonly_field? %>
|
|
11
|
-
</div>
|
|
12
|
-
<% end %>
|
|
13
|
-
|
|
14
|
-
<% if field.is_multiple? && !field.readonly_field? %>
|
|
15
|
-
<%= content_tag :template, id: "spotlight-field-template-#{field.slug}" do %>
|
|
16
|
-
<%= f.label field.slug, field.label, class: "col-form-label #{label_col if inline} visually-hidden" %>
|
|
17
|
-
<div class="mb-3 <%= "#{offset_col} #{control_col}" if inline %>">
|
|
18
|
-
<%= f.text_field_without_bootstrap field.slug, multiple: field.is_multiple?, value: nil, class: "form-control field-#{field.slug}" %>
|
|
19
|
-
</div>
|
|
20
|
-
<% end %>
|
|
21
|
-
<%= content_tag :button, t('helpers.action.add_another'), class: 'btn btn-info btn-sm col-auto h-100', data: { action: 'add-another', template_id: "spotlight-field-template-#{field.slug}" } %>
|
|
22
|
-
<% end %>
|
|
23
|
-
</div>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<p><%= t("spotlight.#{@key}.invitation_instructions.hello", email: @role.user.email) %></p>
|
|
2
|
-
|
|
3
|
-
<p><%= t("spotlight.#{@key}.invitation_instructions.someone_invited_you", role: @role, exhibit_name: @role.resource.title) %></p>
|
|
4
|
-
|
|
5
|
-
<% if @role.user.invite_pending? %>
|
|
6
|
-
<p><%= t("spotlight.#{@key}.invitation_instructions.accept_invitation") %></p>
|
|
7
|
-
<p><%= link_to t("spotlight.#{@key}.invitation_instructions.accept"), accept_invitation_url(@role.user, invitation_token: @role.user.invitation_token) %></p>
|
|
8
|
-
<% elsif @role.resource.is_a? Spotlight::Exhibit %>
|
|
9
|
-
<p><%= link_to t("spotlight.#{@key}.invitation_instructions.visit"), url: spotlight.exhibit_home_page_url(@role.resource) %></p>
|
|
10
|
-
<% end %>
|
|
11
|
-
|
|
12
|
-
<p><%= t("spotlight.#{@key}.invitation_instructions.ignore") %></p>
|