blacklight-spotlight 2.7.2 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spotlight/admin/add_another.js +22 -0
- data/app/assets/javascripts/spotlight/{add_new_page_button.js → admin/add_new_page_button.js} +0 -0
- data/app/assets/javascripts/spotlight/{appearance.js → admin/appearance.js} +0 -0
- data/app/assets/javascripts/spotlight/{attachments.js → admin/attachments.js} +0 -0
- data/app/assets/javascripts/spotlight/{blacklight_configuration.js → admin/blacklight_configuration.js} +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/autocompleteable.js +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/formable.js +0 -0
- data/app/assets/javascripts/spotlight/{block_mixins → admin/block_mixins}/plustextable.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/browse_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/iframe_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/link_to_search_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/oembed_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/resources_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/rule_block.js +0 -0
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/search_result_block.js +3 -3
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_base_block.js +2 -2
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_carousel_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_embed_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_features_block.js +2 -2
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/solr_documents_grid_block.js +1 -1
- data/app/assets/javascripts/spotlight/{blocks → admin/blocks}/uploaded_items_block.js +0 -0
- data/app/assets/javascripts/spotlight/{catalog_edit.js → admin/catalog_edit.js} +0 -0
- data/app/assets/javascripts/spotlight/{copy_email_addresses.js → admin/copy_email_addresses.js} +0 -0
- data/app/assets/javascripts/spotlight/{crop.es6 → admin/crop.es6} +0 -0
- data/app/assets/javascripts/spotlight/{croppable.js → admin/croppable.js} +1 -1
- data/app/assets/javascripts/spotlight/{edit_in_place.js → admin/edit_in_place.js} +0 -0
- data/app/assets/javascripts/spotlight/{exhibits.js → admin/exhibits.js} +0 -0
- data/app/assets/javascripts/spotlight/{form_observer.js → admin/form_observer.js} +0 -0
- data/app/assets/javascripts/spotlight/{iiif.es6 → admin/iiif.es6} +0 -0
- data/app/assets/javascripts/spotlight/admin/index.js +18 -0
- data/app/assets/javascripts/spotlight/{locks.js → admin/locks.js} +0 -0
- data/app/assets/javascripts/spotlight/{multi_image_selector.js → admin/multi_image_selector.js} +0 -0
- data/app/assets/javascripts/spotlight/{pages.js.erb → admin/pages.js.erb} +0 -2
- data/app/assets/javascripts/spotlight/{readonly_checkbox.js → admin/readonly_checkbox.js} +0 -0
- data/app/assets/javascripts/spotlight/{reindex_monitor.js → admin/reindex_monitor.js} +0 -0
- data/app/assets/javascripts/spotlight/{search_typeahead.js → admin/search_typeahead.js} +1 -1
- data/app/assets/javascripts/spotlight/{select_related_input.js → admin/select_related_input.js} +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/block_controls.js +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/block_limits.js +0 -0
- data/app/assets/javascripts/spotlight/{sir-trevor → admin/sir-trevor}/locales.js +0 -0
- data/app/assets/javascripts/spotlight/{spotlight_nestable.js → admin/spotlight_nestable.js} +0 -0
- data/app/assets/javascripts/spotlight/{tabs.js → admin/tabs.js} +0 -0
- data/app/assets/javascripts/spotlight/{translation_progress.js → admin/translation_progress.js} +0 -0
- data/app/assets/javascripts/spotlight/{users.js → admin/users.js} +0 -0
- data/app/assets/javascripts/spotlight/application.js +2 -22
- data/app/assets/javascripts/spotlight/{analytics.js → user/analytics.js} +0 -0
- data/app/assets/javascripts/spotlight/user/carousel.js +3 -0
- data/app/assets/javascripts/spotlight/{clear_form_button.js → user/clear_form_button.js} +0 -0
- data/app/assets/javascripts/spotlight/user/index.js +6 -0
- data/app/assets/javascripts/spotlight/{report_a_problem.js → user/report_a_problem.js} +0 -0
- data/app/assets/javascripts/spotlight/{zpr_links.js.erb → user/zpr_links.js.erb} +0 -0
- data/app/controllers/spotlight/catalog_controller.rb +1 -1
- data/app/controllers/spotlight/custom_fields_controller.rb +1 -1
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/resources/upload_controller.rb +17 -13
- data/app/controllers/spotlight/resources_controller.rb +5 -0
- data/app/controllers/spotlight/searches_controller.rb +0 -2
- data/app/controllers/spotlight/solr_controller.rb +18 -1
- data/app/helpers/spotlight/pages_helper.rb +10 -0
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -1
- data/app/jobs/spotlight/rename_sidecar_field_job.rb +21 -7
- data/app/models/spotlight/blacklight_configuration.rb +4 -2
- data/app/models/spotlight/custom_field.rb +20 -20
- data/app/models/spotlight/exhibit.rb +11 -1
- data/app/models/spotlight/page.rb +10 -4
- data/app/models/spotlight/page_content.rb +18 -0
- data/app/models/spotlight/page_content/sir_trevor.rb +17 -0
- data/app/models/spotlight/solr_document_sidecar.rb +3 -0
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -2
- data/app/serializers/spotlight/exhibit_export_serializer.rb +4 -0
- data/app/services/spotlight/upload_solr_document_builder.rb +10 -3
- data/app/values/custom_field_name.rb +6 -6
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +9 -14
- data/app/views/spotlight/custom_fields/_form.html.erb +7 -2
- data/app/views/spotlight/custom_fields/form_group/_text.html.erb +14 -0
- data/app/views/spotlight/custom_fields/form_group/_vocab.html.erb +14 -0
- data/app/views/spotlight/pages/_form.html.erb +1 -1
- data/app/views/spotlight/resources/new.html.erb +9 -3
- data/app/views/spotlight/resources/upload/_form.html.erb +3 -1
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/spotlight.en.yml +5 -0
- data/db/migrate/20190807085432_add_content_type_to_pages.rb +5 -0
- data/db/migrate/20190813085432_add_is_multiple_to_custom_fields.rb +7 -0
- data/lib/spotlight/engine.rb +8 -1
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/catalog_controller_spec.rb +6 -0
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +9 -1
- data/spec/controllers/spotlight/solr_controller_spec.rb +16 -0
- data/spec/examples.txt +1305 -1325
- data/spec/features/add_custom_field_metadata_spec.rb +19 -1
- data/spec/features/add_items_spec.rb +19 -2
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +23 -0
- data/spec/helpers/spotlight/pages_helper_spec.rb +14 -0
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +4 -2
- data/spec/models/spotlight/blacklight_configuration_spec.rb +2 -2
- data/spec/models/spotlight/custom_field_spec.rb +8 -3
- data/spec/models/spotlight/page_spec.rb +35 -0
- metadata +61 -51
@@ -6,6 +6,16 @@ module Spotlight
|
|
6
6
|
module PagesHelper
|
7
7
|
include Spotlight::RenderingHelper
|
8
8
|
|
9
|
+
def content_editor_class(page)
|
10
|
+
page_content = page.content_type
|
11
|
+
|
12
|
+
if page_content == 'SirTrevor'
|
13
|
+
'js-st-instance'
|
14
|
+
else
|
15
|
+
"js-#{page_content.parameterize}-instance"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
9
19
|
##
|
10
20
|
# Override the default #sir_trevor_markdown so we can use
|
11
21
|
# a more complete markdown rendered
|
@@ -7,15 +7,29 @@ module Spotlight
|
|
7
7
|
class RenameSidecarFieldJob < ActiveJob::Base
|
8
8
|
queue_as :default
|
9
9
|
|
10
|
-
def perform(exhibit, old_field, new_field)
|
10
|
+
def perform(exhibit, old_field, new_field, old_slug = nil, new_slug = nil)
|
11
11
|
exhibit.solr_document_sidecars.find_each do |s|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
# this data migration should be relatively rare
|
13
|
+
migrate_data!(s, old_slug, new_slug)
|
14
|
+
migrate_data!(s, old_field, new_slug || new_field) # for backwards compatibility
|
15
|
+
|
16
|
+
# more likely, the indexing rules changed and we have to reindex
|
17
|
+
reindex_document!(s) if old_field != new_field && s.data[new_slug || new_field]
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def migrate_data!(sidecar, old_field, new_field)
|
24
|
+
return if old_field == new_field || !sidecar.data.key?(old_field)
|
25
|
+
|
26
|
+
sidecar.data_will_change!
|
27
|
+
sidecar.data[new_field] = sidecar.data.delete(old_field)
|
28
|
+
sidecar.save
|
29
|
+
end
|
30
|
+
|
31
|
+
def reindex_document!(sidecar)
|
32
|
+
sidecar.document.reindex
|
33
|
+
end
|
20
34
|
end
|
21
35
|
end
|
@@ -216,7 +216,7 @@ module Spotlight
|
|
216
216
|
end
|
217
217
|
|
218
218
|
def custom_facet_fields
|
219
|
-
Hash[exhibit.custom_fields.
|
219
|
+
Hash[exhibit.custom_fields.facetable.reject(&:new_record?).map do |x|
|
220
220
|
field = Blacklight::Configuration::FacetField.new x.configuration.merge(
|
221
221
|
key: x.field, field: x.solr_field, show: false, custom_field: true
|
222
222
|
)
|
@@ -277,7 +277,9 @@ module Spotlight
|
|
277
277
|
def add_exhibit_tags_fields(config)
|
278
278
|
# rubocop:disable Style/GuardClause
|
279
279
|
unless config.show_fields.include? :exhibit_tags
|
280
|
-
config.add_show_field :exhibit_tags, field: config.document_model.solr_field_for_tagger(exhibit),
|
280
|
+
config.add_show_field :exhibit_tags, field: config.document_model.solr_field_for_tagger(exhibit),
|
281
|
+
link_to_search: true,
|
282
|
+
separator_options: { words_connector: nil, two_words_connector: nil, last_word_connector: nil }
|
281
283
|
end
|
282
284
|
|
283
285
|
unless config.facet_fields.include? :exhibit_tags
|
@@ -10,7 +10,7 @@ module Spotlight
|
|
10
10
|
extend FriendlyId
|
11
11
|
friendly_id :slug_candidates, use: [:slugged, :scoped, :finders], scope: :exhibit
|
12
12
|
|
13
|
-
scope :
|
13
|
+
scope :facetable, -> { where(field_type: Spotlight::Engine.config.custom_field_types.select { |_k, v| v[:facetable] }.keys) }
|
14
14
|
scope :writeable, -> { where(readonly_field: false) }
|
15
15
|
|
16
16
|
before_create do
|
@@ -18,9 +18,10 @@ module Spotlight
|
|
18
18
|
self.field_type ||= 'text'
|
19
19
|
end
|
20
20
|
|
21
|
-
before_save
|
22
|
-
|
23
|
-
|
21
|
+
before_save :update_field_name, on: :update, if: -> { field_type_changed? || readonly_field_changed? }
|
22
|
+
|
23
|
+
after_commit :update_blacklight_configuration_after_field_name_change, on: :update, if: -> { saved_change_to_field? || saved_change_to_slug? }
|
24
|
+
after_commit :update_sidecar_data_after_field_name_change, on: :update, if: -> { saved_change_to_field? || saved_change_to_slug? }
|
24
25
|
|
25
26
|
def label=(label)
|
26
27
|
configuration['label'] = label
|
@@ -92,7 +93,7 @@ module Spotlight
|
|
92
93
|
end
|
93
94
|
|
94
95
|
def should_generate_new_friendly_id?
|
95
|
-
|
96
|
+
new_record? && slug.blank?
|
96
97
|
end
|
97
98
|
|
98
99
|
# Try building a slug based on the following fields in
|
@@ -107,26 +108,25 @@ module Spotlight
|
|
107
108
|
##
|
108
109
|
# Rename this custom field to new_name
|
109
110
|
# @param [String] the new name for the field
|
110
|
-
def update_field_name
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
f = blacklight_configuration.index_fields.delete(old_field)
|
117
|
-
blacklight_configuration.index_fields[field] = f
|
118
|
-
blacklight_configuration.save
|
119
|
-
end
|
111
|
+
def update_field_name
|
112
|
+
self.field = field_name
|
113
|
+
end
|
114
|
+
|
115
|
+
def update_blacklight_configuration_after_field_name_change
|
116
|
+
return unless blacklight_configuration && blacklight_configuration.index_fields.key?(field_before_last_save)
|
120
117
|
|
121
|
-
|
118
|
+
blacklight_configuration.index_fields_will_change!
|
119
|
+
f = blacklight_configuration.index_fields.delete(field_before_last_save)
|
120
|
+
blacklight_configuration.index_fields[field] = f
|
121
|
+
blacklight_configuration.save
|
122
122
|
end
|
123
123
|
|
124
|
-
def
|
125
|
-
|
124
|
+
def update_sidecar_data_after_field_name_change
|
125
|
+
Spotlight::RenameSidecarFieldJob.perform_later(exhibit, field_before_last_save, self.field, slug_before_last_save, slug)
|
126
126
|
end
|
127
127
|
|
128
|
-
def
|
129
|
-
|
128
|
+
def document_model
|
129
|
+
blacklight_configuration.document_model
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
@@ -36,7 +36,17 @@ module Spotlight
|
|
36
36
|
has_many :attachments, dependent: :destroy
|
37
37
|
has_many :contact_emails, dependent: :delete_all # These are the contacts who get "Contact us" emails
|
38
38
|
has_many :contacts, dependent: :delete_all # These are the contacts who appear in the sidebar
|
39
|
-
has_many :custom_fields, dependent: :delete_all
|
39
|
+
has_many :custom_fields, dependent: :delete_all do
|
40
|
+
def as_strong_params
|
41
|
+
multivalued_params, single_valued_params = writeable.partition(&:is_multiple?)
|
42
|
+
single_valued_params.pluck(:slug, :field).flatten +
|
43
|
+
[multivalued_params.each_with_object({}) do |f, h|
|
44
|
+
h[f.slug] = []
|
45
|
+
h[f.field] = []
|
46
|
+
end]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
40
50
|
has_many :feature_pages, -> { for_default_locale }, extend: FriendlyId::FinderMethods
|
41
51
|
has_many :main_navigations, dependent: :delete_all
|
42
52
|
has_many :reindexing_log_entries, dependent: :destroy
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module Spotlight
|
4
4
|
##
|
5
5
|
# Base page class. See {Spotlight::AboutPage}, {Spotlight::FeaturePage}, {Spotlight::HomePage}
|
6
|
-
# rubocop:disable Metrics/ClassLength
|
7
6
|
class Page < ActiveRecord::Base
|
8
7
|
MAX_PAGES = 1000
|
9
8
|
|
@@ -35,14 +34,12 @@ module Spotlight
|
|
35
34
|
scope :for_default_locale, -> { for_locale(I18n.default_locale) }
|
36
35
|
|
37
36
|
has_one :lock, as: :on, dependent: :destroy
|
38
|
-
sir_trevor_content :content
|
39
37
|
has_paper_trail
|
40
38
|
|
41
39
|
accepts_nested_attributes_for :thumbnail, update_only: true, reject_if: proc { |attr| attr['iiif_tilesource'].blank? }
|
42
40
|
|
43
41
|
# display_sidebar should be set to true by default
|
44
42
|
before_create do
|
45
|
-
self.content ||= [].to_json
|
46
43
|
self.display_sidebar = true
|
47
44
|
end
|
48
45
|
|
@@ -52,6 +49,16 @@ module Spotlight
|
|
52
49
|
@content = nil
|
53
50
|
end
|
54
51
|
|
52
|
+
def content
|
53
|
+
@content ||= begin
|
54
|
+
Spotlight::PageContent.for(self, :content)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def content_type
|
59
|
+
self[:content_type] || Spotlight::Engine.config.default_page_content_type
|
60
|
+
end
|
61
|
+
|
55
62
|
def content=(content)
|
56
63
|
if content.is_a? Array
|
57
64
|
super content.to_json
|
@@ -160,5 +167,4 @@ module Spotlight
|
|
160
167
|
translated_pages.update(weight: weight) if saved_change_to_weight?
|
161
168
|
end
|
162
169
|
end
|
163
|
-
# rubocop:enable Metrics/ClassLength
|
164
170
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotlight
|
4
|
+
# Factory for picking the right page content renderer
|
5
|
+
module PageContent
|
6
|
+
def self.for(page, attribute)
|
7
|
+
content_type = page.content_type
|
8
|
+
content_class = Spotlight::PageContent.const_get(content_type) if Spotlight::PageContent.const_defined?(content_type)
|
9
|
+
content_class ||= default_page_content_class
|
10
|
+
|
11
|
+
content_class.parse(page, attribute)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.default_page_content_class
|
15
|
+
Spotlight::PageContent.const_get(Spotlight::Engine.config.default_page_content_type)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spotlight
|
4
|
+
module PageContent
|
5
|
+
# Sir-Trevor created content
|
6
|
+
class SirTrevor
|
7
|
+
def self.parse(page, attribute)
|
8
|
+
content = page.read_attribute(attribute)
|
9
|
+
content ||= [].to_json
|
10
|
+
|
11
|
+
return SirTrevorRails::BlockArray.new if content.blank?
|
12
|
+
|
13
|
+
SirTrevorRails::BlockArray.from_json(content, page)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -27,8 +27,8 @@ module Spotlight
|
|
27
27
|
# IIIFManifest expects leaf nodes to implement #display_image, which returns an instance of IIIFManifest::DisplayImage.
|
28
28
|
def display_image
|
29
29
|
IIIFManifest::DisplayImage.new(id,
|
30
|
-
width: resource.first(:spotlight_full_image_width_ssm),
|
31
|
-
height: resource.first(:spotlight_full_image_height_ssm),
|
30
|
+
width: resource.first(:spotlight_full_image_width_ssm)&.to_i,
|
31
|
+
height: resource.first(:spotlight_full_image_height_ssm)&.to_i,
|
32
32
|
format: 'image/jpeg',
|
33
33
|
iiif_endpoint: endpoint)
|
34
34
|
end
|
@@ -34,6 +34,10 @@ module Spotlight
|
|
34
34
|
property prop
|
35
35
|
end
|
36
36
|
|
37
|
+
property :theme, setter: lambda { |fragment:, represented:, **|
|
38
|
+
represented.theme = fragment if Spotlight::Engine.config.exhibit_themes.include? fragment
|
39
|
+
}
|
40
|
+
|
37
41
|
collection :searches, populator: ->(fragment, options) { options[:represented].searches.find_or_initialize_by(slug: fragment['slug']) },
|
38
42
|
class: Spotlight::Search do
|
39
43
|
(Spotlight::Search.attribute_names - %w(id scope exhibit_id masthead_id thumbnail_id)).each do |prop|
|
@@ -8,10 +8,13 @@ module Spotlight
|
|
8
8
|
def to_solr
|
9
9
|
super.tap do |solr_hash|
|
10
10
|
add_default_solr_fields solr_hash
|
11
|
-
add_image_dimensions solr_hash
|
12
|
-
add_file_versions solr_hash
|
13
11
|
add_sidecar_fields solr_hash
|
14
|
-
|
12
|
+
|
13
|
+
if attached_file?
|
14
|
+
add_image_dimensions solr_hash
|
15
|
+
add_file_versions solr_hash
|
16
|
+
add_manifest_path solr_hash
|
17
|
+
end
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
@@ -46,5 +49,9 @@ module Spotlight
|
|
46
49
|
def riiif
|
47
50
|
Riiif::Engine.routes.url_helpers
|
48
51
|
end
|
52
|
+
|
53
|
+
def attached_file?
|
54
|
+
resource.upload&.file_present?
|
55
|
+
end
|
49
56
|
end
|
50
57
|
end
|
@@ -28,11 +28,11 @@ class CustomFieldName
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def field_suffix
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
(field_type && Spotlight::Engine.config.custom_field_types[field_type.to_sym][:suffix]) ||
|
32
|
+
default_field_suffix
|
33
|
+
end
|
34
|
+
|
35
|
+
def default_field_suffix
|
36
|
+
Spotlight::Engine.config.solr_fields.text_suffix
|
37
37
|
end
|
38
38
|
end
|
@@ -10,20 +10,15 @@
|
|
10
10
|
|
11
11
|
<%# Using `includes(:exhibit)` to ensure all fields are using the same exhibit object to take advantage of memoization %>
|
12
12
|
<% current_exhibit.custom_fields.includes(:exhibit).each do |field| %>
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<%=
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<%= t(:'.blank_field_warning_html',
|
23
|
-
link: link_to(t(:'spotlight.configuration.sidebar.metadata'), spotlight.edit_exhibit_metadata_configuration_path(current_exhibit))) %>
|
24
|
-
</p>
|
25
|
-
<% end %>
|
26
|
-
</div>
|
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 help-block">
|
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 %>
|
27
22
|
<% end %>
|
28
23
|
<% end %>
|
29
24
|
<% end %>
|
@@ -4,8 +4,13 @@
|
|
4
4
|
<%= f.text_area :short_description %>
|
5
5
|
|
6
6
|
<%= f.form_group :field_type, label: { text: t(:'.field_type.label') } do %>
|
7
|
-
|
8
|
-
|
7
|
+
<% Spotlight::Engine.config.custom_field_types.each do |key, field_type| %>
|
8
|
+
<%= f.radio_button :field_type, key, label: t(:".field_type.#{key}") %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= f.form_group :field_type, label: { text: t(:'.is_multiple.label') } do %>
|
13
|
+
<%= f.check_box :is_multiple, disabled: @custom_field.persisted? %>
|
9
14
|
<% end %>
|
10
15
|
|
11
16
|
<div class="form-actions">
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="form-group">
|
2
|
+
<% Array(value || '').each_with_index do |v, index| %>
|
3
|
+
<%= f.label field.slug, field.label, namespace: "f#{index}",class: "control-label #{'sr-only' if index > 0}" %>
|
4
|
+
<%= 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? %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if field.is_multiple? && !field.readonly_field? %>
|
8
|
+
<%= content_tag :template, id: "spotlight-field-template-#{field.slug}" do %>
|
9
|
+
<%= f.label field.slug, field.label, class: 'control-label sr-only' %>
|
10
|
+
<%= f.text_area_without_bootstrap field.slug, multiple: field.is_multiple?, value: nil, class: "form-control field-#{field.slug}" %>
|
11
|
+
<% end %>
|
12
|
+
<%= content_tag :button, t('helpers.action.add_another'), class: 'btn btn-info', data: { action: 'add-another', template_id: "spotlight-field-template-#{field.slug}" } %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="form-group">
|
2
|
+
<% Array(value || '').each_with_index do |v, index| %>
|
3
|
+
<%= f.label field.slug, field.label, namespace: "f#{index}", class: "control-label #{'sr-only' if index > 0}" %>
|
4
|
+
<%= 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? %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if field.is_multiple? && !field.readonly_field? %>
|
8
|
+
<%= content_tag :template, id: "spotlight-field-template-#{field.slug}" do %>
|
9
|
+
<%= f.label field.slug, field.label, class: 'control-label sr-only' %>
|
10
|
+
<%= f.text_field_without_bootstrap field.slug, multiple: field.is_multiple?, value: nil, class: "form-control field-#{field.slug}" %>
|
11
|
+
<% end %>
|
12
|
+
<%= content_tag :button, t('helpers.action.add_another'), class: 'btn btn-info', data: { action: 'add-another', template_id: "spotlight-field-template-#{field.slug}" } %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
</div>
|
41
41
|
<div class="form-group">
|
42
42
|
<%= f.label :content, class: 'sr-only' %>
|
43
|
-
<%= f.text_area_without_bootstrap :content, value: { data: f.object.content.as_json }.to_json, class:
|
43
|
+
<%= f.text_area_without_bootstrap :content, value: { data: f.object.content.as_json }.to_json, class: content_editor_class(f.object), data: { 'block-types': Spotlight::Engine.config.sir_trevor_widgets } %>
|
44
44
|
</div>
|
45
45
|
</div>
|
46
46
|
|
@@ -4,14 +4,20 @@
|
|
4
4
|
<div role="tabpanel">
|
5
5
|
<ul class="nav nav-tabs" role="tablist">
|
6
6
|
<% Spotlight::Engine.config.resource_partials.each_with_index do |p, i| %>
|
7
|
-
|
8
|
-
|
7
|
+
<% tab_name = p.split('/')[2] %>
|
8
|
+
<li role="presentation" class="<%= "active" if @tab == tab_name %>">
|
9
|
+
<%= link_to t("#{p.gsub('/', '.')}.title"),
|
10
|
+
"##{tab_name}",
|
11
|
+
role: 'tab',
|
12
|
+
'data-toggle' => 'tab',
|
13
|
+
'aria-controls' => "#{tab_name}" %>
|
9
14
|
</li>
|
10
15
|
<% end %>
|
11
16
|
</ul>
|
12
17
|
<div class="tab-content">
|
13
18
|
<% Spotlight::Engine.config.resource_partials.each_with_index do |p, i| %>
|
14
|
-
|
19
|
+
<% tab_name = p.split('/')[2] %>
|
20
|
+
<%= content_tag :div, id: "#{tab_name}", role: 'tabpanel', class: "tab-pane #{"active" if @tab == tab_name}" do %>
|
15
21
|
<%= render p %>
|
16
22
|
<% end %>
|
17
23
|
<% end %>
|