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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js +119 -3
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  5. data/app/assets/javascripts/spotlight/spotlight.js +119 -3
  6. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  7. data/app/controllers/concerns/spotlight/search_helper.rb +2 -2
  8. data/app/controllers/spotlight/appearances_controller.rb +1 -1
  9. data/app/controllers/spotlight/bulk_actions_controller.rb +1 -1
  10. data/app/controllers/spotlight/bulk_updates_controller.rb +1 -1
  11. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  12. data/app/controllers/spotlight/groups_controller.rb +1 -1
  13. data/app/controllers/spotlight/pages_controller.rb +1 -1
  14. data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
  15. data/app/controllers/spotlight/roles_controller.rb +1 -1
  16. data/app/controllers/spotlight/searches_controller.rb +1 -1
  17. data/app/controllers/spotlight/translations_controller.rb +2 -2
  18. data/app/helpers/spotlight/application_helper.rb +2 -2
  19. data/app/helpers/spotlight/crop_helper.rb +1 -1
  20. data/app/helpers/spotlight/pages_helper.rb +7 -0
  21. data/app/helpers/spotlight/title_helper.rb +2 -2
  22. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +1 -1
  23. data/app/javascript/spotlight/admin/blocks/resources_block.js +82 -1
  24. data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +1 -1
  25. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +21 -0
  26. data/app/javascript/spotlight/admin/sir-trevor/locales.js +11 -0
  27. data/app/jobs/concerns/spotlight/job_tracking.rb +1 -1
  28. data/app/jobs/spotlight/add_tags_job.rb +2 -2
  29. data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -1
  30. data/app/jobs/spotlight/change_visibility_job.rb +2 -2
  31. data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +2 -2
  32. data/app/jobs/spotlight/reindex_exhibit_job.rb +1 -1
  33. data/app/jobs/spotlight/reindex_job.rb +6 -6
  34. data/app/jobs/spotlight/remove_tags_job.rb +2 -2
  35. data/app/jobs/spotlight/rename_tags_job.rb +2 -2
  36. data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
  37. data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
  38. data/app/models/concerns/spotlight/solr_document/finder.rb +4 -4
  39. data/app/models/concerns/spotlight/solr_document.rb +4 -4
  40. data/app/models/concerns/spotlight/translatables.rb +1 -1
  41. data/app/models/spotlight/analytics/ga.rb +1 -1
  42. data/app/models/spotlight/attachment.rb +1 -1
  43. data/app/models/spotlight/background_job_progress.rb +1 -1
  44. data/app/models/spotlight/contact_email.rb +1 -1
  45. data/app/models/spotlight/contact_form.rb +2 -2
  46. data/app/models/spotlight/custom_field.rb +2 -2
  47. data/app/models/spotlight/custom_search_field.rb +2 -2
  48. data/app/models/spotlight/job_tracker.rb +1 -1
  49. data/app/models/spotlight/page.rb +2 -2
  50. data/app/models/spotlight/resources/iiif_service.rb +4 -4
  51. data/app/models/spotlight/role.rb +1 -1
  52. data/app/models/spotlight/search.rb +2 -2
  53. data/app/services/spotlight/bulk_updates_csv_template_service.rb +2 -2
  54. data/app/services/spotlight/clone_translated_page_from_locale.rb +1 -1
  55. data/app/services/spotlight/etl/pipeline.rb +1 -1
  56. data/app/views/shared/_exhibit_navbar.html.erb +1 -1
  57. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +3 -3
  58. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +3 -3
  59. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +3 -3
  60. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +3 -3
  61. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +3 -2
  62. data/lib/migration/iiif.rb +3 -3
  63. data/lib/spotlight/engine.rb +4 -17
  64. data/lib/spotlight/version.rb +1 -1
  65. data/lib/tasks/spotlight_tasks.rake +3 -3
  66. data/spec/factories/exhibits.rb +1 -1
  67. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a324cd5bd7ef8be554451b146fb0c5c33ca1342d025d7ea872849d4c5f998e0
4
- data.tar.gz: 54ffbf2d1e42fd09efd9eca2a057e99184f3644717486137e0007e02d358cdc2
3
+ metadata.gz: 4b9748a58737da3155547a7ae91de947638a30a54f8b69eb616ececa64d6a90a
4
+ data.tar.gz: 62915d1d008172d70a7a6374bda9672077b4454bbcb6a621a5055a7f8912ef8d
5
5
  SHA512:
6
- metadata.gz: c3f8450b4a44ea96e77bbc338d9fa9a4a63cf76dd528f5d4917ca9b453ab015f52650c657f627a18c1163c47e043b7b0bd8f5918ef05803ec730f22ecbbb44dc
7
- data.tar.gz: 930db0f811a7323c48eb89a439bc257edbe21cf92416aa1495f9b16e39e5b5da22bf2c8953c0a43be2386441dc7e6520923c772b350bba549616bffe050030a8
6
+ metadata.gz: 4a2607a1b105f87dbce17fa9569f9c1126d08d0bd75ef6db193e87bf38c06874cc0976f71bf946987881babd5da4da7dd00494cc77515837309059b20acf3cff
7
+ data.tar.gz: 474aa21fe721b381cd3aa220f29090f34101906aff760a3d829b9108b1fa03a3b18797b24376050ddd01d85202610fb824a80cdad4948fdcb6d78d3b292f948f
data/README.md CHANGED
@@ -78,9 +78,9 @@ See more detailed instructions for development environment setup at ["Contributi
78
78
  ## With Docker
79
79
 
80
80
  ```sh
81
- # because of how docker-compose handles named images, running `docker-compose up --build` will error when the Rails images have not been built locally
82
- docker-compose build
83
- docker-compose up
81
+ # because of how docker compose handles named images, running `docker compose up --build` will error when the Rails images have not been built locally
82
+ docker compose build
83
+ docker compose up
84
84
  ```
85
85
 
86
86
  ## Tests
@@ -5135,6 +5135,7 @@ jQuery.fn.scrollStop = function(callback) {
5135
5135
  };
5136
5136
 
5137
5137
  // Place all the behaviors and hooks related to the matching controller here.
5138
+ // All this logic will automatically be available in application.js.
5138
5139
 
5139
5140
  class Pages {
5140
5141
  connect(){
@@ -5601,6 +5602,8 @@ class CheckboxSubmit {
5601
5602
  }
5602
5603
 
5603
5604
  // Visibility toggle for items in an exhibit, based on Blacklight's bookmark toggle
5605
+ // See: https://github.com/projectblacklight/blacklight/blob/main/app/javascript/blacklight/bookmark_toggle.js
5606
+
5604
5607
 
5605
5608
  const VisibilityToggle = (e) => {
5606
5609
  if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
@@ -5927,10 +5930,24 @@ Spotlight$1.Block.Resources = (function(){
5927
5930
  formable: true,
5928
5931
  autocompleteable: true,
5929
5932
  show_heading: true,
5933
+ show_alt_text: true,
5930
5934
 
5931
5935
  title: function() { return i18n.t("blocks:" + this.type + ":title"); },
5932
5936
  description: function() { return i18n.t("blocks:" + this.type + ":description"); },
5933
-
5937
+ alt_text_guidelines: function() {
5938
+ if (this.show_alt_text) {
5939
+ return i18n.t("blocks:alt_text_guidelines:intro");
5940
+ }
5941
+ return "";
5942
+ },
5943
+ alt_text_guidelines_link: function() {
5944
+ if (this.show_alt_text) {
5945
+ var link_url = i18n.t("blocks:alt_text_guidelines:link_url");
5946
+ var link_label = i18n.t("blocks:alt_text_guidelines:link_label");
5947
+ return '<a target="_blank" href="' + link_url + '">' + link_label + '</a>';
5948
+ }
5949
+ return "";
5950
+ },
5934
5951
  icon_name: "resources",
5935
5952
  blockGroup: function() { return i18n.t("blocks:group:items") },
5936
5953
 
@@ -5940,6 +5957,8 @@ Spotlight$1.Block.Resources = (function(){
5940
5957
  show_secondary_field_key: "show-secondary-caption",
5941
5958
 
5942
5959
  display_checkbox: "display-checkbox",
5960
+ decorative_checkbox: "decorative-checkbox",
5961
+ alt_text_textarea: "alt-text-textarea",
5943
5962
 
5944
5963
  globalIndex: 0,
5945
5964
 
@@ -5947,6 +5966,13 @@ Spotlight$1.Block.Resources = (function(){
5947
5966
  return [];
5948
5967
  },
5949
5968
 
5969
+ _altTextFieldsHTML: function(index, data) {
5970
+ if (this.show_alt_text) {
5971
+ return this.altTextHTML(index, data);
5972
+ }
5973
+ return "";
5974
+ },
5975
+
5950
5976
  _itemPanel: function(data) {
5951
5977
  var index = "item_" + this.globalIndex++;
5952
5978
  var checked;
@@ -5977,6 +6003,7 @@ Spotlight$1.Block.Resources = (function(){
5977
6003
  <div class="main">
5978
6004
  <div class="title card-title">${data.title}</div>
5979
6005
  <div>${(data.slug || data.id)}</div>
6006
+ ${this._altTextFieldsHTML(index, data)}
5980
6007
  </div>
5981
6008
  <div class="remove float-right float-end">
5982
6009
  <a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
@@ -6013,6 +6040,7 @@ Spotlight$1.Block.Resources = (function(){
6013
6040
 
6014
6041
  createItemPanel: function(data) {
6015
6042
  var panel = this._itemPanel(data);
6043
+ this.attachAltTextHandlers(panel);
6016
6044
  $(panel).appendTo($('.panels > ol', this.inner));
6017
6045
  $('[data-behavior="nestable"]', this.inner).trigger('change');
6018
6046
  },
@@ -6045,11 +6073,67 @@ Spotlight$1.Block.Resources = (function(){
6045
6073
  return `<div class="form resources-admin clearfix">
6046
6074
  <div class="widget-header">
6047
6075
  ${this.description()}
6076
+ ${this.alt_text_guidelines()}
6077
+ ${this.alt_text_guidelines_link()}
6048
6078
  </div>
6049
6079
  ${this.content()}
6050
6080
  </div>`
6051
6081
  },
6052
6082
 
6083
+ _altTextData: function(data) {
6084
+ const isDecorative = data.decorative;
6085
+ const altText = isDecorative ? '' : (data.alt_text || '');
6086
+ const altTextBackup = data.alt_text_backup || '';
6087
+ const placeholderAttr = isDecorative ? '' : `placeholder="${i18n.t("blocks:resources:alt_text:placeholder")}"`;
6088
+ const disabledAttr = isDecorative ? 'disabled' : '';
6089
+
6090
+ return { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr };
6091
+ },
6092
+
6093
+ altTextHTML: function(index, data) {
6094
+ const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
6095
+ return `<div class="mt-2 pt-2 d-flex">
6096
+ <div class="me-2 mr-2">
6097
+ <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>
6098
+ <div class="form-check mb-1 justify-content-end">
6099
+ <input class="form-check-input" type="checkbox"
6100
+ id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
6101
+ <label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
6102
+ </div>
6103
+ </div>
6104
+ <div class="flex-grow-1 flex-fill d-flex">
6105
+ <input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
6106
+ <textarea class="form-control w-100" rows="2" ${placeholderAttr}
6107
+ id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
6108
+ </div>
6109
+ </div>`
6110
+ },
6111
+
6112
+ attachAltTextHandlers: function(panel) {
6113
+ if (this.show_alt_text) {
6114
+ const decorativeCheckbox = $('input[name$="[decorative]"]', panel);
6115
+ const altTextInput = $('textarea[name$="[alt_text]"]', panel);
6116
+ const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel);
6117
+
6118
+ decorativeCheckbox.on('change', function() {
6119
+ const isDecorative = this.checked;
6120
+ if (isDecorative) {
6121
+ altTextBackupInput.val(altTextInput.val());
6122
+ altTextInput.val('');
6123
+ } else {
6124
+ altTextInput.val(altTextBackupInput.val());
6125
+ }
6126
+ altTextInput
6127
+ .prop('disabled', isDecorative)
6128
+ .attr('placeholder', isDecorative ? '' : i18n.t("blocks:resources:alt_text:placeholder"));
6129
+ });
6130
+
6131
+ altTextInput.on('input', function() {
6132
+ $(this).data('lastValue', $(this).val());
6133
+ });
6134
+ }
6135
+ },
6136
+
6053
6137
  onBlockRender: function() {
6054
6138
  Module.init($('[data-behavior="nestable"]', this.inner));
6055
6139
 
@@ -6239,7 +6323,7 @@ SirTrevor.Blocks.BrowseGroupCategories = (function(){
6239
6323
  },
6240
6324
 
6241
6325
  item_options: function() { return `
6242
- '<label>
6326
+ <label>
6243
6327
  <input type="hidden" name="display-item-counts" value="false" />
6244
6328
  <input type="checkbox" name="display-item-counts" value="true" checked />
6245
6329
  ${i18n.t("blocks:browse_group_categories:item_counts")}
@@ -6674,7 +6758,7 @@ SirTrevor.Blocks.SolrDocumentsEmbed = (function(){
6674
6758
 
6675
6759
  return SirTrevor.Blocks.SolrDocumentsBase.extend({
6676
6760
  type: "solr_documents_embed",
6677
-
6761
+ show_alt_text: false,
6678
6762
  icon_name: "item_embed",
6679
6763
 
6680
6764
  item_options: function() { return "" },
@@ -6838,6 +6922,7 @@ SirTrevor.Blocks.UploadedItems = (function(){
6838
6922
  <label for="${this.formId('link_' + dataId)}" class="col-form-label col-md-3">${i18n.t("blocks:uploaded_items:link")}</label>
6839
6923
  <input type="text" class="form-control col" id="${this.formId('link_' + dataId)}" name="item[${index}][link]" data-field="link"/>
6840
6924
  </div>
6925
+ ${this._altTextFieldsHTML(index, data)}
6841
6926
  </div>
6842
6927
  <div class="remove float-right float-end">
6843
6928
  <a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
@@ -6865,6 +6950,8 @@ SirTrevor.Blocks.UploadedItems = (function(){
6865
6950
  return `<div class="form oembed-text-admin clearfix">
6866
6951
  <div class="widget-header">
6867
6952
  ${this.description()}
6953
+ ${this.alt_text_guidelines()}
6954
+ ${this.alt_text_guidelines_link()}
6868
6955
  </div>
6869
6956
  <div class="row">
6870
6957
  <div class="form-group mb-3 col-md-8">
@@ -6884,6 +6971,24 @@ SirTrevor.Blocks.UploadedItems = (function(){
6884
6971
  </div>`
6885
6972
  },
6886
6973
 
6974
+ altTextHTML: function(index, data) {
6975
+ const { isDecorative, altText, altTextBackup, placeholderAttr, disabledAttr } = this._altTextData(data);
6976
+ return `
6977
+ <div class="field row mr-3 me-3">
6978
+ <div class="col-lg-3 ps-md-2 pl-md-2">
6979
+ <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>
6980
+ <div class="form-check d-flex justify-content-md-start justify-content-lg-end">
6981
+ <input class="form-check-input" type="checkbox"
6982
+ id="${this.formId(this.decorative_checkbox + '_' + data.id)}" name="item[${index}][decorative]" ${isDecorative ? 'checked' : ''}>
6983
+ <label class="form-check-label" for="${this.formId(this.decorative_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:alt_text:decorative")}</label>
6984
+ </div>
6985
+ </div>
6986
+ <input type="hidden" name="item[${index}][alt_text_backup]" value="${altTextBackup}" />
6987
+ <textarea class="col-lg-9" rows="2" ${placeholderAttr}
6988
+ id="${this.formId(this.alt_text_textarea + '_' + data.id)}" name="item[${index}][alt_text]" ${disabledAttr}>${altText}</textarea>
6989
+ </div>`
6990
+ },
6991
+
6887
6992
  zpr_key: 'zpr_link'
6888
6993
  });
6889
6994
  })();
@@ -7094,6 +7199,11 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
7094
7199
  drag: "Drag",
7095
7200
  display: "Display?",
7096
7201
  remove: "Remove"
7202
+ },
7203
+ alt_text: {
7204
+ decorative: "Decorative",
7205
+ alternative_text: "Alternative text",
7206
+ placeholder: "Enter alt text for this item..."
7097
7207
  }
7098
7208
  },
7099
7209
 
@@ -7159,6 +7269,12 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
7159
7269
  group: {
7160
7270
  undefined: "Standard widgets",
7161
7271
  items: "Exhibit item widgets"
7272
+ },
7273
+
7274
+ alt_text_guidelines: {
7275
+ intro: 'For each item, please enter alternative text or appropriately check the decorative box. ',
7276
+ link_label: 'Guidelines for writing alt text.',
7277
+ link_url: 'https://www.w3.org/WAI/tutorials/images/'
7162
7278
  }
7163
7279
  });
7164
7280