blacklight-spotlight 4.3.6 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spotlight/spotlight.esm.js +20 -11
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  4. data/app/assets/javascripts/spotlight/spotlight.js +20 -11
  5. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  6. data/app/assets/stylesheets/spotlight/_accessibility.scss +9 -0
  7. data/app/assets/stylesheets/spotlight/_browse.scss +1 -0
  8. data/app/assets/stylesheets/spotlight/_mixins.scss +1 -0
  9. data/app/components/spotlight/edit_view_links_component.html.erb +13 -0
  10. data/app/components/spotlight/edit_view_links_component.rb +16 -0
  11. data/app/components/spotlight/solr_document_legacy_embed_component.rb +1 -1
  12. data/app/components/spotlight/tag_list_form_component.html.erb +1 -1
  13. data/app/controllers/spotlight/accessibility_controller.rb +48 -0
  14. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  15. data/app/helpers/spotlight/title_helper.rb +4 -0
  16. data/app/javascript/spotlight/admin/blocks/resources_block.js +16 -7
  17. data/app/javascript/spotlight/admin/blocks/solr_documents_embed_block.js +0 -1
  18. data/app/javascript/spotlight/admin/pages.js +1 -0
  19. data/app/javascript/spotlight/admin/visibility_toggle.js +1 -1
  20. data/app/javascript/spotlight/user/clear_form_button.js +2 -2
  21. data/app/models/sir_trevor_rails/block.rb +12 -0
  22. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +4 -0
  23. data/app/models/sir_trevor_rails/blocks/solr_documents_embed_block.rb +3 -0
  24. data/app/models/sir_trevor_rails/blocks/uploaded_items_block.rb +4 -0
  25. data/app/models/spotlight/custom_field.rb +1 -1
  26. data/app/services/spotlight/exhibit_import_export_service.rb +1 -0
  27. data/app/views/spotlight/accessibility/alt_text.html.erb +64 -0
  28. data/app/views/spotlight/browse/_search_box.html.erb +9 -11
  29. data/app/views/spotlight/dashboards/_page.html.erb +1 -9
  30. data/app/views/spotlight/exhibits/_form.html.erb +2 -2
  31. data/app/views/spotlight/feature_pages/_header.html.erb +1 -4
  32. data/app/views/spotlight/pages/_form.html.erb +1 -1
  33. data/app/views/spotlight/pages/_page.html.erb +1 -5
  34. data/app/views/spotlight/searches/_form.html.erb +3 -3
  35. data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +1 -0
  36. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +2 -2
  37. data/config/locales/spotlight.en.yml +11 -2
  38. data/config/routes.rb +2 -0
  39. data/lib/spotlight/version.rb +1 -1
  40. metadata +6 -2
@@ -64,10 +64,10 @@
64
64
  class ClearFormButton {
65
65
  connect() {
66
66
  var $clearBtn = $('.btn-reset');
67
- var $input = $clearBtn.parent().prev('input');
67
+ var $input = $clearBtn.prev('#browse_q');
68
68
  var btnCheck = function(){
69
69
  if ($input.val() !== '') {
70
- $clearBtn.css('display', 'inline-block');
70
+ $clearBtn.css('display', 'block');
71
71
  } else {
72
72
  $clearBtn.css('display', 'none');
73
73
  }
@@ -5166,6 +5166,7 @@
5166
5166
  var editor = new SirTrevor.Editor({
5167
5167
  el: instance[0],
5168
5168
  blockTypes: instance.data('blockTypes'),
5169
+ altTextSettings: instance.data('altTextSettings'),
5169
5170
  defaultType:["Text"],
5170
5171
  onEditorRender: function() {
5171
5172
  $.SerializedForm();
@@ -5615,7 +5616,7 @@
5615
5616
  if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
5616
5617
  const form = e.target.closest('form');
5617
5618
  if (form) {
5618
- new CheckboxSubmit(form).clicked(e);
5619
+ if (!Blacklight.BookmarkToggle) new CheckboxSubmit(form).clicked(e);
5619
5620
 
5620
5621
  // Add/remove the "private" label to the document row when visibility is toggled
5621
5622
  const docRow = form.closest('tr');
@@ -5936,18 +5937,16 @@
5936
5937
  formable: true,
5937
5938
  autocompleteable: true,
5938
5939
  show_heading: true,
5939
- show_alt_text: true,
5940
-
5941
5940
  title: function() { return i18n.t("blocks:" + this.type + ":title"); },
5942
5941
  description: function() { return i18n.t("blocks:" + this.type + ":description"); },
5943
- alt_text_guidelines: function() {
5944
- if (this.show_alt_text) {
5942
+ alt_text_guidelines: function() {
5943
+ if (this.showAltText()) {
5945
5944
  return i18n.t("blocks:alt_text_guidelines:intro");
5946
5945
  }
5947
5946
  return "";
5948
5947
  },
5949
5948
  alt_text_guidelines_link: function() {
5950
- if (this.show_alt_text) {
5949
+ if (this.showAltText()) {
5951
5950
  var link_url = i18n.t("blocks:alt_text_guidelines:link_url");
5952
5951
  var link_label = i18n.t("blocks:alt_text_guidelines:link_label");
5953
5952
  return '<a target="_blank" href="' + link_url + '">' + link_label + '</a>';
@@ -5973,12 +5972,23 @@
5973
5972
  },
5974
5973
 
5975
5974
  _altTextFieldsHTML: function(index, data) {
5976
- if (this.show_alt_text) {
5975
+ if (this.showAltText()) {
5977
5976
  return this.altTextHTML(index, data);
5978
5977
  }
5979
5978
  return "";
5980
5979
  },
5981
5980
 
5981
+ showAltText: function() {
5982
+ return this.editorOptions.altTextSettings[this._typeAsCamelCase()]
5983
+ },
5984
+
5985
+ _typeAsCamelCase: function() {
5986
+ return this.type
5987
+ .split('_')
5988
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
5989
+ .join('');
5990
+ },
5991
+
5982
5992
  _itemPanel: function(data) {
5983
5993
  var index = "item_" + this.globalIndex++;
5984
5994
  var checked;
@@ -6116,7 +6126,7 @@
6116
6126
  },
6117
6127
 
6118
6128
  attachAltTextHandlers: function(panel) {
6119
- if (this.show_alt_text) {
6129
+ if (this.showAltText()) {
6120
6130
  const decorativeCheckbox = $('input[name$="[decorative]"]', panel);
6121
6131
  const altTextInput = $('textarea[name$="[alt_text]"]', panel);
6122
6132
  const altTextBackupInput = $('input[name$="[alt_text_backup]"]', panel);
@@ -6764,7 +6774,6 @@
6764
6774
 
6765
6775
  return SirTrevor.Blocks.SolrDocumentsBase.extend({
6766
6776
  type: "solr_documents_embed",
6767
- show_alt_text: false,
6768
6777
  icon_name: "item_embed",
6769
6778
 
6770
6779
  item_options: function() { return "" },