blacklight-spotlight 5.3.2 → 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 +41 -4
- data/Rakefile +1 -2
- data/app/assets/javascripts/spotlight/spotlight.esm.js +2168 -4560
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +2167 -4559
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_blacklight_overrides.scss +4 -0
- data/app/assets/stylesheets/spotlight/_browse.scss +0 -4
- data/app/assets/stylesheets/spotlight/{_collapse_toggle.scss → _collapse_toggle.css} +2 -2
- data/app/assets/stylesheets/spotlight/_exhibit_admin.scss +8 -0
- data/app/assets/stylesheets/spotlight/_exhibits_index.scss +2 -1
- data/app/assets/stylesheets/spotlight/_footer.scss +2 -2
- data/app/assets/stylesheets/spotlight/_header.scss +8 -8
- data/app/assets/stylesheets/spotlight/_pages.scss +1 -1
- data/app/assets/stylesheets/spotlight/_slideshow_block.scss +15 -0
- data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -1
- data/app/assets/stylesheets/spotlight/_translations.scss +3 -3
- data/app/assets/stylesheets/spotlight/_uploaded_items_block.css +7 -0
- data/app/assets/stylesheets/spotlight/_variables.css +15 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +0 -76
- data/app/components/blacklight/icons/pause_component.rb +15 -0
- data/app/components/blacklight/icons/play_arrow_component.rb +15 -0
- data/app/components/spotlight/analytics/dashboard_component.html.erb +1 -1
- data/app/components/spotlight/custom_field_form_group_component.rb +40 -0
- data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
- 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/masthead_component.html.erb +18 -0
- data/app/components/spotlight/masthead_component.rb +46 -0
- data/app/components/spotlight/save_search_component.html.erb +1 -1
- 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/solr_document_legacy_embed_component.html.erb +0 -4
- data/app/components/spotlight/solr_document_legacy_embed_component.rb +2 -2
- data/app/components/spotlight/tag_selector_component.html.erb +1 -1
- data/app/components/spotlight/tag_selector_component.rb +3 -2
- data/app/components/spotlight/upload_field_form_group_component.rb +33 -0
- data/app/controllers/concerns/spotlight/controller.rb +15 -14
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -5
- data/app/controllers/spotlight/browse_controller.rb +1 -6
- data/app/controllers/spotlight/catalog_controller.rb +2 -3
- data/app/controllers/spotlight/concerns/application_controller.rb +4 -6
- data/app/controllers/spotlight/exhibits_controller.rb +22 -10
- data/app/controllers/spotlight/lock_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +11 -11
- data/app/controllers/spotlight/resources/upload_controller.rb +1 -1
- data/app/controllers/spotlight/resources_controller.rb +1 -1
- data/app/controllers/spotlight/solr_controller.rb +5 -1
- data/app/helpers/spotlight/application_helper.rb +14 -26
- data/app/helpers/spotlight/crud_link_helpers.rb +0 -12
- data/app/helpers/spotlight/main_app_helpers.rb +2 -2
- data/app/javascript/spotlight/admin/add_another.js +37 -25
- data/app/javascript/spotlight/admin/add_image_selector.js +43 -26
- data/app/javascript/spotlight/admin/add_new_button.js +51 -36
- data/app/javascript/spotlight/admin/blacklight_configuration.js +76 -54
- data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +102 -101
- data/app/javascript/spotlight/admin/block_mixins/formable.js +91 -75
- data/app/javascript/spotlight/admin/block_mixins/plustextable.js +46 -48
- data/app/javascript/spotlight/admin/blocks/block.js +27 -28
- data/app/javascript/spotlight/admin/blocks/browse_block.js +14 -10
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +14 -10
- data/app/javascript/spotlight/admin/blocks/pages_block.js +5 -4
- data/app/javascript/spotlight/admin/blocks/resources_block.js +61 -41
- data/app/javascript/spotlight/admin/blocks/search_result_block.js +24 -7
- data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +103 -50
- data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +50 -26
- data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +47 -23
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +35 -19
- data/app/javascript/spotlight/admin/crop.js +146 -66
- data/app/javascript/spotlight/admin/croppable.js +5 -4
- data/app/javascript/spotlight/admin/croppable_modal.js +67 -32
- data/app/javascript/spotlight/admin/edit_in_place.js +69 -54
- data/app/javascript/spotlight/admin/exhibits.js +92 -45
- data/app/javascript/spotlight/admin/form_observer.js +92 -78
- data/app/javascript/spotlight/admin/multi_image_selector.js +201 -153
- data/app/javascript/spotlight/admin/pages.js +13 -7
- data/app/javascript/spotlight/admin/progress_monitor.js +65 -50
- data/app/javascript/spotlight/admin/readonly_checkbox.js +7 -3
- data/app/javascript/spotlight/admin/search_typeahead.js +20 -11
- data/app/javascript/spotlight/admin/select_related_input.js +23 -23
- data/app/javascript/spotlight/admin/serialize_json.js +120 -0
- data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +24 -11
- data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +9 -6
- data/app/javascript/spotlight/admin/sir-trevor/locales.js +2 -2
- data/app/javascript/spotlight/admin/spotlight_nestable.js +2 -5
- data/app/javascript/spotlight/admin/translation_progress.js +18 -13
- data/app/javascript/spotlight/admin/users.js +151 -64
- data/app/javascript/spotlight/user/carousel.js +104 -32
- data/app/javascript/spotlight/user/clear_form_button.js +24 -14
- data/app/javascript/spotlight/user/index.js +0 -2
- data/app/javascript/spotlight/user/zpr_links.js +99 -40
- data/app/jobs/concerns/spotlight/gather_documents.rb +1 -1
- data/app/jobs/spotlight/add_uploads_from_csv.rb +31 -8
- data/app/jobs/spotlight/cleanup_job_trackers_job.rb +5 -3
- data/app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb +13 -2
- data/app/models/concerns/spotlight/browse_category_search_builder.rb +3 -3
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
- data/app/models/concerns/spotlight/sitemap.rb +2 -2
- data/app/models/concerns/spotlight/solr_document/finder.rb +2 -2
- 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/sir_trevor_rails/blocks/solr_documents_block.rb +2 -1
- data/app/models/spotlight/blacklight_configuration.rb +5 -3
- data/app/models/spotlight/contact_email.rb +2 -2
- data/app/models/spotlight/custom_field.rb +17 -0
- data/app/models/spotlight/exhibit.rb +28 -0
- data/app/models/spotlight/featured_image.rb +1 -1
- data/app/models/spotlight/field_metadata.rb +10 -5
- data/app/models/spotlight/job_tracker.rb +0 -18
- data/app/models/spotlight/main_navigation.rb +2 -2
- data/app/models/spotlight/page.rb +3 -3
- data/app/models/spotlight/resources/iiif_harvester.rb +7 -4
- data/app/models/spotlight/resources/iiif_manifest.rb +0 -4
- data/app/models/spotlight/resources/iiif_manifest_metadata.rb +1 -3
- data/app/models/spotlight/resources/iiif_service.rb +21 -6
- data/app/models/spotlight/resources/upload.rb +6 -0
- data/app/models/spotlight/search.rb +5 -9
- data/app/models/spotlight/solr_document_sidecar.rb +18 -0
- data/app/services/spotlight/bulk_updates_csv_template_service.rb +1 -1
- data/app/services/spotlight/etl/pipeline.rb +2 -2
- data/app/services/spotlight/etl/step.rb +2 -2
- data/app/views/catalog/_remove_tags.html.erb +2 -2
- data/app/views/layouts/spotlight/base.html.erb +3 -6
- data/app/views/layouts/spotlight/spotlight.html.erb +2 -2
- data/app/views/shared/_analytics.html.erb +4 -3
- data/app/views/shared/_masthead.html.erb +2 -18
- data/app/views/spotlight/about_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/about_pages/_sidebar.html.erb +10 -8
- data/app/views/spotlight/browse/_search.html.erb +2 -2
- data/app/views/spotlight/browse/_search_box.html.erb +6 -14
- data/app/views/spotlight/browse/index.html.erb +1 -1
- data/app/views/spotlight/browse/show.html.erb +1 -1
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_default.html.erb +1 -1
- data/app/views/spotlight/catalog/edit.html.erb +1 -1
- data/app/views/spotlight/dashboards/_page.html.erb +1 -1
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +3 -1
- data/app/views/spotlight/exhibits/_export.html.erb +17 -1
- data/app/views/spotlight/exhibits/_form.html.erb +20 -4
- data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +3 -3
- data/app/views/spotlight/exhibits/index.html.erb +21 -8
- data/app/views/spotlight/feature_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_sidebar.html.erb +17 -15
- data/app/views/spotlight/home_pages/_empty.html.erb +7 -7
- data/app/views/spotlight/pages/show.html.erb +1 -0
- data/app/views/spotlight/resources/upload/_form.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +5 -16
- data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +3 -5
- data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +11 -2
- data/app/views/spotlight/sites/_exhibit.html.erb +1 -1
- data/config/i18n-tasks.yml +1 -1
- data/config/locales/spotlight.ar.yml +1 -2
- data/config/locales/spotlight.de.yml +1 -2
- data/config/locales/spotlight.en.yml +39 -10
- data/config/locales/spotlight.es.yml +1 -2
- data/config/locales/spotlight.fr.yml +1 -2
- data/config/locales/spotlight.it.yml +1 -2
- data/config/locales/spotlight.ja.yml +39 -0
- data/config/locales/spotlight.zh.yml +1 -2
- data/db/migrate/20261007133748_add_discovery_enabled_to_spotlight_exhibits.rb +5 -0
- data/lib/generators/spotlight/assets/importmap_generator.rb +2 -10
- data/lib/generators/spotlight/assets/propshaft_generator.rb +5 -4
- data/lib/generators/spotlight/install_generator.rb +2 -4
- data/lib/generators/spotlight/templates/catalog_controller.rb +0 -1
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +26 -4
- data/lib/generators/spotlight/templates/solr/conf/schema.xml +4 -3
- data/lib/generators/spotlight/templates/solr/conf/solrconfig.xml +3 -8
- data/lib/migration/page_language.rb +0 -2
- data/lib/spotlight/engine.rb +28 -9
- data/lib/spotlight/search_state.rb +7 -11
- data/lib/spotlight/upload_field_config.rb +19 -1
- data/lib/spotlight/version.rb +1 -1
- data/lib/spotlight.rb +1 -1
- data/spec/support/features/capybara_wait_metadata_helper.rb +3 -1
- data/spec/support/features/test_features_helpers.rb +24 -1
- data/spec/support/iiif_manifest_fixtures.rb +33 -0
- data/spec/support/stub_dns_resolution.rb +12 -0
- metadata +50 -80
- data/app/assets/stylesheets/spotlight/_uploaded_items_block.scss +0 -7
- data/app/assets/stylesheets/spotlight/_variables.scss +0 -13
- data/app/components/blacklight/icons/arrow_alt_circle_left_component.rb +0 -15
- data/app/components/blacklight/icons/arrow_alt_circle_right_component.rb +0 -15
- 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/components/spotlight/icon_component.rb +0 -13
- data/app/javascript/spotlight/user/browse_group_categories.js +0 -54
- data/app/mailers/spotlight/invitation_mailer.rb +0 -21
- data/app/models/concerns/spotlight/resources/web.rb +0 -38
- data/app/services/spotlight/iiif_resource_resolver.rb +0 -78
- data/app/views/catalog/_image_default.html.erb +0 -6
- data/app/views/shared/_exhibit_navbar.html.erb +0 -2
- data/app/views/shared/_header_navbar.html.erb +0 -6
- data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +0 -23
- data/app/views/spotlight/catalog/_admin_thumbnail_default.html.erb +0 -7
- data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +0 -1
- data/app/views/spotlight/catalog/_document_row.html.erb +0 -2
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +0 -24
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +0 -21
- 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
- data/lib/generators/spotlight/templates/javascript/jquery-shim.js +0 -1
- data/vendor/assets/javascripts/tiny-slider.js +0 -3221
- data/vendor/assets/stylesheets/tiny-slider.css +0 -1
- /data/app/assets/stylesheets/spotlight/{_breadcrumbs.scss → _breadcrumbs.css} +0 -0
- /data/app/assets/stylesheets/spotlight/{_croppable.scss → _croppable.css} +0 -0
- /data/app/assets/stylesheets/spotlight/{_modals.scss → _modals.css} +0 -0
- /data/app/assets/stylesheets/spotlight/{_utilities.scss → _utilities.css} +0 -0
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
preload: true,
|
|
1
|
+
SirTrevor.BlockMixins.Plustextable = {
|
|
2
|
+
mixinName: "Textable",
|
|
3
|
+
preload: true,
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
initializeTextable: function () {
|
|
6
|
+
if (this["formId"] === undefined) {
|
|
7
|
+
this.withMixin(SirTrevor.BlockMixins.Formable)
|
|
8
|
+
}
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
if (this["show_heading"] === undefined) {
|
|
11
|
+
this.show_heading = true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
align_key: "text-align",
|
|
16
|
+
text_key: "item-text",
|
|
17
|
+
heading_key: "title",
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</div>
|
|
19
|
+
text_area: function () {
|
|
20
|
+
return `
|
|
21
|
+
<div class="row">
|
|
22
|
+
<div class="col-md-8">
|
|
23
|
+
<div class="form-group mb-3">
|
|
24
|
+
${this.heading()}
|
|
25
|
+
<div class="field">
|
|
26
|
+
<label for="${this.formId(this.text_key)}" class="col-form-label">${i18n.t("blocks:textable:text")}</label>
|
|
27
|
+
<div id="${this.formId(this.text_key)}" class="st-text-block form-control" contenteditable="true"></div>
|
|
30
28
|
</div>
|
|
31
29
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</
|
|
30
|
+
</div>
|
|
31
|
+
<div class="col-md-4">
|
|
32
|
+
<div class="text-align">
|
|
33
|
+
<p>${i18n.t("blocks:textable:align:title")}</p>
|
|
34
|
+
<input data-key="${this.align_key}" type="radio" name="${this.formId(this.align_key)}" id="${this.formId(this.align_key + "-left")}" value="left" checked="true">
|
|
35
|
+
<label for="${this.formId(this.align_key + "-left")}">${i18n.t("blocks:textable:align:left")}</label>
|
|
36
|
+
<input data-key="${this.align_key}" type="radio" name="${this.formId(this.align_key)}" id="${this.formId(this.align_key + "-right")}" value="right">
|
|
37
|
+
<label for="${this.formId(this.align_key + "-right")}">${i18n.t("blocks:textable:align:right")}</label>
|
|
40
38
|
</div>
|
|
41
|
-
</div
|
|
42
|
-
|
|
39
|
+
</div>
|
|
40
|
+
</div>`
|
|
41
|
+
},
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
heading: function () {
|
|
44
|
+
if (this.show_heading) {
|
|
45
|
+
return `<div class="field">
|
|
46
|
+
<label for="${this.formId(this.heading_key)}" class="col-form-label">${i18n.t("blocks:textable:heading")}</label>
|
|
47
|
+
<input type="text" class="form-control" id="${this.formId(this.heading_key)}" name="${this.heading_key}" />
|
|
48
|
+
</div>`
|
|
49
|
+
} else {
|
|
50
|
+
return ""
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
}
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
})(jQuery)
|
|
55
|
+
SirTrevor.Block.prototype.availableMixins.push("plustextable")
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import Core from "spotlight/core"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})(jQuery)
|
|
2
|
+
|
|
3
|
+
Core.Block = SirTrevor.Block.extend({
|
|
4
|
+
scribeOptions: {
|
|
5
|
+
allowBlockElements: true,
|
|
6
|
+
tags: { p: true },
|
|
7
|
+
},
|
|
8
|
+
formable: true,
|
|
9
|
+
editorHTML: function () {
|
|
10
|
+
return ""
|
|
11
|
+
},
|
|
12
|
+
beforeBlockRender: function () {
|
|
13
|
+
this.availableMixins.forEach(function (mixin) {
|
|
14
|
+
if (
|
|
15
|
+
this[mixin] &&
|
|
16
|
+
SirTrevor.BlockMixins[this.capitalize(mixin)].preload
|
|
17
|
+
) {
|
|
18
|
+
this.withMixin(SirTrevor.BlockMixins[this.capitalize(mixin)])
|
|
19
|
+
}
|
|
20
|
+
}, this)
|
|
21
|
+
},
|
|
22
|
+
instance: function () {
|
|
23
|
+
return document.getElementById(this.instanceID)
|
|
24
|
+
},
|
|
25
|
+
capitalize: function (string) {
|
|
26
|
+
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase()
|
|
27
|
+
},
|
|
28
|
+
})
|
|
@@ -7,10 +7,9 @@ SirTrevor.Blocks.Browse = (function () {
|
|
|
7
7
|
icon_name: "browse",
|
|
8
8
|
|
|
9
9
|
autocomplete_url: function () {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.autocompleteExhibitSearchesPath
|
|
10
|
+
return this.instance().closest(
|
|
11
|
+
"form[data-autocomplete-exhibit-searches-path]",
|
|
12
|
+
).dataset.autocompleteExhibitSearchesPath
|
|
14
13
|
},
|
|
15
14
|
|
|
16
15
|
autocomplete_fetch: function (url) {
|
|
@@ -66,14 +65,19 @@ SirTrevor.Blocks.Browse = (function () {
|
|
|
66
65
|
</div>
|
|
67
66
|
</li>`
|
|
68
67
|
|
|
69
|
-
var
|
|
68
|
+
var tempDiv = document.createElement("div")
|
|
69
|
+
tempDiv.innerHTML = markup.trim()
|
|
70
|
+
var panel = tempDiv.firstElementChild
|
|
70
71
|
var context = this
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
const removeLink = panel.querySelector(".remove a")
|
|
74
|
+
if (removeLink) {
|
|
75
|
+
removeLink.addEventListener("click", function (e) {
|
|
76
|
+
e.preventDefault()
|
|
77
|
+
this.closest(".field").remove()
|
|
78
|
+
context.afterPanelDelete()
|
|
79
|
+
})
|
|
80
|
+
}
|
|
77
81
|
|
|
78
82
|
this.afterPanelRender(data, panel)
|
|
79
83
|
|
|
@@ -22,10 +22,9 @@ SirTrevor.Blocks.BrowseGroupCategories = (function () {
|
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
autocomplete_url: function () {
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.autocompleteExhibitBrowseGroupsPath
|
|
25
|
+
return this.instance().closest(
|
|
26
|
+
"form[data-autocomplete-exhibit-browse-groups-path]",
|
|
27
|
+
).dataset.autocompleteExhibitBrowseGroupsPath
|
|
29
28
|
},
|
|
30
29
|
autocomplete_fetch: function (url) {
|
|
31
30
|
return this.fetchOnceAndFilterLocalResults(url)
|
|
@@ -64,14 +63,19 @@ SirTrevor.Blocks.BrowseGroupCategories = (function () {
|
|
|
64
63
|
</div>
|
|
65
64
|
</li>`
|
|
66
65
|
|
|
67
|
-
const
|
|
66
|
+
const tempDiv = document.createElement("div")
|
|
67
|
+
tempDiv.innerHTML = markup.trim()
|
|
68
|
+
const panel = tempDiv.firstElementChild
|
|
68
69
|
var context = this
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const removeLink = panel.querySelector("a[data-item-grid-panel-remove]")
|
|
72
|
+
if (removeLink) {
|
|
73
|
+
removeLink.addEventListener("click", function (e) {
|
|
74
|
+
e.preventDefault()
|
|
75
|
+
this.closest(".field").remove()
|
|
76
|
+
context.afterPanelDelete()
|
|
77
|
+
})
|
|
78
|
+
}
|
|
75
79
|
|
|
76
80
|
this.afterPanelRender(data, panel)
|
|
77
81
|
|
|
@@ -6,13 +6,14 @@ SirTrevor.Blocks.FeaturedPages = (function () {
|
|
|
6
6
|
|
|
7
7
|
icon_name: "pages",
|
|
8
8
|
|
|
9
|
+
blockGroup: "undefined",
|
|
10
|
+
|
|
9
11
|
show_image_selection: false,
|
|
10
12
|
|
|
11
13
|
autocomplete_url: function () {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.autocompleteExhibitPagesPath
|
|
14
|
+
return this.instance().closest(
|
|
15
|
+
"form[data-autocomplete-exhibit-pages-path]",
|
|
16
|
+
).dataset.autocompleteExhibitPagesPath
|
|
16
17
|
},
|
|
17
18
|
autocomplete_fetch: function (url) {
|
|
18
19
|
return this.fetchOnceAndFilterLocalResults(url)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Core from "spotlight/core"
|
|
2
2
|
import SpotlightNestable from "spotlight/admin/spotlight_nestable"
|
|
3
|
+
import { selectRelatedInput } from "spotlight/admin/select_related_input"
|
|
3
4
|
|
|
4
5
|
Core.Block.Resources = (function () {
|
|
5
6
|
return Core.Block.extend({
|
|
@@ -71,8 +72,8 @@ Core.Block.Resources = (function () {
|
|
|
71
72
|
// If image selection is not possible for this block, then do not show
|
|
72
73
|
// image selection link
|
|
73
74
|
if (!this.show_image_selection) return ``
|
|
74
|
-
var
|
|
75
|
-
|
|
75
|
+
var formEl = document.querySelector("form[data-exhibit-path]")
|
|
76
|
+
var url = (formEl ? formEl.dataset.exhibitPath : "") + "/select_image?"
|
|
76
77
|
var markup = `
|
|
77
78
|
<a name="selectimage" href="${url}block_item_id=${block_item_id}&index_id=${index}" data-blacklight-modal="trigger">Select image area</a>
|
|
78
79
|
`
|
|
@@ -128,14 +129,19 @@ Core.Block.Resources = (function () {
|
|
|
128
129
|
</li>
|
|
129
130
|
`
|
|
130
131
|
|
|
131
|
-
const
|
|
132
|
+
const tempDiv = document.createElement("div")
|
|
133
|
+
tempDiv.innerHTML = markup.trim()
|
|
134
|
+
const panel = tempDiv.firstElementChild
|
|
132
135
|
var context = this
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const removeLink = panel.querySelector(".remove a")
|
|
138
|
+
if (removeLink) {
|
|
139
|
+
removeLink.addEventListener("click", function (e) {
|
|
140
|
+
e.preventDefault()
|
|
141
|
+
this.closest(".field").remove()
|
|
142
|
+
context.afterPanelDelete()
|
|
143
|
+
})
|
|
144
|
+
}
|
|
139
145
|
|
|
140
146
|
this.afterPanelRender(data, panel)
|
|
141
147
|
|
|
@@ -149,8 +155,11 @@ Core.Block.Resources = (function () {
|
|
|
149
155
|
createItemPanel: function (data) {
|
|
150
156
|
var panel = this._itemPanel(data)
|
|
151
157
|
this.attachAltTextHandlers(panel)
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
const ol = this.inner.querySelector(".panels > ol")
|
|
159
|
+
if (ol) ol.appendChild(panel)
|
|
160
|
+
const nestable = this.inner.querySelector('[data-behavior="nestable"]')
|
|
161
|
+
if (nestable)
|
|
162
|
+
nestable.dispatchEvent(new Event("change", { bubbles: true }))
|
|
154
163
|
},
|
|
155
164
|
|
|
156
165
|
item_options: function () {
|
|
@@ -237,53 +246,64 @@ Core.Block.Resources = (function () {
|
|
|
237
246
|
|
|
238
247
|
attachAltTextHandlers: function (panel) {
|
|
239
248
|
if (this.showAltText()) {
|
|
240
|
-
const decorativeCheckbox =
|
|
241
|
-
|
|
242
|
-
|
|
249
|
+
const decorativeCheckbox = panel.querySelector(
|
|
250
|
+
'input[name$="[decorative]"]',
|
|
251
|
+
)
|
|
252
|
+
const altTextInput = panel.querySelector('textarea[name$="[alt_text]"]')
|
|
253
|
+
const altTextBackupInput = panel.querySelector(
|
|
254
|
+
'input[name$="[alt_text_backup]"]',
|
|
255
|
+
)
|
|
243
256
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
257
|
+
if (decorativeCheckbox) {
|
|
258
|
+
decorativeCheckbox.addEventListener("change", function () {
|
|
259
|
+
const isDecorative = this.checked
|
|
260
|
+
if (isDecorative) {
|
|
261
|
+
if (altTextBackupInput)
|
|
262
|
+
altTextBackupInput.value = altTextInput.value
|
|
263
|
+
altTextInput.value = ""
|
|
264
|
+
} else {
|
|
265
|
+
if (altTextBackupInput)
|
|
266
|
+
altTextInput.value = altTextBackupInput.value
|
|
267
|
+
}
|
|
268
|
+
altTextInput.disabled = isDecorative
|
|
269
|
+
altTextInput.setAttribute(
|
|
255
270
|
"placeholder",
|
|
256
271
|
isDecorative
|
|
257
272
|
? ""
|
|
258
273
|
: i18n.t("blocks:resources:alt_text:placeholder"),
|
|
259
274
|
)
|
|
260
|
-
|
|
275
|
+
})
|
|
276
|
+
}
|
|
261
277
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
278
|
+
if (altTextInput) {
|
|
279
|
+
altTextInput.addEventListener("input", function () {
|
|
280
|
+
this.dataset.lastValue = this.value
|
|
281
|
+
})
|
|
282
|
+
}
|
|
265
283
|
}
|
|
266
284
|
},
|
|
267
285
|
|
|
268
286
|
onBlockRender: function () {
|
|
269
|
-
SpotlightNestable.init(
|
|
270
|
-
|
|
287
|
+
SpotlightNestable.init(
|
|
288
|
+
this.inner.querySelectorAll('[data-behavior="nestable"]'),
|
|
289
|
+
)
|
|
290
|
+
selectRelatedInput(
|
|
291
|
+
this.inner.querySelectorAll("[data-input-select-target]"),
|
|
292
|
+
)
|
|
271
293
|
},
|
|
272
294
|
|
|
273
295
|
afterLoadData: function (data) {
|
|
274
296
|
var context = this
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
function (index, item) {
|
|
297
|
+
Object.keys(data.item || {})
|
|
298
|
+
.map(function (k) {
|
|
299
|
+
return data.item[k]
|
|
300
|
+
})
|
|
301
|
+
.sort(function (a, b) {
|
|
302
|
+
return a.weight - b.weight
|
|
303
|
+
})
|
|
304
|
+
.forEach(function (item) {
|
|
284
305
|
context.createItemPanel(item)
|
|
285
|
-
}
|
|
286
|
-
)
|
|
306
|
+
})
|
|
287
307
|
},
|
|
288
308
|
})
|
|
289
309
|
})()
|
|
@@ -14,26 +14,43 @@ SirTrevor.Blocks.SearchResults = (function () {
|
|
|
14
14
|
|
|
15
15
|
item_options: function () {
|
|
16
16
|
var block = this
|
|
17
|
-
var
|
|
18
|
-
"blacklight-configuration-search-views",
|
|
17
|
+
var element = document.querySelector(
|
|
18
|
+
"[data-blacklight-configuration-search-views]",
|
|
19
19
|
)
|
|
20
|
+
var fieldsData = element
|
|
21
|
+
? element.dataset.blacklightConfigurationSearchViews
|
|
22
|
+
: null
|
|
23
|
+
var fields = []
|
|
24
|
+
if (fieldsData) {
|
|
25
|
+
try {
|
|
26
|
+
fields = JSON.parse(fieldsData)
|
|
27
|
+
} catch {
|
|
28
|
+
// ignore parse errors
|
|
29
|
+
}
|
|
30
|
+
}
|
|
20
31
|
|
|
21
|
-
return
|
|
22
|
-
|
|
32
|
+
return fields
|
|
33
|
+
.map(function (field) {
|
|
34
|
+
return `<div>
|
|
23
35
|
<label for='${block.formId(block.view_key + field.key)}'>
|
|
24
36
|
<input id='${block.formId(block.view_key + field.key)}' name='${block.view_key}[]' type='checkbox' value='${field.key}' />
|
|
25
37
|
${field.label}
|
|
26
38
|
</label>
|
|
27
39
|
</div>`
|
|
28
|
-
|
|
40
|
+
})
|
|
41
|
+
.join("\n")
|
|
29
42
|
},
|
|
30
43
|
|
|
31
44
|
afterPanelRender: function (_data, _panel) {
|
|
32
|
-
|
|
45
|
+
this.inner.querySelectorAll(".item-input-field").forEach(function (el) {
|
|
46
|
+
el.disabled = true
|
|
47
|
+
})
|
|
33
48
|
},
|
|
34
49
|
|
|
35
50
|
afterPanelDelete: function () {
|
|
36
|
-
|
|
51
|
+
this.inner.querySelectorAll(".item-input-field").forEach(function (el) {
|
|
52
|
+
el.disabled = false
|
|
53
|
+
})
|
|
37
54
|
},
|
|
38
55
|
})
|
|
39
56
|
})()
|