blacklight-spotlight 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/javascripts/spotlight/spotlight.esm.js +119 -3
- data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +119 -3
- data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
- data/app/controllers/concerns/spotlight/search_helper.rb +2 -2
- data/app/controllers/spotlight/appearances_controller.rb +1 -1
- data/app/controllers/spotlight/bulk_actions_controller.rb +1 -1
- data/app/controllers/spotlight/bulk_updates_controller.rb +1 -1
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/groups_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -1
- data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
- data/app/controllers/spotlight/roles_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +1 -1
- data/app/controllers/spotlight/translations_controller.rb +2 -2
- data/app/helpers/spotlight/application_helper.rb +2 -2
- data/app/helpers/spotlight/crop_helper.rb +1 -1
- data/app/helpers/spotlight/pages_helper.rb +7 -0
- data/app/helpers/spotlight/title_helper.rb +2 -2
- data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +1 -1
- data/app/javascript/spotlight/admin/blocks/resources_block.js +82 -1
- data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +1 -1
- data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +21 -0
- data/app/javascript/spotlight/admin/sir-trevor/locales.js +11 -0
- data/app/jobs/concerns/spotlight/job_tracking.rb +1 -1
- data/app/jobs/spotlight/add_tags_job.rb +2 -2
- data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -1
- data/app/jobs/spotlight/change_visibility_job.rb +2 -2
- data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +2 -2
- data/app/jobs/spotlight/reindex_exhibit_job.rb +1 -1
- data/app/jobs/spotlight/reindex_job.rb +6 -6
- data/app/jobs/spotlight/remove_tags_job.rb +2 -2
- data/app/jobs/spotlight/rename_tags_job.rb +2 -2
- data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
- data/app/models/concerns/spotlight/solr_document/finder.rb +4 -4
- data/app/models/concerns/spotlight/solr_document.rb +4 -4
- data/app/models/concerns/spotlight/translatables.rb +1 -1
- data/app/models/spotlight/analytics/ga.rb +1 -1
- data/app/models/spotlight/attachment.rb +1 -1
- data/app/models/spotlight/background_job_progress.rb +1 -1
- data/app/models/spotlight/contact_email.rb +1 -1
- data/app/models/spotlight/contact_form.rb +2 -2
- data/app/models/spotlight/custom_field.rb +2 -2
- data/app/models/spotlight/custom_search_field.rb +2 -2
- data/app/models/spotlight/job_tracker.rb +1 -1
- data/app/models/spotlight/page.rb +2 -2
- data/app/models/spotlight/resources/iiif_service.rb +4 -4
- data/app/models/spotlight/role.rb +1 -1
- data/app/models/spotlight/search.rb +2 -2
- data/app/services/spotlight/bulk_updates_csv_template_service.rb +2 -2
- data/app/services/spotlight/clone_translated_page_from_locale.rb +1 -1
- data/app/services/spotlight/etl/pipeline.rb +1 -1
- data/app/views/shared/_exhibit_navbar.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +3 -2
- data/lib/migration/iiif.rb +3 -3
- data/lib/spotlight/engine.rb +4 -17
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +3 -3
- data/spec/factories/exhibits.rb +1 -1
- metadata +3 -3
@@ -5141,6 +5141,7 @@
|
|
5141
5141
|
};
|
5142
5142
|
|
5143
5143
|
// Place all the behaviors and hooks related to the matching controller here.
|
5144
|
+
// All this logic will automatically be available in application.js.
|
5144
5145
|
|
5145
5146
|
class Pages {
|
5146
5147
|
connect(){
|
@@ -5607,6 +5608,8 @@
|
|
5607
5608
|
}
|
5608
5609
|
|
5609
5610
|
// Visibility toggle for items in an exhibit, based on Blacklight's bookmark toggle
|
5611
|
+
// See: https://github.com/projectblacklight/blacklight/blob/main/app/javascript/blacklight/bookmark_toggle.js
|
5612
|
+
|
5610
5613
|
|
5611
5614
|
const VisibilityToggle = (e) => {
|
5612
5615
|
if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
|
@@ -5933,10 +5936,24 @@
|
|
5933
5936
|
formable: true,
|
5934
5937
|
autocompleteable: true,
|
5935
5938
|
show_heading: true,
|
5939
|
+
show_alt_text: true,
|
5936
5940
|
|
5937
5941
|
title: function() { return i18n.t("blocks:" + this.type + ":title"); },
|
5938
5942
|
description: function() { return i18n.t("blocks:" + this.type + ":description"); },
|
5939
|
-
|
5943
|
+
alt_text_guidelines: function() {
|
5944
|
+
if (this.show_alt_text) {
|
5945
|
+
return i18n.t("blocks:alt_text_guidelines:intro");
|
5946
|
+
}
|
5947
|
+
return "";
|
5948
|
+
},
|
5949
|
+
alt_text_guidelines_link: function() {
|
5950
|
+
if (this.show_alt_text) {
|
5951
|
+
var link_url = i18n.t("blocks:alt_text_guidelines:link_url");
|
5952
|
+
var link_label = i18n.t("blocks:alt_text_guidelines:link_label");
|
5953
|
+
return '<a target="_blank" href="' + link_url + '">' + link_label + '</a>';
|
5954
|
+
}
|
5955
|
+
return "";
|
5956
|
+
},
|
5940
5957
|
icon_name: "resources",
|
5941
5958
|
blockGroup: function() { return i18n.t("blocks:group:items") },
|
5942
5959
|
|
@@ -5946,6 +5963,8 @@
|
|
5946
5963
|
show_secondary_field_key: "show-secondary-caption",
|
5947
5964
|
|
5948
5965
|
display_checkbox: "display-checkbox",
|
5966
|
+
decorative_checkbox: "decorative-checkbox",
|
5967
|
+
alt_text_textarea: "alt-text-textarea",
|
5949
5968
|
|
5950
5969
|
globalIndex: 0,
|
5951
5970
|
|
@@ -5953,6 +5972,13 @@
|
|
5953
5972
|
return [];
|
5954
5973
|
},
|
5955
5974
|
|
5975
|
+
_altTextFieldsHTML: function(index, data) {
|
5976
|
+
if (this.show_alt_text) {
|
5977
|
+
return this.altTextHTML(index, data);
|
5978
|
+
}
|
5979
|
+
return "";
|
5980
|
+
},
|
5981
|
+
|
5956
5982
|
_itemPanel: function(data) {
|
5957
5983
|
var index = "item_" + this.globalIndex++;
|
5958
5984
|
var checked;
|
@@ -5983,6 +6009,7 @@
|
|
5983
6009
|
<div class="main">
|
5984
6010
|
<div class="title card-title">${data.title}</div>
|
5985
6011
|
<div>${(data.slug || data.id)}</div>
|
6012
|
+
${this._altTextFieldsHTML(index, data)}
|
5986
6013
|
</div>
|
5987
6014
|
<div class="remove float-right float-end">
|
5988
6015
|
<a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
|
@@ -6019,6 +6046,7 @@
|
|
6019
6046
|
|
6020
6047
|
createItemPanel: function(data) {
|
6021
6048
|
var panel = this._itemPanel(data);
|
6049
|
+
this.attachAltTextHandlers(panel);
|
6022
6050
|
$(panel).appendTo($('.panels > ol', this.inner));
|
6023
6051
|
$('[data-behavior="nestable"]', this.inner).trigger('change');
|
6024
6052
|
},
|
@@ -6051,11 +6079,67 @@
|
|
6051
6079
|
return `<div class="form resources-admin clearfix">
|
6052
6080
|
<div class="widget-header">
|
6053
6081
|
${this.description()}
|
6082
|
+
${this.alt_text_guidelines()}
|
6083
|
+
${this.alt_text_guidelines_link()}
|
6054
6084
|
</div>
|
6055
6085
|
${this.content()}
|
6056
6086
|
</div>`
|
6057
6087
|
},
|
6058
6088
|
|
6089
|
+
_altTextData: function(data) {
|
6090
|
+
const isDecorative = data.decorative;
|
6091
|
+
const altText = isDecorative ? '' : (data.alt_text || '');
|
6092
|
+
const altTextBackup = data.alt_text_backup || '';
|
6093
|
+
const placeholderAttr = isDecorative ? '' : `placeholder="${i18n.t("blocks:resources:alt_text:placeholder")}"`;
|
6094
|
+
const disabledAttr = isDecorative ? 'disabled' : '';
|
6095
|
+
|
6096
|
+
return { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr };
|
6097
|
+
},
|
6098
|
+
|
6099
|
+
altTextHTML: function(index, data) {
|
6100
|
+
const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
|
6101
|
+
return `<div class="mt-2 pt-2 d-flex">
|
6102
|
+
<div class="me-2 mr-2">
|
6103
|
+
<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>
|
6104
|
+
<div class="form-check mb-1 justify-content-end">
|
6105
|
+
<input class="form-check-input" type="checkbox"
|
6106
|
+
id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
|
6107
|
+
<label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
|
6108
|
+
</div>
|
6109
|
+
</div>
|
6110
|
+
<div class="flex-grow-1 flex-fill d-flex">
|
6111
|
+
<input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
|
6112
|
+
<textarea class="form-control w-100" rows="2" ${placeholderAttr}
|
6113
|
+
id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
|
6114
|
+
</div>
|
6115
|
+
</div>`
|
6116
|
+
},
|
6117
|
+
|
6118
|
+
attachAltTextHandlers: function(panel) {
|
6119
|
+
if (this.show_alt_text) {
|
6120
|
+
const decorativeCheckbox = $('input[name$="[decorative]"]', panel);
|
6121
|
+
const altTextInput = $('textarea[name$="[alt_text]"]', panel);
|
6122
|
+
const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel);
|
6123
|
+
|
6124
|
+
decorativeCheckbox.on('change', function() {
|
6125
|
+
const isDecorative = this.checked;
|
6126
|
+
if (isDecorative) {
|
6127
|
+
altTextBackupInput.val(altTextInput.val());
|
6128
|
+
altTextInput.val('');
|
6129
|
+
} else {
|
6130
|
+
altTextInput.val(altTextBackupInput.val());
|
6131
|
+
}
|
6132
|
+
altTextInput
|
6133
|
+
.prop('disabled', isDecorative)
|
6134
|
+
.attr('placeholder', isDecorative ? '' : i18n.t("blocks:resources:alt_text:placeholder"));
|
6135
|
+
});
|
6136
|
+
|
6137
|
+
altTextInput.on('input', function() {
|
6138
|
+
$(this).data('lastValue', $(this).val());
|
6139
|
+
});
|
6140
|
+
}
|
6141
|
+
},
|
6142
|
+
|
6059
6143
|
onBlockRender: function() {
|
6060
6144
|
Module.init($('[data-behavior="nestable"]', this.inner));
|
6061
6145
|
|
@@ -6245,7 +6329,7 @@
|
|
6245
6329
|
},
|
6246
6330
|
|
6247
6331
|
item_options: function() { return `
|
6248
|
-
|
6332
|
+
<label>
|
6249
6333
|
<input type="hidden" name="display-item-counts" value="false" />
|
6250
6334
|
<input type="checkbox" name="display-item-counts" value="true" checked />
|
6251
6335
|
${i18n.t("blocks:browse_group_categories:item_counts")}
|
@@ -6680,7 +6764,7 @@
|
|
6680
6764
|
|
6681
6765
|
return SirTrevor.Blocks.SolrDocumentsBase.extend({
|
6682
6766
|
type: "solr_documents_embed",
|
6683
|
-
|
6767
|
+
show_alt_text: false,
|
6684
6768
|
icon_name: "item_embed",
|
6685
6769
|
|
6686
6770
|
item_options: function() { return "" },
|
@@ -6844,6 +6928,7 @@
|
|
6844
6928
|
<label for="${this.formId('link_' + dataId)}" class="col-form-label col-md-3">${i18n.t("blocks:uploaded_items:link")}</label>
|
6845
6929
|
<input type="text" class="form-control col" id="${this.formId('link_' + dataId)}" name="item[${index}][link]" data-field="link"/>
|
6846
6930
|
</div>
|
6931
|
+
${this._altTextFieldsHTML(index, data)}
|
6847
6932
|
</div>
|
6848
6933
|
<div class="remove float-right float-end">
|
6849
6934
|
<a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
|
@@ -6871,6 +6956,8 @@
|
|
6871
6956
|
return `<div class="form oembed-text-admin clearfix">
|
6872
6957
|
<div class="widget-header">
|
6873
6958
|
${this.description()}
|
6959
|
+
${this.alt_text_guidelines()}
|
6960
|
+
${this.alt_text_guidelines_link()}
|
6874
6961
|
</div>
|
6875
6962
|
<div class="row">
|
6876
6963
|
<div class="form-group mb-3 col-md-8">
|
@@ -6890,6 +6977,24 @@
|
|
6890
6977
|
</div>`
|
6891
6978
|
},
|
6892
6979
|
|
6980
|
+
altTextHTML: function(index, data) {
|
6981
|
+
const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
|
6982
|
+
return `
|
6983
|
+
<div class="field row mr-3 me-3">
|
6984
|
+
<div class="col-lg-3 ps-md-2 pl-md-2">
|
6985
|
+
<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>
|
6986
|
+
<div class="form-check d-flex justify-content-md-start justify-content-lg-end">
|
6987
|
+
<input class="form-check-input" type="checkbox"
|
6988
|
+
id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
|
6989
|
+
<label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
|
6990
|
+
</div>
|
6991
|
+
</div>
|
6992
|
+
<input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
|
6993
|
+
<textarea class="col-lg-9" rows="2" ${placeholderAttr}
|
6994
|
+
id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
|
6995
|
+
</div>`
|
6996
|
+
},
|
6997
|
+
|
6893
6998
|
zpr_key: 'zpr_link'
|
6894
6999
|
});
|
6895
7000
|
})();
|
@@ -7100,6 +7205,11 @@
|
|
7100
7205
|
drag: "Drag",
|
7101
7206
|
display: "Display?",
|
7102
7207
|
remove: "Remove"
|
7208
|
+
},
|
7209
|
+
alt_text: {
|
7210
|
+
decorative: "Decorative",
|
7211
|
+
alternative_text: "Alternative text",
|
7212
|
+
placeholder: "Enter alt text for this item..."
|
7103
7213
|
}
|
7104
7214
|
},
|
7105
7215
|
|
@@ -7165,6 +7275,12 @@
|
|
7165
7275
|
group: {
|
7166
7276
|
undefined: "Standard widgets",
|
7167
7277
|
items: "Exhibit item widgets"
|
7278
|
+
},
|
7279
|
+
|
7280
|
+
alt_text_guidelines: {
|
7281
|
+
intro: 'For each item, please enter alternative text or appropriately check the decorative box. ',
|
7282
|
+
link_label: 'Guidelines for writing alt text.',
|
7283
|
+
link_url: 'https://www.w3.org/WAI/tutorials/images/'
|
7168
7284
|
}
|
7169
7285
|
});
|
7170
7286
|
|