blacklight-spotlight 5.2.4 → 5.3.1
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 +25 -5
- data/app/assets/javascripts/spotlight/spotlight.esm.js +1679 -1228
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +1682 -1231
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_spotlight.scss +0 -2
- data/app/components/spotlight/analytics/aggregation_component.html.erb +1 -1
- data/app/components/spotlight/document_admin_table_component.html.erb +2 -2
- data/app/components/spotlight/edit_view_links_component.html.erb +1 -1
- data/app/components/spotlight/header_component.html.erb +1 -1
- data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
- data/app/components/spotlight/tag_selector_component.html.erb +2 -2
- data/app/components/spotlight/translations/subheading_component.html.erb +1 -1
- data/app/controllers/spotlight/bulk_actions_controller.rb +2 -2
- data/app/controllers/spotlight/bulk_updates_controller.rb +2 -2
- data/app/controllers/spotlight/catalog_controller.rb +2 -2
- data/app/controllers/spotlight/contact_forms_controller.rb +1 -1
- data/app/controllers/spotlight/exhibits_controller.rb +1 -1
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -1
- data/app/controllers/spotlight/resources_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +3 -4
- data/app/controllers/spotlight/solr_controller.rb +1 -1
- data/app/controllers/spotlight/tags_controller.rb +1 -1
- data/app/controllers/spotlight/versions_controller.rb +1 -1
- data/app/javascript/spotlight/admin/add_another.js +22 -15
- data/app/javascript/spotlight/admin/add_image_selector.js +27 -25
- data/app/javascript/spotlight/admin/add_new_button.js +47 -43
- data/app/javascript/spotlight/admin/blacklight_configuration.js +52 -38
- data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +68 -60
- data/app/javascript/spotlight/admin/block_mixins/formable.js +55 -47
- data/app/javascript/spotlight/admin/block_mixins/plustextable.js +19 -20
- data/app/javascript/spotlight/admin/blocks/block.js +20 -16
- data/app/javascript/spotlight/admin/blocks/browse_block.js +42 -37
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +33 -31
- data/app/javascript/spotlight/admin/blocks/iframe_block.js +14 -11
- data/app/javascript/spotlight/admin/blocks/link_to_search_block.js +4 -7
- data/app/javascript/spotlight/admin/blocks/oembed_block.js +13 -10
- data/app/javascript/spotlight/admin/blocks/pages_block.js +20 -13
- data/app/javascript/spotlight/admin/blocks/resources_block.js +150 -117
- data/app/javascript/spotlight/admin/blocks/rule_block.js +11 -10
- data/app/javascript/spotlight/admin/blocks/search_result_block.js +16 -17
- data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +123 -64
- data/app/javascript/spotlight/admin/blocks/solr_documents_block.js +8 -8
- data/app/javascript/spotlight/admin/blocks/solr_documents_carousel_block.js +63 -43
- data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +9 -9
- data/app/javascript/spotlight/admin/blocks/solr_documents_features_block.js +17 -16
- data/app/javascript/spotlight/admin/blocks/solr_documents_grid_block.js +6 -7
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +84 -64
- data/app/javascript/spotlight/admin/crop.js +203 -156
- data/app/javascript/spotlight/admin/croppable.js +4 -4
- data/app/javascript/spotlight/admin/croppable_modal.js +59 -37
- data/app/javascript/spotlight/admin/edit_in_place.js +50 -47
- data/app/javascript/spotlight/admin/exhibits.js +52 -41
- data/app/javascript/spotlight/admin/form_observer.js +59 -53
- data/app/javascript/spotlight/admin/iiif.js +26 -25
- data/app/javascript/spotlight/admin/index.js +44 -47
- data/app/javascript/spotlight/admin/locks.js +14 -14
- data/app/javascript/spotlight/admin/multi_image_selector.js +127 -111
- data/app/javascript/spotlight/admin/pages.js +21 -21
- data/app/javascript/spotlight/admin/progress_monitor.js +67 -65
- data/app/javascript/spotlight/admin/readonly_checkbox.js +3 -3
- data/app/javascript/spotlight/admin/search_typeahead.js +55 -43
- data/app/javascript/spotlight/admin/select_related_input.js +17 -17
- data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +100 -84
- data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +36 -31
- data/app/javascript/spotlight/admin/sir-trevor/locales.js +52 -39
- data/app/javascript/spotlight/admin/spotlight_nestable.js +112 -90
- data/app/javascript/spotlight/admin/tabs.js +16 -3
- data/app/javascript/spotlight/admin/translation_progress.js +13 -7
- data/app/javascript/spotlight/admin/users.js +41 -41
- data/app/javascript/spotlight/admin/visibility_toggle.js +4 -4
- data/app/javascript/spotlight/controllers/clipboard_controller.js +14 -0
- data/app/javascript/spotlight/controllers/index.js +4 -2
- data/app/javascript/spotlight/controllers/tag_selector_controller.js +116 -79
- data/app/javascript/spotlight/core.js +18 -15
- data/app/javascript/spotlight/index.js +4 -4
- data/app/javascript/spotlight/user/browse_group_categories.js +24 -22
- data/app/javascript/spotlight/user/carousel.js +23 -19
- data/app/javascript/spotlight/user/clear_form_button.js +15 -15
- data/app/javascript/spotlight/user/index.js +4 -4
- data/app/javascript/spotlight/user/zpr_links.js +18 -18
- data/app/models/spotlight/analytics/ga.rb +0 -1
- data/app/models/spotlight/custom_field.rb +1 -1
- data/app/models/spotlight/resources/iiif_manifest_v3.rb +2 -2
- data/app/services/spotlight/exhibit_import_export_service.rb +0 -2
- data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
- data/app/views/catalog/_remove_tags.html.erb +1 -1
- data/app/views/layouts/spotlight/base.html.erb +1 -1
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/app/views/shared/_masthead.html.erb +2 -2
- data/app/views/shared/_site_sidebar.html.erb +1 -1
- data/app/views/shared/_user_util_links.html.erb +2 -2
- data/app/views/spotlight/about_pages/_contacts.html.erb +1 -1
- data/app/views/spotlight/accessibility/alt_text.html.erb +1 -1
- data/app/views/spotlight/admin_users/index.html.erb +11 -9
- data/app/views/spotlight/appearances/edit.html.erb +1 -1
- data/app/views/spotlight/browse/_search_box.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_download.html.erb +1 -1
- data/app/views/spotlight/bulk_updates/_progress_panel.html.erb +6 -6
- data/app/views/spotlight/bulk_updates/edit.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_header.html.erb +1 -1
- data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_curation_mode_toggle_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_document.html.erb +2 -2
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_sidecar.html.erb +1 -1
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
- data/app/views/spotlight/catalog/_reindex_progress_panel.html.erb +6 -6
- data/app/views/spotlight/catalog/select_image.html.erb +1 -1
- data/app/views/spotlight/contact_mailer/report_problem.html.erb +2 -2
- data/app/views/spotlight/exhibits/_contact.html.erb +2 -2
- data/app/views/spotlight/exhibits/_delete.html.erb +2 -2
- data/app/views/spotlight/exhibits/_exhibit_card.html.erb +1 -1
- data/app/views/spotlight/exhibits/_export.html.erb +1 -1
- data/app/views/spotlight/exhibits/_form.html.erb +2 -2
- data/app/views/spotlight/exhibits/_languages.html.erb +7 -7
- data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
- data/app/views/spotlight/locks/_lock.html.erb +2 -2
- data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
- data/app/views/spotlight/pages/_order_pages.html.erb +3 -3
- data/app/views/spotlight/pages/preview.html.erb +1 -1
- data/app/views/spotlight/pages/show.html.erb +2 -2
- data/app/views/spotlight/resources/_form.html.erb +1 -1
- data/app/views/spotlight/resources/csv_upload/_form.html.erb +1 -1
- data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
- data/app/views/spotlight/roles/index.html.erb +5 -5
- data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
- data/app/views/spotlight/search_configurations/edit.html.erb +1 -1
- data/app/views/spotlight/searches/index.html.erb +2 -2
- data/app/views/spotlight/shared/_configuration_sidebar.html.erb +1 -1
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +1 -1
- data/app/views/spotlight/shared/_dd3_item.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/_sir_trevor_block_array.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_rule_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +1 -1
- data/app/views/spotlight/sites/edit_exhibits.html.erb +3 -3
- data/app/views/spotlight/translations/_browse_categories.html.erb +2 -2
- data/app/views/spotlight/translations/_general.html.erb +21 -21
- data/app/views/spotlight/translations/_groups.html.erb +1 -1
- data/app/views/spotlight/translations/_metadata.html.erb +8 -8
- data/app/views/spotlight/translations/_pages_table.html.erb +2 -2
- data/app/views/spotlight/translations/_search_fields.html.erb +13 -13
- data/app/views/spotlight/translations/edit.html.erb +5 -5
- data/config/importmap.rb +0 -1
- data/lib/generators/spotlight/assets/propshaft_generator.rb +0 -1
- data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -31
- data/lib/spotlight/version.rb +1 -1
- data/spec/factories/contact_images.rb +1 -1
- data/spec/factories/exhibit_thumbnails.rb +1 -1
- data/spec/factories/featured_images.rb +1 -1
- data/spec/support/features/test_features_helpers.rb +12 -3
- metadata +12 -64
- data/app/assets/stylesheets/spotlight/typeahead.scss +0 -77
- data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
- data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
|
@@ -7,24 +7,27 @@
|
|
|
7
7
|
and displays them.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
SirTrevor.Blocks.Iframe = (function(){
|
|
11
|
-
|
|
10
|
+
SirTrevor.Blocks.Iframe = (function () {
|
|
12
11
|
return SirTrevor.Block.extend({
|
|
13
12
|
type: "Iframe",
|
|
14
13
|
formable: true,
|
|
15
|
-
|
|
16
|
-
title: function() {
|
|
17
|
-
|
|
14
|
+
|
|
15
|
+
title: function () {
|
|
16
|
+
return i18n.t("blocks:iframe:title")
|
|
17
|
+
},
|
|
18
|
+
description: function () {
|
|
19
|
+
return i18n.t("blocks:iframe:description")
|
|
20
|
+
},
|
|
18
21
|
|
|
19
22
|
icon_name: "iframe",
|
|
20
|
-
|
|
21
|
-
editorHTML: function() {
|
|
23
|
+
|
|
24
|
+
editorHTML: function () {
|
|
22
25
|
return `<div class="clearfix">
|
|
23
26
|
<div class="widget-header">
|
|
24
27
|
${this.description()}
|
|
25
28
|
</div>
|
|
26
29
|
<textarea name="code" class="form-control" rows="5" placeholder="${i18n.t("blocks:iframe:placeholder")}"></textarea>
|
|
27
|
-
</div
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
})()
|
|
30
|
+
</div>`
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
})()
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
SirTrevor.Blocks.LinkToSearch = (function(){
|
|
2
|
-
|
|
1
|
+
SirTrevor.Blocks.LinkToSearch = (function () {
|
|
3
2
|
return SirTrevor.Blocks.Browse.extend({
|
|
4
|
-
|
|
5
3
|
type: "link_to_search",
|
|
6
4
|
|
|
7
|
-
icon_name:
|
|
5
|
+
icon_name: "search_results",
|
|
8
6
|
|
|
9
7
|
searches_key: "slug",
|
|
10
8
|
view_key: "view",
|
|
11
9
|
plustextable: false,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})();
|
|
10
|
+
})
|
|
11
|
+
})()
|
|
@@ -6,19 +6,22 @@
|
|
|
6
6
|
and any provided text
|
|
7
7
|
and displays them.
|
|
8
8
|
*/
|
|
9
|
-
import Core from
|
|
10
|
-
|
|
11
|
-
SirTrevor.Blocks.Oembed = (function(){
|
|
9
|
+
import Core from "spotlight/core"
|
|
12
10
|
|
|
11
|
+
SirTrevor.Blocks.Oembed = (function () {
|
|
13
12
|
return Core.Block.extend({
|
|
14
13
|
plustextable: true,
|
|
15
14
|
|
|
16
|
-
id_key:"url",
|
|
15
|
+
id_key: "url",
|
|
17
16
|
|
|
18
17
|
type: "oembed",
|
|
19
|
-
|
|
20
|
-
title: function() {
|
|
21
|
-
|
|
18
|
+
|
|
19
|
+
title: function () {
|
|
20
|
+
return i18n.t("blocks:oembed:title")
|
|
21
|
+
},
|
|
22
|
+
description: function () {
|
|
23
|
+
return i18n.t("blocks:oembed:description")
|
|
24
|
+
},
|
|
22
25
|
|
|
23
26
|
icon_name: "oembed",
|
|
24
27
|
show_heading: false,
|
|
@@ -36,6 +39,6 @@ SirTrevor.Blocks.Oembed = (function(){
|
|
|
36
39
|
</div>
|
|
37
40
|
${this.text_area()}
|
|
38
41
|
</div>`
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
})()
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
})()
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import Core from
|
|
2
|
-
|
|
3
|
-
SirTrevor.Blocks.FeaturedPages = (function(){
|
|
1
|
+
import Core from "spotlight/core"
|
|
4
2
|
|
|
3
|
+
SirTrevor.Blocks.FeaturedPages = (function () {
|
|
5
4
|
return Core.Block.Resources.extend({
|
|
6
5
|
type: "featured_pages",
|
|
7
6
|
|
|
@@ -9,16 +8,24 @@ SirTrevor.Blocks.FeaturedPages = (function(){
|
|
|
9
8
|
|
|
10
9
|
show_image_selection: false,
|
|
11
10
|
|
|
12
|
-
autocomplete_url: function() {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
autocomplete_url: function () {
|
|
12
|
+
return document
|
|
13
|
+
.getElementById(this.instanceID)
|
|
14
|
+
.closest("form[data-autocomplete-exhibit-pages-path]").dataset
|
|
15
|
+
.autocompleteExhibitPagesPath
|
|
16
|
+
},
|
|
17
|
+
autocomplete_fetch: function (url) {
|
|
18
|
+
return this.fetchOnceAndFilterLocalResults(url)
|
|
15
19
|
},
|
|
16
|
-
autocomplete_template: function(obj) {
|
|
17
|
-
const description = obj.description
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
autocomplete_template: function (obj) {
|
|
21
|
+
const description = obj.description
|
|
22
|
+
? `<small> ${obj.description}</small>`
|
|
23
|
+
: ""
|
|
24
|
+
const thumbnail = obj.thumbnail_image_url
|
|
25
|
+
? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail_image_url}" /></div>`
|
|
26
|
+
: ""
|
|
27
|
+
return `<div class="autocomplete-item${!obj.published ? " blacklight-private" : ""}">${thumbnail}
|
|
20
28
|
<span class="autocomplete-title">${this.highlight(obj.title)}</span><br/>${description}</div>`
|
|
21
29
|
},
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
})();
|
|
30
|
+
})
|
|
31
|
+
})()
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import Core from
|
|
2
|
-
import SpotlightNestable from
|
|
3
|
-
|
|
4
|
-
Core.Block.Resources = (function(){
|
|
1
|
+
import Core from "spotlight/core"
|
|
2
|
+
import SpotlightNestable from "spotlight/admin/spotlight_nestable"
|
|
5
3
|
|
|
4
|
+
Core.Block.Resources = (function () {
|
|
6
5
|
return Core.Block.extend({
|
|
7
6
|
type: "resources",
|
|
8
7
|
formable: true,
|
|
9
8
|
autocompleteable: true,
|
|
10
9
|
show_heading: true,
|
|
11
10
|
show_image_selection: true,
|
|
12
|
-
title: function() {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
title: function () {
|
|
12
|
+
return i18n.t("blocks:" + this.type + ":title")
|
|
13
|
+
},
|
|
14
|
+
description: function () {
|
|
15
|
+
return i18n.t("blocks:" + this.type + ":description")
|
|
16
|
+
},
|
|
17
|
+
alt_text_guidelines: function () {
|
|
15
18
|
if (this.showAltText()) {
|
|
16
|
-
return i18n.t("blocks:alt_text_guidelines:intro")
|
|
19
|
+
return i18n.t("blocks:alt_text_guidelines:intro")
|
|
17
20
|
}
|
|
18
|
-
return ""
|
|
21
|
+
return ""
|
|
19
22
|
},
|
|
20
|
-
alt_text_guidelines_link: function() {
|
|
23
|
+
alt_text_guidelines_link: function () {
|
|
21
24
|
if (this.showAltText()) {
|
|
22
|
-
var link_url = i18n.t("blocks:alt_text_guidelines:link_url")
|
|
23
|
-
var link_label = i18n.t("blocks:alt_text_guidelines:link_label")
|
|
24
|
-
return
|
|
25
|
+
var link_url = i18n.t("blocks:alt_text_guidelines:link_url")
|
|
26
|
+
var link_label = i18n.t("blocks:alt_text_guidelines:link_label")
|
|
27
|
+
return (
|
|
28
|
+
'<a target="_blank" href="' + link_url + '">' + link_label + "</a>"
|
|
29
|
+
)
|
|
25
30
|
}
|
|
26
|
-
return ""
|
|
31
|
+
return ""
|
|
27
32
|
},
|
|
28
33
|
icon_name: "resources",
|
|
29
|
-
blockGroup: function() {
|
|
34
|
+
blockGroup: function () {
|
|
35
|
+
return i18n.t("blocks:group:items")
|
|
36
|
+
},
|
|
30
37
|
|
|
31
38
|
primary_field_key: "primary-caption-field",
|
|
32
39
|
show_primary_field_key: "show-primary-caption",
|
|
@@ -39,47 +46,48 @@ Core.Block.Resources = (function(){
|
|
|
39
46
|
|
|
40
47
|
globalIndex: 0,
|
|
41
48
|
|
|
42
|
-
_itemPanelIiifFields: function(
|
|
43
|
-
return []
|
|
49
|
+
_itemPanelIiifFields: function (_index, _data) {
|
|
50
|
+
return []
|
|
44
51
|
},
|
|
45
52
|
|
|
46
|
-
_altTextFieldsHTML: function(index, data) {
|
|
53
|
+
_altTextFieldsHTML: function (index, data) {
|
|
47
54
|
if (this.showAltText()) {
|
|
48
|
-
return this.altTextHTML(index, data)
|
|
55
|
+
return this.altTextHTML(index, data)
|
|
49
56
|
}
|
|
50
|
-
return ""
|
|
57
|
+
return ""
|
|
51
58
|
},
|
|
52
59
|
|
|
53
|
-
showAltText: function() {
|
|
60
|
+
showAltText: function () {
|
|
54
61
|
return this.editorOptions.altTextSettings[this._typeAsCamelCase()]
|
|
55
62
|
},
|
|
56
63
|
|
|
57
|
-
_typeAsCamelCase: function() {
|
|
64
|
+
_typeAsCamelCase: function () {
|
|
58
65
|
return this.type
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
.split("_")
|
|
67
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
68
|
+
.join("")
|
|
62
69
|
},
|
|
63
|
-
_itemSelectImageLink: function(block_item_id, doc_id, index) {
|
|
70
|
+
_itemSelectImageLink: function (block_item_id, doc_id, index) {
|
|
64
71
|
// If image selection is not possible for this block, then do not show
|
|
65
72
|
// image selection link
|
|
66
|
-
if (!this.show_image_selection) return
|
|
67
|
-
var url =
|
|
73
|
+
if (!this.show_image_selection) return ``
|
|
74
|
+
var url =
|
|
75
|
+
$("form[data-exhibit-path]").data("exhibit-path") + "/select_image?"
|
|
68
76
|
var markup = `
|
|
69
77
|
<a name="selectimage" href="${url}block_item_id=${block_item_id}&index_id=${index}" data-blacklight-modal="trigger">Select image area</a>
|
|
70
|
-
|
|
71
|
-
return markup
|
|
78
|
+
`
|
|
79
|
+
return markup
|
|
72
80
|
},
|
|
73
|
-
_itemPanel: function(data) {
|
|
74
|
-
var index = "item_" + this.globalIndex
|
|
75
|
-
var checked
|
|
81
|
+
_itemPanel: function (data) {
|
|
82
|
+
var index = "item_" + this.globalIndex++
|
|
83
|
+
var checked
|
|
76
84
|
if (data.display == "true") {
|
|
77
85
|
checked = "checked='checked'"
|
|
78
86
|
} else {
|
|
79
|
-
checked = ""
|
|
87
|
+
checked = ""
|
|
80
88
|
}
|
|
81
|
-
var resource_id = data.slug || data.id
|
|
82
|
-
var block_item_id = this.formId(index)
|
|
89
|
+
var resource_id = data.slug || data.id
|
|
90
|
+
var block_item_id = this.formId(index)
|
|
83
91
|
var markup = `
|
|
84
92
|
<li class="field dd-item dd3-item" data-cropper="select_image_${block_item_id}" data-resource-id="${resource_id}" data-id="${index}" id="${block_item_id}" data-input-prefix="item[${index}]">
|
|
85
93
|
<input type="hidden" name="item[${index}][id]" value="${resource_id}" />
|
|
@@ -94,20 +102,20 @@ Core.Block.Resources = (function(){
|
|
|
94
102
|
<div class="d-flex">
|
|
95
103
|
<div class="checkbox">
|
|
96
104
|
<input name="item[${index}][display]" type="hidden" value="false" />
|
|
97
|
-
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox +
|
|
98
|
-
<label class="visually-hidden" for="${this.formId(this.display_checkbox +
|
|
105
|
+
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox + "_" + data.id)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
|
|
106
|
+
<label class="visually-hidden" for="${this.formId(this.display_checkbox + "_" + data.id)}">${i18n.t("blocks:resources:panel:display")}</label>
|
|
99
107
|
</div>
|
|
100
108
|
<div class="pic">
|
|
101
|
-
<img class="img-thumbnail" src="${
|
|
109
|
+
<img class="img-thumbnail" src="${data.thumbnail_image_url || (data.iiif_tilesource || "").replace("/info.json", "/full/!100,100/0/default.jpg")}" />
|
|
102
110
|
</div>
|
|
103
111
|
</div>
|
|
104
112
|
<div class="d-inline-block">
|
|
105
|
-
${this._itemSelectImageLink(block_item_id,data.id, index)}
|
|
113
|
+
${this._itemSelectImageLink(block_item_id, data.id, index)}
|
|
106
114
|
</div>
|
|
107
115
|
</div>
|
|
108
116
|
<div class="main">
|
|
109
117
|
<div class="title card-title">${data.title}</div>
|
|
110
|
-
<div>${
|
|
118
|
+
<div>${data.slug || data.id}</div>
|
|
111
119
|
${this._altTextFieldsHTML(index, data)}
|
|
112
120
|
</div>
|
|
113
121
|
<div class="remove float-end">
|
|
@@ -120,61 +128,60 @@ Core.Block.Resources = (function(){
|
|
|
120
128
|
</li>
|
|
121
129
|
`
|
|
122
130
|
|
|
123
|
-
const panel = $(markup)
|
|
124
|
-
var context = this
|
|
125
|
-
|
|
126
|
-
$('.remove a', panel).on('click', function(e) {
|
|
127
|
-
e.preventDefault();
|
|
128
|
-
$(this).closest('.field').remove();
|
|
129
|
-
context.afterPanelDelete();
|
|
131
|
+
const panel = $(markup)
|
|
132
|
+
var context = this
|
|
130
133
|
|
|
131
|
-
|
|
134
|
+
$(".remove a", panel).on("click", function (e) {
|
|
135
|
+
e.preventDefault()
|
|
136
|
+
$(this).closest(".field").remove()
|
|
137
|
+
context.afterPanelDelete()
|
|
138
|
+
})
|
|
132
139
|
|
|
133
|
-
this.afterPanelRender(data, panel)
|
|
140
|
+
this.afterPanelRender(data, panel)
|
|
134
141
|
|
|
135
|
-
return panel
|
|
142
|
+
return panel
|
|
136
143
|
},
|
|
137
144
|
|
|
138
|
-
afterPanelRender: function(
|
|
139
|
-
|
|
140
|
-
},
|
|
145
|
+
afterPanelRender: function (_data, _panel) {},
|
|
141
146
|
|
|
142
|
-
afterPanelDelete: function() {
|
|
147
|
+
afterPanelDelete: function () {},
|
|
143
148
|
|
|
149
|
+
createItemPanel: function (data) {
|
|
150
|
+
var panel = this._itemPanel(data)
|
|
151
|
+
this.attachAltTextHandlers(panel)
|
|
152
|
+
$(panel).appendTo($(".panels > ol", this.inner))
|
|
153
|
+
$('[data-behavior="nestable"]', this.inner).trigger("change")
|
|
144
154
|
},
|
|
145
155
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.attachAltTextHandlers(panel);
|
|
149
|
-
$(panel).appendTo($('.panels > ol', this.inner));
|
|
150
|
-
$('[data-behavior="nestable"]', this.inner).trigger('change');
|
|
156
|
+
item_options: function () {
|
|
157
|
+
return ""
|
|
151
158
|
},
|
|
152
159
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
content: function() {
|
|
156
|
-
var templates = [this.items_selector()];
|
|
160
|
+
content: function () {
|
|
161
|
+
var templates = [this.items_selector()]
|
|
157
162
|
if (this.plustextable) {
|
|
158
|
-
templates.push(this.text_area())
|
|
163
|
+
templates.push(this.text_area())
|
|
159
164
|
}
|
|
160
|
-
return templates.join("<hr />\n")
|
|
165
|
+
return templates.join("<hr />\n")
|
|
161
166
|
},
|
|
162
167
|
|
|
163
|
-
items_selector: function() {
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
items_selector: function () {
|
|
169
|
+
return [
|
|
170
|
+
'<div class="row">',
|
|
171
|
+
'<div class="col-md-8">',
|
|
166
172
|
'<div class="form-group mb-3">',
|
|
167
173
|
'<div class="panels dd nestable-item-grid" data-behavior="nestable" data-max-depth="1"><ol class="dd-list"></ol></div>',
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
this.autocomplete_control(),
|
|
175
|
+
"</div>",
|
|
176
|
+
"</div>",
|
|
177
|
+
'<div class="col-md-4">',
|
|
172
178
|
this.item_options(),
|
|
173
|
-
|
|
174
|
-
|
|
179
|
+
"</div>",
|
|
180
|
+
"</div>",
|
|
181
|
+
].join("\n")
|
|
175
182
|
},
|
|
176
183
|
|
|
177
|
-
editorHTML: function() {
|
|
184
|
+
editorHTML: function () {
|
|
178
185
|
return `<div class="form resources-admin clearfix">
|
|
179
186
|
<div class="widget-header">
|
|
180
187
|
${this.description()}
|
|
@@ -185,72 +192,98 @@ Core.Block.Resources = (function(){
|
|
|
185
192
|
</div>`
|
|
186
193
|
},
|
|
187
194
|
|
|
188
|
-
_altTextData: function(data) {
|
|
189
|
-
const isDecorative = data.decorative
|
|
190
|
-
const altText = isDecorative ?
|
|
191
|
-
const altTextBackup = data.alt_text_backup ||
|
|
192
|
-
const placeholderAttr = isDecorative
|
|
193
|
-
|
|
195
|
+
_altTextData: function (data) {
|
|
196
|
+
const isDecorative = data.decorative
|
|
197
|
+
const altText = isDecorative ? "" : data.alt_text || ""
|
|
198
|
+
const altTextBackup = data.alt_text_backup || ""
|
|
199
|
+
const placeholderAttr = isDecorative
|
|
200
|
+
? ""
|
|
201
|
+
: `placeholder="${i18n.t("blocks:resources:alt_text:placeholder")}"`
|
|
202
|
+
const disabledAttr = isDecorative ? "disabled" : ""
|
|
194
203
|
|
|
195
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
isDecorative,
|
|
206
|
+
altText,
|
|
207
|
+
altTextBackup,
|
|
208
|
+
placeholderAttr,
|
|
209
|
+
disabledAttr,
|
|
210
|
+
}
|
|
196
211
|
},
|
|
197
212
|
|
|
198
|
-
altTextHTML: function(index, data) {
|
|
199
|
-
const {
|
|
213
|
+
altTextHTML: function (index, data) {
|
|
214
|
+
const {
|
|
215
|
+
isDecorative,
|
|
216
|
+
altText,
|
|
217
|
+
altTextBackup,
|
|
218
|
+
placeholderAttr,
|
|
219
|
+
disabledAttr,
|
|
220
|
+
} = this._altTextData(data)
|
|
200
221
|
return `<div class="mt-2 pt-2 d-flex">
|
|
201
222
|
<div class="me-2">
|
|
202
|
-
<label class="col-form-label pb-0 pt-1" for="${this.formId(this.alt_text_textarea +
|
|
223
|
+
<label class="col-form-label pb-0 pt-1" for="${this.formId(this.alt_text_textarea + "_" + data.id)}">${i18n.t("blocks:resources:alt_text:alternative_text")}</label>
|
|
203
224
|
<div class="form-check mb-1 justify-content-end">
|
|
204
225
|
<input class="form-check-input" type="checkbox"
|
|
205
|
-
id="${this.formId(this.decorative_checkbox +
|
|
206
|
-
<label class="form-check-label" for="${this.formId(this.decorative_checkbox +
|
|
226
|
+
id="${this.formId(this.decorative_checkbox + "_" + data.id)}" name="item[${index}][decorative]" ${isDecorative ? "checked" : ""}>
|
|
227
|
+
<label class="form-check-label" for="${this.formId(this.decorative_checkbox + "_" + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
|
|
207
228
|
</div>
|
|
208
229
|
</div>
|
|
209
230
|
<div class="flex-grow-1 flex-fill d-flex">
|
|
210
231
|
<input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
|
|
211
232
|
<textarea class="form-control w-100" rows="2" ${placeholderAttr}
|
|
212
|
-
id="${this.formId(this.alt_text_textarea +
|
|
233
|
+
id="${this.formId(this.alt_text_textarea + "_" + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
|
|
213
234
|
</div>
|
|
214
235
|
</div>`
|
|
215
236
|
},
|
|
216
237
|
|
|
217
|
-
attachAltTextHandlers: function(panel) {
|
|
238
|
+
attachAltTextHandlers: function (panel) {
|
|
218
239
|
if (this.showAltText()) {
|
|
219
|
-
const decorativeCheckbox = $('input[name$="[decorative]"]', panel)
|
|
220
|
-
const altTextInput = $('textarea[name$="[alt_text]"]', panel)
|
|
221
|
-
const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel)
|
|
240
|
+
const decorativeCheckbox = $('input[name$="[decorative]"]', panel)
|
|
241
|
+
const altTextInput = $('textarea[name$="[alt_text]"]', panel)
|
|
242
|
+
const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel)
|
|
222
243
|
|
|
223
|
-
decorativeCheckbox.on(
|
|
224
|
-
const isDecorative = this.checked
|
|
244
|
+
decorativeCheckbox.on("change", function () {
|
|
245
|
+
const isDecorative = this.checked
|
|
225
246
|
if (isDecorative) {
|
|
226
|
-
altTextBackupInput.val(altTextInput.val())
|
|
227
|
-
altTextInput.val(
|
|
247
|
+
altTextBackupInput.val(altTextInput.val())
|
|
248
|
+
altTextInput.val("")
|
|
228
249
|
} else {
|
|
229
|
-
altTextInput.val(altTextBackupInput.val())
|
|
250
|
+
altTextInput.val(altTextBackupInput.val())
|
|
230
251
|
}
|
|
231
252
|
altTextInput
|
|
232
|
-
.prop(
|
|
233
|
-
.attr(
|
|
234
|
-
|
|
253
|
+
.prop("disabled", isDecorative)
|
|
254
|
+
.attr(
|
|
255
|
+
"placeholder",
|
|
256
|
+
isDecorative
|
|
257
|
+
? ""
|
|
258
|
+
: i18n.t("blocks:resources:alt_text:placeholder"),
|
|
259
|
+
)
|
|
260
|
+
})
|
|
235
261
|
|
|
236
|
-
altTextInput.on(
|
|
237
|
-
$(this).data(
|
|
238
|
-
})
|
|
262
|
+
altTextInput.on("input", function () {
|
|
263
|
+
$(this).data("lastValue", $(this).val())
|
|
264
|
+
})
|
|
239
265
|
}
|
|
240
266
|
},
|
|
241
267
|
|
|
242
|
-
onBlockRender: function() {
|
|
243
|
-
SpotlightNestable.init($('[data-behavior="nestable"]', this.inner))
|
|
244
|
-
$(
|
|
268
|
+
onBlockRender: function () {
|
|
269
|
+
SpotlightNestable.init($('[data-behavior="nestable"]', this.inner))
|
|
270
|
+
$("[data-input-select-target]", this.inner).selectRelatedInput()
|
|
245
271
|
},
|
|
246
272
|
|
|
247
|
-
afterLoadData: function(data) {
|
|
248
|
-
var context = this
|
|
249
|
-
$.each(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
})
|
|
273
|
+
afterLoadData: function (data) {
|
|
274
|
+
var context = this
|
|
275
|
+
$.each(
|
|
276
|
+
Object.keys(data.item || {})
|
|
277
|
+
.map(function (k) {
|
|
278
|
+
return data.item[k]
|
|
279
|
+
})
|
|
280
|
+
.sort(function (a, b) {
|
|
281
|
+
return a.weight - b.weight
|
|
282
|
+
}),
|
|
283
|
+
function (index, item) {
|
|
284
|
+
context.createItemPanel(item)
|
|
285
|
+
},
|
|
286
|
+
)
|
|
287
|
+
},
|
|
288
|
+
})
|
|
289
|
+
})()
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
and displays them.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
SirTrevor.Blocks.Rule = (function(){
|
|
11
|
-
|
|
10
|
+
SirTrevor.Blocks.Rule = (function () {
|
|
12
11
|
return SirTrevor.Block.extend({
|
|
13
12
|
type: "rule",
|
|
14
|
-
|
|
15
|
-
title: function() {
|
|
13
|
+
|
|
14
|
+
title: function () {
|
|
15
|
+
return i18n.t("blocks:rule:title")
|
|
16
|
+
},
|
|
16
17
|
|
|
17
18
|
icon_name: "rule",
|
|
18
|
-
|
|
19
|
-
editorHTML: function() {
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
})()
|
|
19
|
+
|
|
20
|
+
editorHTML: function () {
|
|
21
|
+
return "<hr />"
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
})()
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
SirTrevor.Blocks.SearchResults =
|
|
2
|
-
|
|
1
|
+
SirTrevor.Blocks.SearchResults = (function () {
|
|
3
2
|
return SirTrevor.Blocks.Browse.extend({
|
|
4
|
-
|
|
5
3
|
type: "search_results",
|
|
6
4
|
|
|
7
|
-
icon_name:
|
|
5
|
+
icon_name: "search_results",
|
|
8
6
|
|
|
9
7
|
searches_key: "slug",
|
|
10
8
|
view_key: "view",
|
|
11
9
|
plustextable: false,
|
|
12
10
|
|
|
13
|
-
content: function() {
|
|
11
|
+
content: function () {
|
|
14
12
|
return this.items_selector()
|
|
15
13
|
},
|
|
16
14
|
|
|
17
|
-
item_options: function() {
|
|
18
|
-
var block = this
|
|
19
|
-
var fields = $(
|
|
15
|
+
item_options: function () {
|
|
16
|
+
var block = this
|
|
17
|
+
var fields = $("[data-blacklight-configuration-search-views]").data(
|
|
18
|
+
"blacklight-configuration-search-views",
|
|
19
|
+
)
|
|
20
20
|
|
|
21
|
-
return $.map(fields, function(field) {
|
|
21
|
+
return $.map(fields, function (field) {
|
|
22
22
|
return `<div>
|
|
23
23
|
<label for='${block.formId(block.view_key + field.key)}'>
|
|
24
24
|
<input id='${block.formId(block.view_key + field.key)}' name='${block.view_key}[]' type='checkbox' value='${field.key}' />
|
|
25
25
|
${field.label}
|
|
26
26
|
</label>
|
|
27
27
|
</div>`
|
|
28
|
-
}).join("\n")
|
|
28
|
+
}).join("\n")
|
|
29
29
|
},
|
|
30
30
|
|
|
31
|
-
afterPanelRender: function(
|
|
32
|
-
$(this.inner).find(
|
|
31
|
+
afterPanelRender: function (_data, _panel) {
|
|
32
|
+
$(this.inner).find(".item-input-field").attr("disabled", "disabled")
|
|
33
33
|
},
|
|
34
34
|
|
|
35
|
-
afterPanelDelete: function() {
|
|
36
|
-
$(this.inner).find(
|
|
35
|
+
afterPanelDelete: function () {
|
|
36
|
+
$(this.inner).find(".item-input-field").removeAttr("disabled")
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})();
|
|
38
|
+
})
|
|
39
|
+
})()
|