blacklight-spotlight 5.3.0 → 5.3.2
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 +18 -1
- data/app/assets/javascripts/spotlight/spotlight.esm.js +1696 -1229
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +1718 -1232
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +1 -10
- data/app/assets/stylesheets/spotlight/_nestable.scss +18 -1
- data/app/assets/stylesheets/spotlight/_pages.scss +3 -3
- 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/resources_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 +126 -91
- data/app/javascript/spotlight/admin/tabs.js +19 -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/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 +41 -1
- metadata +4 -61
- data/app/javascript/spotlight/admin/copy_email_addresses.js +0 -7
- data/vendor/assets/javascripts/jquery.waitforimages.min.js +0 -2
|
@@ -1,104 +1,112 @@
|
|
|
1
|
-
import { fetchAutocompleteJSON } from
|
|
2
|
-
|
|
3
|
-
(
|
|
4
|
-
SirTrevor.BlockMixins.Autocompleteable = {
|
|
1
|
+
import { fetchAutocompleteJSON } from "spotlight/admin/search_typeahead"
|
|
2
|
+
;(function ($) {
|
|
3
|
+
;((SirTrevor.BlockMixins.Autocompleteable = {
|
|
5
4
|
mixinName: "Autocompleteable",
|
|
6
5
|
preload: true,
|
|
7
6
|
|
|
8
|
-
initializeAutocompleteable: function() {
|
|
9
|
-
this.on("onRender", this.addAutocompletetoSirTrevorForm)
|
|
7
|
+
initializeAutocompleteable: function () {
|
|
8
|
+
this.on("onRender", this.addAutocompletetoSirTrevorForm)
|
|
10
9
|
|
|
11
|
-
if (this[
|
|
12
|
-
this.autocomplete_url = function() {
|
|
10
|
+
if (this["autocomplete_url"] === undefined) {
|
|
11
|
+
this.autocomplete_url = function () {
|
|
12
|
+
return $("form[data-autocomplete-url]").data("autocomplete-url")
|
|
13
|
+
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
if (this[
|
|
16
|
-
this.autocomplete_fetch = this.fetchAutocompleteResults
|
|
16
|
+
if (this["autocomplete_fetch"] === undefined) {
|
|
17
|
+
this.autocomplete_fetch = this.fetchAutocompleteResults
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
if (this[
|
|
20
|
+
if (this["transform_autocomplete_results"] === undefined) {
|
|
20
21
|
this.transform_autocomplete_results = (val) => val
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
if (this[
|
|
24
|
-
this.highlight = function(value) {
|
|
25
|
-
if (!value) return
|
|
26
|
-
const queryValue = this.getQueryValue().trim()
|
|
27
|
-
return queryValue
|
|
24
|
+
if (this["highlight"] === undefined) {
|
|
25
|
+
this.highlight = function (value) {
|
|
26
|
+
if (!value) return ""
|
|
27
|
+
const queryValue = this.getQueryValue().trim()
|
|
28
|
+
return queryValue
|
|
29
|
+
? value.replace(new RegExp(queryValue, "gi"), "<strong>$&</strong>")
|
|
30
|
+
: value
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
if (this[
|
|
32
|
-
this.autocomplete_control = function() {
|
|
33
|
-
const autocompleteID = this.autocompleteID()
|
|
34
|
+
if (this["autocomplete_control"] === undefined) {
|
|
35
|
+
this.autocomplete_control = function () {
|
|
36
|
+
const autocompleteID = this.autocompleteID()
|
|
34
37
|
return `
|
|
35
38
|
<auto-complete src="${this.autocomplete_url()}" for="${autocompleteID}-popup" fetch-on-empty>
|
|
36
39
|
<input type="text" name="${autocompleteID}" placeholder="${i18n.t("blocks:autocompleteable:placeholder")}" data-default-typeahead>
|
|
37
40
|
<ul id="${autocompleteID}-popup"></ul>
|
|
38
41
|
<div id="${autocompleteID}-popup-feedback" class="visually-hidden"></div>
|
|
39
42
|
</auto-complete>
|
|
40
|
-
`
|
|
43
|
+
`
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
if (this[
|
|
44
|
-
this.autocomplete_element_template = function(item) {
|
|
47
|
+
if (this["autocomplete_element_template"] === undefined) {
|
|
48
|
+
this.autocomplete_element_template = function (item) {
|
|
45
49
|
return `<li role="option" data-autocomplete-value="${item.id}">${this.autocomplete_template(item)}</li>`
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
|
|
50
|
-
queryTokenizer: function(query) {
|
|
51
|
-
return query.trim().toLowerCase().split(/\s+/).filter(Boolean)
|
|
54
|
+
queryTokenizer: function (query) {
|
|
55
|
+
return query.trim().toLowerCase().split(/\s+/).filter(Boolean)
|
|
52
56
|
},
|
|
53
57
|
|
|
54
|
-
filterResults: function(data, query) {
|
|
55
|
-
const queryStrings = this.queryTokenizer(query)
|
|
56
|
-
return data.filter(item => {
|
|
57
|
-
const lowerTitle = item.title.toLowerCase()
|
|
58
|
-
return queryStrings.some(queryString =>
|
|
59
|
-
|
|
58
|
+
filterResults: function (data, query) {
|
|
59
|
+
const queryStrings = this.queryTokenizer(query)
|
|
60
|
+
return data.filter((item) => {
|
|
61
|
+
const lowerTitle = item.title.toLowerCase()
|
|
62
|
+
return queryStrings.some((queryString) =>
|
|
63
|
+
lowerTitle.includes(queryString),
|
|
64
|
+
)
|
|
65
|
+
})
|
|
60
66
|
},
|
|
61
67
|
|
|
62
|
-
fetchAutocompleteResults: async function(url) {
|
|
63
|
-
const result = await fetchAutocompleteJSON(url)
|
|
64
|
-
const transformed = this.transform_autocomplete_results(result)
|
|
65
|
-
this.fetchedData = {}
|
|
66
|
-
transformed.map(item => this.fetchedData[item.id] = item)
|
|
67
|
-
return transformed
|
|
68
|
+
fetchAutocompleteResults: async function (url) {
|
|
69
|
+
const result = await fetchAutocompleteJSON(url)
|
|
70
|
+
const transformed = this.transform_autocomplete_results(result)
|
|
71
|
+
this.fetchedData = {}
|
|
72
|
+
transformed.map((item) => (this.fetchedData[item.id] = item))
|
|
73
|
+
return transformed
|
|
74
|
+
.map((item) => this.autocomplete_element_template(item))
|
|
75
|
+
.join("")
|
|
68
76
|
},
|
|
69
77
|
|
|
70
|
-
fetchOnceAndFilterLocalResults: async function(url) {
|
|
78
|
+
fetchOnceAndFilterLocalResults: async function (url) {
|
|
71
79
|
if (this.fetchedData === undefined) {
|
|
72
|
-
await this.fetchAutocompleteResults(url)
|
|
80
|
+
await this.fetchAutocompleteResults(url)
|
|
73
81
|
}
|
|
74
|
-
const query = url.searchParams.get(
|
|
75
|
-
const data = Object.values(this.fetchedData)
|
|
76
|
-
const filteredData = query ? this.filterResults(data, query) : data
|
|
77
|
-
return filteredData
|
|
82
|
+
const query = url.searchParams.get("q")
|
|
83
|
+
const data = Object.values(this.fetchedData)
|
|
84
|
+
const filteredData = query ? this.filterResults(data, query) : data
|
|
85
|
+
return filteredData
|
|
86
|
+
.map((item) => this.autocomplete_element_template(item))
|
|
87
|
+
.join("")
|
|
78
88
|
},
|
|
79
89
|
|
|
80
|
-
autocompleteID: function() {
|
|
81
|
-
return this.blockID +
|
|
90
|
+
autocompleteID: function () {
|
|
91
|
+
return this.blockID + "-autocomplete"
|
|
82
92
|
},
|
|
83
93
|
|
|
84
|
-
getQueryValue: function() {
|
|
85
|
-
const completer = this.inner.querySelector("auto-complete > input")
|
|
86
|
-
return completer.value
|
|
94
|
+
getQueryValue: function () {
|
|
95
|
+
const completer = this.inner.querySelector("auto-complete > input")
|
|
96
|
+
return completer.value
|
|
87
97
|
},
|
|
88
98
|
|
|
89
|
-
addAutocompletetoSirTrevorForm: function() {
|
|
90
|
-
const completer = this.inner.querySelector("auto-complete")
|
|
91
|
-
completer.fetchResult = this.autocomplete_fetch.bind(this)
|
|
92
|
-
completer.addEventListener(
|
|
93
|
-
const data = this.fetchedData[e.relatedTarget.value]
|
|
99
|
+
addAutocompletetoSirTrevorForm: function () {
|
|
100
|
+
const completer = this.inner.querySelector("auto-complete")
|
|
101
|
+
completer.fetchResult = this.autocomplete_fetch.bind(this)
|
|
102
|
+
completer.addEventListener("auto-complete-change", (e) => {
|
|
103
|
+
const data = this.fetchedData[e.relatedTarget.value]
|
|
94
104
|
if (e.relatedTarget.value && data) {
|
|
95
|
-
e.value = e.relatedTarget.value =
|
|
96
|
-
this.createItemPanel({ ...data, display: "true" })
|
|
105
|
+
e.value = e.relatedTarget.value = ""
|
|
106
|
+
this.createItemPanel({ ...data, display: "true" })
|
|
97
107
|
}
|
|
98
|
-
})
|
|
108
|
+
})
|
|
99
109
|
},
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
SirTrevor.Block.prototype.availableMixins.push("autocompleteable");
|
|
104
|
-
})(jQuery);
|
|
110
|
+
}),
|
|
111
|
+
SirTrevor.Block.prototype.availableMixins.push("autocompleteable"))
|
|
112
|
+
})(jQuery)
|
|
@@ -1,78 +1,86 @@
|
|
|
1
|
-
(function ($){
|
|
2
|
-
SirTrevor.BlockMixins.Formable = {
|
|
1
|
+
;(function ($) {
|
|
2
|
+
;((SirTrevor.BlockMixins.Formable = {
|
|
3
3
|
mixinName: "Formable",
|
|
4
4
|
preload: true,
|
|
5
5
|
|
|
6
|
-
initializeFormable: function() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this['afterLoadData'] = function(data) { };
|
|
6
|
+
initializeFormable: function () {
|
|
7
|
+
if (this["afterLoadData"] === undefined) {
|
|
8
|
+
this["afterLoadData"] = function (_data) {}
|
|
10
9
|
}
|
|
11
10
|
},
|
|
12
11
|
|
|
13
|
-
formId: function(id) {
|
|
14
|
-
return this.blockID + "_" + id
|
|
12
|
+
formId: function (id) {
|
|
13
|
+
return this.blockID + "_" + id
|
|
15
14
|
},
|
|
16
15
|
|
|
17
|
-
_serializeData: function() {
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_serializeData: function () {
|
|
17
|
+
var data = $(":input,textarea,select", this.inner)
|
|
18
|
+
.not(":input:radio")
|
|
19
|
+
.serializeJSON()
|
|
20
20
|
|
|
21
|
-
$(
|
|
22
|
-
var key = $(input).data(
|
|
21
|
+
$(":input:radio:checked", this.inner).each(function (index, input) {
|
|
22
|
+
var key = $(input).data("key") || input.getAttribute("name")
|
|
23
23
|
|
|
24
24
|
if (!key.match("\\[")) {
|
|
25
|
-
data[key] = $(input).val()
|
|
25
|
+
data[key] = $(input).val()
|
|
26
26
|
}
|
|
27
|
-
})
|
|
27
|
+
})
|
|
28
28
|
|
|
29
29
|
/* Simple to start. Add conditions later */
|
|
30
30
|
if (this.hasTextBlock()) {
|
|
31
|
-
data.text = this.getTextBlockHTML()
|
|
32
|
-
data.format =
|
|
33
|
-
if (
|
|
34
|
-
data.text
|
|
35
|
-
data.
|
|
31
|
+
data.text = this.getTextBlockHTML()
|
|
32
|
+
data.format = "html"
|
|
33
|
+
if (
|
|
34
|
+
data.text &&
|
|
35
|
+
data.text.length > 0 &&
|
|
36
|
+
this.options.convertToMarkdown
|
|
37
|
+
) {
|
|
38
|
+
data.text = stToMarkdown(data.text, this.type)
|
|
39
|
+
data.format = "markdown"
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
return data
|
|
43
|
+
return data
|
|
40
44
|
},
|
|
41
45
|
|
|
42
|
-
loadData: function(data){
|
|
46
|
+
loadData: function (data) {
|
|
43
47
|
if (this.hasTextBlock()) {
|
|
44
|
-
if (
|
|
45
|
-
|
|
48
|
+
if (
|
|
49
|
+
data.text &&
|
|
50
|
+
data.text.length > 0 &&
|
|
51
|
+
this.options.convertFromMarkdown &&
|
|
52
|
+
data.format !== "html"
|
|
53
|
+
) {
|
|
54
|
+
this.setTextBlockHTML(SirTrevor.toHTML(data.text, this.type))
|
|
46
55
|
} else {
|
|
47
|
-
this.setTextBlockHTML(data.text)
|
|
56
|
+
this.setTextBlockHTML(data.text)
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
|
-
this.loadFormDataByKey(data)
|
|
51
|
-
this.afterLoadData(data)
|
|
59
|
+
this.loadFormDataByKey(data)
|
|
60
|
+
this.afterLoadData(data)
|
|
52
61
|
},
|
|
53
62
|
|
|
54
|
-
loadFormDataByKey: function(data) {
|
|
55
|
-
$(
|
|
56
|
-
|
|
63
|
+
loadFormDataByKey: function (data) {
|
|
64
|
+
$(":input", this.inner)
|
|
65
|
+
.not("button,:input[type=hidden]")
|
|
66
|
+
.each(function (index, input) {
|
|
67
|
+
var key = $(input).data("key") || input.getAttribute("name")
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
69
|
+
if (key) {
|
|
70
|
+
if (key.match("\\[\\]$")) {
|
|
71
|
+
key = key.replace("[]", "")
|
|
72
|
+
}
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
// by wrapping it in an array, this'll "just work" for radio and checkbox fields too
|
|
75
|
+
var input_data = data[key]
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
if (!(input_data instanceof Array)) {
|
|
78
|
+
input_data = [input_data]
|
|
79
|
+
}
|
|
80
|
+
$(this).val(input_data)
|
|
69
81
|
}
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
});
|
|
82
|
+
})
|
|
73
83
|
},
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
SirTrevor.Block.prototype.availableMixins.push("formable");
|
|
78
|
-
})(jQuery);
|
|
84
|
+
}),
|
|
85
|
+
SirTrevor.Block.prototype.availableMixins.push("formable"))
|
|
86
|
+
})(jQuery)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
(function ($){
|
|
1
|
+
;(function (_$) {
|
|
2
2
|
SirTrevor.BlockMixins.Plustextable = {
|
|
3
3
|
mixinName: "Textable",
|
|
4
4
|
preload: true,
|
|
5
5
|
|
|
6
|
-
initializeTextable: function() {
|
|
7
|
-
if (this[
|
|
8
|
-
this.withMixin(SirTrevor.BlockMixins.Formable)
|
|
6
|
+
initializeTextable: function () {
|
|
7
|
+
if (this["formId"] === undefined) {
|
|
8
|
+
this.withMixin(SirTrevor.BlockMixins.Formable)
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
if (this[
|
|
12
|
-
this.show_heading = true
|
|
10
|
+
|
|
11
|
+
if (this["show_heading"] === undefined) {
|
|
12
|
+
this.show_heading = true
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
align_key:"text-align",
|
|
17
|
-
text_key:"item-text",
|
|
15
|
+
|
|
16
|
+
align_key: "text-align",
|
|
17
|
+
text_key: "item-text",
|
|
18
18
|
heading_key: "title",
|
|
19
|
-
|
|
20
|
-
text_area: function() {
|
|
19
|
+
|
|
20
|
+
text_area: function () {
|
|
21
21
|
return `
|
|
22
22
|
<div class="row">
|
|
23
23
|
<div class="col-md-8">
|
|
@@ -40,19 +40,18 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
</div>`
|
|
42
42
|
},
|
|
43
|
-
|
|
44
|
-
heading: function() {
|
|
45
|
-
if(this.show_heading) {
|
|
43
|
+
|
|
44
|
+
heading: function () {
|
|
45
|
+
if (this.show_heading) {
|
|
46
46
|
return `<div class="field">
|
|
47
47
|
<label for="${this.formId(this.heading_key)}" class="col-form-label">${i18n.t("blocks:textable:heading")}</label>
|
|
48
48
|
<input type="text" class="form-control" id="${this.formId(this.heading_key)}" name="${this.heading_key}" />
|
|
49
49
|
</div>`
|
|
50
50
|
} else {
|
|
51
|
-
return ""
|
|
51
|
+
return ""
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
}
|
|
55
|
-
|
|
54
|
+
}
|
|
56
55
|
|
|
57
|
-
SirTrevor.Block.prototype.availableMixins.push("plustextable")
|
|
58
|
-
})(jQuery)
|
|
56
|
+
SirTrevor.Block.prototype.availableMixins.push("plustextable")
|
|
57
|
+
})(jQuery)
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import Core from
|
|
2
|
-
|
|
3
|
-
(function ($){
|
|
1
|
+
import Core from "spotlight/core"
|
|
2
|
+
;(function ($) {
|
|
4
3
|
Core.Block = SirTrevor.Block.extend({
|
|
5
4
|
scribeOptions: {
|
|
6
5
|
allowBlockElements: true,
|
|
7
|
-
tags: { p: true }
|
|
6
|
+
tags: { p: true },
|
|
8
7
|
},
|
|
9
8
|
formable: true,
|
|
10
|
-
editorHTML: function() {
|
|
11
|
-
return
|
|
9
|
+
editorHTML: function () {
|
|
10
|
+
return ""
|
|
12
11
|
},
|
|
13
|
-
beforeBlockRender: function() {
|
|
14
|
-
this.availableMixins.forEach(function(mixin) {
|
|
15
|
-
if (
|
|
16
|
-
this
|
|
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)])
|
|
17
19
|
}
|
|
18
|
-
}, this)
|
|
20
|
+
}, this)
|
|
21
|
+
},
|
|
22
|
+
$instance: function () {
|
|
23
|
+
return $("#" + this.instanceID)
|
|
24
|
+
},
|
|
25
|
+
capitalize: function (string) {
|
|
26
|
+
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase()
|
|
19
27
|
},
|
|
20
|
-
$instance: function() { return $('#' + this.instanceID); },
|
|
21
|
-
capitalize: function(string) {
|
|
22
|
-
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase();
|
|
23
|
-
}
|
|
24
28
|
})
|
|
25
|
-
})(jQuery)
|
|
29
|
+
})(jQuery)
|
|
@@ -1,40 +1,46 @@
|
|
|
1
|
-
import Core from
|
|
2
|
-
|
|
3
|
-
SirTrevor.Blocks.Browse = (function(){
|
|
1
|
+
import Core from "spotlight/core"
|
|
4
2
|
|
|
3
|
+
SirTrevor.Blocks.Browse = (function () {
|
|
5
4
|
return Core.Block.Resources.extend({
|
|
6
5
|
type: "browse",
|
|
7
6
|
|
|
8
7
|
icon_name: "browse",
|
|
9
8
|
|
|
10
|
-
autocomplete_url: function() {
|
|
11
|
-
return document
|
|
9
|
+
autocomplete_url: function () {
|
|
10
|
+
return document
|
|
11
|
+
.getElementById(this.instanceID)
|
|
12
|
+
.closest("form[data-autocomplete-exhibit-searches-path]").dataset
|
|
13
|
+
.autocompleteExhibitSearchesPath
|
|
12
14
|
},
|
|
13
15
|
|
|
14
|
-
autocomplete_fetch: function(url) {
|
|
15
|
-
return this.fetchOnceAndFilterLocalResults(url)
|
|
16
|
+
autocomplete_fetch: function (url) {
|
|
17
|
+
return this.fetchOnceAndFilterLocalResults(url)
|
|
16
18
|
},
|
|
17
19
|
|
|
18
|
-
autocomplete_template: function(obj) {
|
|
19
|
-
const thumbnail = obj.thumbnail_image_url
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
autocomplete_template: function (obj) {
|
|
21
|
+
const thumbnail = obj.thumbnail_image_url
|
|
22
|
+
? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail_image_url}" /></div>`
|
|
23
|
+
: ""
|
|
24
|
+
const description = obj.description
|
|
25
|
+
? `<small> ${obj.description}</small>`
|
|
26
|
+
: ""
|
|
27
|
+
return `<div class="autocomplete-item${!obj.published ? " blacklight-private" : ""}">${thumbnail}
|
|
28
|
+
<span class="autocomplete-title">${this.highlight(obj.full_title)}</span>${description}</div>`
|
|
23
29
|
},
|
|
24
30
|
|
|
25
|
-
_itemPanel: function(data) {
|
|
26
|
-
var index = "item_" + this.globalIndex
|
|
27
|
-
var checked
|
|
31
|
+
_itemPanel: function (data) {
|
|
32
|
+
var index = "item_" + this.globalIndex++
|
|
33
|
+
var checked
|
|
28
34
|
if (data.display == "true") {
|
|
29
35
|
checked = "checked='checked'"
|
|
30
36
|
} else {
|
|
31
|
-
checked = ""
|
|
37
|
+
checked = ""
|
|
32
38
|
}
|
|
33
|
-
var resource_id = data.slug || data.id
|
|
39
|
+
var resource_id = data.slug || data.id
|
|
34
40
|
var markup = `
|
|
35
41
|
<li class="field dd-item dd3-item" data-resource-id="${resource_id}" data-id="${index}" id="${this.formId(index)}">
|
|
36
42
|
<input type="hidden" name="item[${index}][id]" value="${resource_id}" />
|
|
37
|
-
<input type="hidden" name="item[${index}][full_title]" value="${
|
|
43
|
+
<input type="hidden" name="item[${index}][full_title]" value="${data.full_title || data.title}" />
|
|
38
44
|
<input data-property="weight" type="hidden" name="item[${index}][weight]" value="${data.weight}" />
|
|
39
45
|
<div class="card d-flex dd3-content">
|
|
40
46
|
<div class="dd-handle dd3-handle">${i18n.t("blocks:resources:panel:drag")}</div>
|
|
@@ -42,15 +48,15 @@ SirTrevor.Blocks.Browse = (function(){
|
|
|
42
48
|
<div class="d-flex">
|
|
43
49
|
<div class="checkbox">
|
|
44
50
|
<input name="item[${index}][display]" type="hidden" value="false" />
|
|
45
|
-
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox +
|
|
46
|
-
<label class="visually-hidden" for="${this.formId(this.display_checkbox +
|
|
51
|
+
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox + "_" + data.id)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
|
|
52
|
+
<label class="visually-hidden" for="${this.formId(this.display_checkbox + "_" + data.id)}">${i18n.t("blocks:resources:panel:display")}</label>
|
|
47
53
|
</div>
|
|
48
54
|
<div class="pic">
|
|
49
|
-
<img class="img-thumbnail" src="${
|
|
55
|
+
<img class="img-thumbnail" src="${data.thumbnail_image_url || (data.iiif_tilesource || "").replace("/info.json", "/full/!100,100/0/default.jpg")}" />
|
|
50
56
|
</div>
|
|
51
57
|
<div class="main">
|
|
52
|
-
<div class="title card-title">${
|
|
53
|
-
<div>${
|
|
58
|
+
<div class="title card-title">${data.full_title || data.title}</div>
|
|
59
|
+
<div>${data.slug || data.id}</div>
|
|
54
60
|
</div>
|
|
55
61
|
<div class="remove float-end">
|
|
56
62
|
<a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
|
|
@@ -60,28 +66,27 @@ SirTrevor.Blocks.Browse = (function(){
|
|
|
60
66
|
</div>
|
|
61
67
|
</li>`
|
|
62
68
|
|
|
63
|
-
var panel = $(markup)
|
|
64
|
-
var context = this
|
|
65
|
-
|
|
66
|
-
$('.remove a', panel).on('click', function(e) {
|
|
67
|
-
e.preventDefault();
|
|
68
|
-
$(this).closest('.field').remove();
|
|
69
|
-
context.afterPanelDelete();
|
|
69
|
+
var panel = $(markup)
|
|
70
|
+
var context = this
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
$(".remove a", panel).on("click", function (e) {
|
|
73
|
+
e.preventDefault()
|
|
74
|
+
$(this).closest(".field").remove()
|
|
75
|
+
context.afterPanelDelete()
|
|
76
|
+
})
|
|
72
77
|
|
|
73
|
-
this.afterPanelRender(data, panel)
|
|
78
|
+
this.afterPanelRender(data, panel)
|
|
74
79
|
|
|
75
|
-
return panel
|
|
80
|
+
return panel
|
|
76
81
|
},
|
|
77
82
|
|
|
78
|
-
item_options: function() {
|
|
83
|
+
item_options: function () {
|
|
84
|
+
return `
|
|
79
85
|
<label>
|
|
80
86
|
<input type="hidden" name="display-item-counts" value="false" />
|
|
81
87
|
<input type="checkbox" name="display-item-counts" value="true" checked />
|
|
82
88
|
${i18n.t("blocks:browse:item_counts")}
|
|
83
89
|
</label>`
|
|
84
90
|
},
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
})();
|
|
91
|
+
})
|
|
92
|
+
})()
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Sir Trevor BrowseGroupCategories
|
|
3
3
|
*/
|
|
4
|
-
import Core from
|
|
5
|
-
|
|
6
|
-
SirTrevor.Blocks.BrowseGroupCategories = (function(){
|
|
4
|
+
import Core from "spotlight/core"
|
|
7
5
|
|
|
6
|
+
SirTrevor.Blocks.BrowseGroupCategories = (function () {
|
|
8
7
|
return Core.Block.Resources.extend({
|
|
9
8
|
type: "browse_group_categories",
|
|
10
9
|
icon_name: "browse",
|
|
11
10
|
|
|
12
|
-
autocomplete_control: function() {
|
|
13
|
-
const autocompleteID = this.blockID +
|
|
11
|
+
autocomplete_control: function () {
|
|
12
|
+
const autocompleteID = this.blockID + "-autocomplete"
|
|
14
13
|
return `<auto-complete src="${this.autocomplete_url()}" for="${autocompleteID}-popup" fetch-on-empty>
|
|
15
14
|
<input type="text" name="${autocompleteID}" placeholder="${i18n.t("blocks:browse_group_categories:autocomplete")}" data-default-typeahead>
|
|
16
15
|
<ul id="${autocompleteID}-popup"></ul>
|
|
17
16
|
<div id="${autocompleteID}-popup-feedback" class="visually-hidden"></div>
|
|
18
17
|
</auto-complete>`
|
|
19
18
|
},
|
|
20
|
-
autocomplete_template: function(obj) {
|
|
21
|
-
return `<div class="autocomplete-item${!obj.published ?
|
|
19
|
+
autocomplete_template: function (obj) {
|
|
20
|
+
return `<div class="autocomplete-item${!obj.published ? " blacklight-private" : ""}">
|
|
22
21
|
<span class="autocomplete-title">${this.highlight(obj.title)}</span><br/></div>`
|
|
23
22
|
},
|
|
24
23
|
|
|
25
|
-
autocomplete_url: function() {
|
|
26
|
-
return document
|
|
24
|
+
autocomplete_url: function () {
|
|
25
|
+
return document
|
|
26
|
+
.getElementById(this.instanceID)
|
|
27
|
+
.closest("form[data-autocomplete-exhibit-browse-groups-path]").dataset
|
|
28
|
+
.autocompleteExhibitBrowseGroupsPath
|
|
27
29
|
},
|
|
28
|
-
autocomplete_fetch: function(url) {
|
|
29
|
-
return this.fetchOnceAndFilterLocalResults(url)
|
|
30
|
+
autocomplete_fetch: function (url) {
|
|
31
|
+
return this.fetchOnceAndFilterLocalResults(url)
|
|
30
32
|
},
|
|
31
|
-
_itemPanel: function(data) {
|
|
32
|
-
var index = "item_" + this.globalIndex
|
|
33
|
-
var checked
|
|
33
|
+
_itemPanel: function (data) {
|
|
34
|
+
var index = "item_" + this.globalIndex++
|
|
35
|
+
var checked
|
|
34
36
|
if (data.display == "true") {
|
|
35
37
|
checked = "checked='checked'"
|
|
36
38
|
} else {
|
|
37
|
-
checked = ""
|
|
39
|
+
checked = ""
|
|
38
40
|
}
|
|
39
|
-
var resource_id = data.slug || data.id
|
|
41
|
+
var resource_id = data.slug || data.id
|
|
40
42
|
var markup = `
|
|
41
43
|
<li class="field dd-item dd3-item" data-resource-id="${resource_id}" data-id="${index}" id="${this.formId(index)}">
|
|
42
44
|
<input type="hidden" name="item[${index}][id]" value="${resource_id}" />
|
|
@@ -48,8 +50,8 @@ SirTrevor.Blocks.BrowseGroupCategories = (function(){
|
|
|
48
50
|
<div class="d-flex flex-grow-1">
|
|
49
51
|
<div class="checkbox">
|
|
50
52
|
<input name="item[${index}][display]" type="hidden" value="false" />
|
|
51
|
-
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox +
|
|
52
|
-
<label class="visually-hidden" for="${this.formId(this.display_checkbox +
|
|
53
|
+
<input name="item[${index}][display]" id="${this.formId(this.display_checkbox + "_" + data.id)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
|
|
54
|
+
<label class="visually-hidden" for="${this.formId(this.display_checkbox + "_" + data.id)}">${i18n.t("blocks:resources:panel:display")}</label>
|
|
53
55
|
</div>
|
|
54
56
|
<div class="main">
|
|
55
57
|
<div class="title card-title">${data.title}</div>
|
|
@@ -62,27 +64,27 @@ SirTrevor.Blocks.BrowseGroupCategories = (function(){
|
|
|
62
64
|
</div>
|
|
63
65
|
</li>`
|
|
64
66
|
|
|
65
|
-
const panel = $(markup)
|
|
66
|
-
var context = this
|
|
67
|
-
|
|
68
|
-
$('a[data-item-grid-panel-remove]', panel).on('click', function(e) {
|
|
69
|
-
e.preventDefault();
|
|
70
|
-
$(this).closest('.field').remove();
|
|
71
|
-
context.afterPanelDelete();
|
|
67
|
+
const panel = $(markup)
|
|
68
|
+
var context = this
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
$("a[data-item-grid-panel-remove]", panel).on("click", function (e) {
|
|
71
|
+
e.preventDefault()
|
|
72
|
+
$(this).closest(".field").remove()
|
|
73
|
+
context.afterPanelDelete()
|
|
74
|
+
})
|
|
74
75
|
|
|
75
|
-
this.afterPanelRender(data, panel)
|
|
76
|
+
this.afterPanelRender(data, panel)
|
|
76
77
|
|
|
77
|
-
return panel
|
|
78
|
+
return panel
|
|
78
79
|
},
|
|
79
80
|
|
|
80
|
-
item_options: function() {
|
|
81
|
+
item_options: function () {
|
|
82
|
+
return `
|
|
81
83
|
<label>
|
|
82
84
|
<input type="hidden" name="display-item-counts" value="false" />
|
|
83
85
|
<input type="checkbox" name="display-item-counts" value="true" checked />
|
|
84
86
|
${i18n.t("blocks:browse_group_categories:item_counts")}
|
|
85
87
|
</label>`
|
|
86
88
|
},
|
|
87
|
-
})
|
|
88
|
-
})()
|
|
89
|
+
})
|
|
90
|
+
})()
|