spotlight-frontend 4.2.0 → 4.3.4
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.
- package/README.md +3 -3
- package/app/assets/javascripts/spotlight/spotlight.esm.js +116 -3
- package/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- package/app/assets/javascripts/spotlight/spotlight.js +116 -3
- package/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- package/package.json +3 -2
|
@@ -5933,10 +5933,24 @@
|
|
|
5933
5933
|
formable: true,
|
|
5934
5934
|
autocompleteable: true,
|
|
5935
5935
|
show_heading: true,
|
|
5936
|
+
show_alt_text: true,
|
|
5936
5937
|
|
|
5937
5938
|
title: function() { return i18n.t("blocks:" + this.type + ":title"); },
|
|
5938
5939
|
description: function() { return i18n.t("blocks:" + this.type + ":description"); },
|
|
5939
|
-
|
|
5940
|
+
alt_text_guidelines: function() {
|
|
5941
|
+
if (this.show_alt_text) {
|
|
5942
|
+
return i18n.t("blocks:alt_text_guidelines:intro");
|
|
5943
|
+
}
|
|
5944
|
+
return "";
|
|
5945
|
+
},
|
|
5946
|
+
alt_text_guidelines_link: function() {
|
|
5947
|
+
if (this.show_alt_text) {
|
|
5948
|
+
var link_url = i18n.t("blocks:alt_text_guidelines:link_url");
|
|
5949
|
+
var link_label = i18n.t("blocks:alt_text_guidelines:link_label");
|
|
5950
|
+
return '<a target="_blank" href="' + link_url + '">' + link_label + '</a>';
|
|
5951
|
+
}
|
|
5952
|
+
return "";
|
|
5953
|
+
},
|
|
5940
5954
|
icon_name: "resources",
|
|
5941
5955
|
blockGroup: function() { return i18n.t("blocks:group:items") },
|
|
5942
5956
|
|
|
@@ -5946,6 +5960,8 @@
|
|
|
5946
5960
|
show_secondary_field_key: "show-secondary-caption",
|
|
5947
5961
|
|
|
5948
5962
|
display_checkbox: "display-checkbox",
|
|
5963
|
+
decorative_checkbox: "decorative-checkbox",
|
|
5964
|
+
alt_text_textarea: "alt-text-textarea",
|
|
5949
5965
|
|
|
5950
5966
|
globalIndex: 0,
|
|
5951
5967
|
|
|
@@ -5953,6 +5969,13 @@
|
|
|
5953
5969
|
return [];
|
|
5954
5970
|
},
|
|
5955
5971
|
|
|
5972
|
+
_altTextFieldsHTML: function(index, data) {
|
|
5973
|
+
if (this.show_alt_text) {
|
|
5974
|
+
return this.altTextHTML(index, data);
|
|
5975
|
+
}
|
|
5976
|
+
return "";
|
|
5977
|
+
},
|
|
5978
|
+
|
|
5956
5979
|
_itemPanel: function(data) {
|
|
5957
5980
|
var index = "item_" + this.globalIndex++;
|
|
5958
5981
|
var checked;
|
|
@@ -5983,6 +6006,7 @@
|
|
|
5983
6006
|
<div class="main">
|
|
5984
6007
|
<div class="title card-title">${data.title}</div>
|
|
5985
6008
|
<div>${(data.slug || data.id)}</div>
|
|
6009
|
+
${this._altTextFieldsHTML(index, data)}
|
|
5986
6010
|
</div>
|
|
5987
6011
|
<div class="remove float-right float-end">
|
|
5988
6012
|
<a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
|
|
@@ -6019,6 +6043,7 @@
|
|
|
6019
6043
|
|
|
6020
6044
|
createItemPanel: function(data) {
|
|
6021
6045
|
var panel = this._itemPanel(data);
|
|
6046
|
+
this.attachAltTextHandlers(panel);
|
|
6022
6047
|
$(panel).appendTo($('.panels > ol', this.inner));
|
|
6023
6048
|
$('[data-behavior="nestable"]', this.inner).trigger('change');
|
|
6024
6049
|
},
|
|
@@ -6051,11 +6076,67 @@
|
|
|
6051
6076
|
return `<div class="form resources-admin clearfix">
|
|
6052
6077
|
<div class="widget-header">
|
|
6053
6078
|
${this.description()}
|
|
6079
|
+
${this.alt_text_guidelines()}
|
|
6080
|
+
${this.alt_text_guidelines_link()}
|
|
6054
6081
|
</div>
|
|
6055
6082
|
${this.content()}
|
|
6056
6083
|
</div>`
|
|
6057
6084
|
},
|
|
6058
6085
|
|
|
6086
|
+
_altTextData: function(data) {
|
|
6087
|
+
const isDecorative = data.decorative;
|
|
6088
|
+
const altText = isDecorative ? '' : (data.alt_text || '');
|
|
6089
|
+
const altTextBackup = data.alt_text_backup || '';
|
|
6090
|
+
const placeholderAttr = isDecorative ? '' : `placeholder="${i18n.t("blocks:resources:alt_text:placeholder")}"`;
|
|
6091
|
+
const disabledAttr = isDecorative ? 'disabled' : '';
|
|
6092
|
+
|
|
6093
|
+
return { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr };
|
|
6094
|
+
},
|
|
6095
|
+
|
|
6096
|
+
altTextHTML: function(index, data) {
|
|
6097
|
+
const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
|
|
6098
|
+
return `<div class="mt-2 pt-2 d-flex">
|
|
6099
|
+
<div class="me-2 mr-2">
|
|
6100
|
+
<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>
|
|
6101
|
+
<div class="form-check mb-1 justify-content-end">
|
|
6102
|
+
<input class="form-check-input" type="checkbox"
|
|
6103
|
+
id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
|
|
6104
|
+
<label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
|
|
6105
|
+
</div>
|
|
6106
|
+
</div>
|
|
6107
|
+
<div class="flex-grow-1 flex-fill d-flex">
|
|
6108
|
+
<input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
|
|
6109
|
+
<textarea class="form-control w-100" rows="2" ${placeholderAttr}
|
|
6110
|
+
id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
|
|
6111
|
+
</div>
|
|
6112
|
+
</div>`
|
|
6113
|
+
},
|
|
6114
|
+
|
|
6115
|
+
attachAltTextHandlers: function(panel) {
|
|
6116
|
+
if (this.show_alt_text) {
|
|
6117
|
+
const decorativeCheckbox = $('input[name$="[decorative]"]', panel);
|
|
6118
|
+
const altTextInput = $('textarea[name$="[alt_text]"]', panel);
|
|
6119
|
+
const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel);
|
|
6120
|
+
|
|
6121
|
+
decorativeCheckbox.on('change', function() {
|
|
6122
|
+
const isDecorative = this.checked;
|
|
6123
|
+
if (isDecorative) {
|
|
6124
|
+
altTextBackupInput.val(altTextInput.val());
|
|
6125
|
+
altTextInput.val('');
|
|
6126
|
+
} else {
|
|
6127
|
+
altTextInput.val(altTextBackupInput.val());
|
|
6128
|
+
}
|
|
6129
|
+
altTextInput
|
|
6130
|
+
.prop('disabled', isDecorative)
|
|
6131
|
+
.attr('placeholder', isDecorative ? '' : i18n.t("blocks:resources:alt_text:placeholder"));
|
|
6132
|
+
});
|
|
6133
|
+
|
|
6134
|
+
altTextInput.on('input', function() {
|
|
6135
|
+
$(this).data('lastValue', $(this).val());
|
|
6136
|
+
});
|
|
6137
|
+
}
|
|
6138
|
+
},
|
|
6139
|
+
|
|
6059
6140
|
onBlockRender: function() {
|
|
6060
6141
|
Module.init($('[data-behavior="nestable"]', this.inner));
|
|
6061
6142
|
|
|
@@ -6245,7 +6326,7 @@
|
|
|
6245
6326
|
},
|
|
6246
6327
|
|
|
6247
6328
|
item_options: function() { return `
|
|
6248
|
-
|
|
6329
|
+
<label>
|
|
6249
6330
|
<input type="hidden" name="display-item-counts" value="false" />
|
|
6250
6331
|
<input type="checkbox" name="display-item-counts" value="true" checked />
|
|
6251
6332
|
${i18n.t("blocks:browse_group_categories:item_counts")}
|
|
@@ -6680,7 +6761,7 @@
|
|
|
6680
6761
|
|
|
6681
6762
|
return SirTrevor.Blocks.SolrDocumentsBase.extend({
|
|
6682
6763
|
type: "solr_documents_embed",
|
|
6683
|
-
|
|
6764
|
+
show_alt_text: false,
|
|
6684
6765
|
icon_name: "item_embed",
|
|
6685
6766
|
|
|
6686
6767
|
item_options: function() { return "" },
|
|
@@ -6844,6 +6925,7 @@
|
|
|
6844
6925
|
<label for="${this.formId('link_' + dataId)}" class="col-form-label col-md-3">${i18n.t("blocks:uploaded_items:link")}</label>
|
|
6845
6926
|
<input type="text" class="form-control col" id="${this.formId('link_' + dataId)}" name="item[${index}][link]" data-field="link"/>
|
|
6846
6927
|
</div>
|
|
6928
|
+
${this._altTextFieldsHTML(index, data)}
|
|
6847
6929
|
</div>
|
|
6848
6930
|
<div class="remove float-right float-end">
|
|
6849
6931
|
<a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
|
|
@@ -6871,6 +6953,8 @@
|
|
|
6871
6953
|
return `<div class="form oembed-text-admin clearfix">
|
|
6872
6954
|
<div class="widget-header">
|
|
6873
6955
|
${this.description()}
|
|
6956
|
+
${this.alt_text_guidelines()}
|
|
6957
|
+
${this.alt_text_guidelines_link()}
|
|
6874
6958
|
</div>
|
|
6875
6959
|
<div class="row">
|
|
6876
6960
|
<div class="form-group mb-3 col-md-8">
|
|
@@ -6890,6 +6974,24 @@
|
|
|
6890
6974
|
</div>`
|
|
6891
6975
|
},
|
|
6892
6976
|
|
|
6977
|
+
altTextHTML: function(index, data) {
|
|
6978
|
+
const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
|
|
6979
|
+
return `
|
|
6980
|
+
<div class="field row mr-3 me-3">
|
|
6981
|
+
<div class="col-lg-3 ps-md-2 pl-md-2">
|
|
6982
|
+
<label class="col-form-label text-nowrap pb-0 pt-1 justify-content-md-start justify-content-lg-end d-flex" for="${this.formId(this.alt_text_textarea + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:alternative_text")}</label>
|
|
6983
|
+
<div class="form-check d-flex justify-content-md-start justify-content-lg-end">
|
|
6984
|
+
<input class="form-check-input" type="checkbox"
|
|
6985
|
+
id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
|
|
6986
|
+
<label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
|
|
6987
|
+
</div>
|
|
6988
|
+
</div>
|
|
6989
|
+
<input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
|
|
6990
|
+
<textarea class="col-lg-9" rows="2" ${placeholderAttr}
|
|
6991
|
+
id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
|
|
6992
|
+
</div>`
|
|
6993
|
+
},
|
|
6994
|
+
|
|
6893
6995
|
zpr_key: 'zpr_link'
|
|
6894
6996
|
});
|
|
6895
6997
|
})();
|
|
@@ -7100,6 +7202,11 @@
|
|
|
7100
7202
|
drag: "Drag",
|
|
7101
7203
|
display: "Display?",
|
|
7102
7204
|
remove: "Remove"
|
|
7205
|
+
},
|
|
7206
|
+
alt_text: {
|
|
7207
|
+
decorative: "Decorative",
|
|
7208
|
+
alternative_text: "Alternative text",
|
|
7209
|
+
placeholder: "Enter alt text for this item..."
|
|
7103
7210
|
}
|
|
7104
7211
|
},
|
|
7105
7212
|
|
|
@@ -7165,6 +7272,12 @@
|
|
|
7165
7272
|
group: {
|
|
7166
7273
|
undefined: "Standard widgets",
|
|
7167
7274
|
items: "Exhibit item widgets"
|
|
7275
|
+
},
|
|
7276
|
+
|
|
7277
|
+
alt_text_guidelines: {
|
|
7278
|
+
intro: 'For each item, please enter alternative text or appropriately check the decorative box. ',
|
|
7279
|
+
link_label: 'Guidelines for writing alt text.',
|
|
7280
|
+
link_url: 'https://www.w3.org/WAI/tutorials/images/'
|
|
7168
7281
|
}
|
|
7169
7282
|
});
|
|
7170
7283
|
|