blacklight-spotlight 4.5.0 → 4.6.1

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/images/spotlight/blocks/sir-trevor-icons.svg +1 -1
  3. data/app/assets/javascripts/spotlight/spotlight.esm.js +19 -22
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  5. data/app/assets/javascripts/spotlight/spotlight.js +19 -22
  6. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  7. data/app/assets/stylesheets/spotlight/_blacklight_configuration.scss +5 -4
  8. data/app/assets/stylesheets/spotlight/_browse.scss +27 -12
  9. data/app/components/spotlight/bulk_action_component.html.erb +8 -0
  10. data/app/components/spotlight/bulk_action_component.rb +20 -0
  11. data/app/components/spotlight/header_navigation_link_component.html.erb +1 -0
  12. data/app/components/spotlight/header_navigation_link_component.rb +14 -0
  13. data/app/components/spotlight/save_search_component.html.erb +25 -0
  14. data/app/components/spotlight/save_search_component.rb +25 -0
  15. data/app/components/spotlight/translations/subheading_component.html.erb +3 -0
  16. data/app/components/spotlight/translations/subheading_component.rb +17 -0
  17. data/app/controllers/spotlight/accessibility_controller.rb +1 -3
  18. data/app/helpers/spotlight/application_helper.rb +6 -7
  19. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  20. data/app/javascript/spotlight/admin/blacklight_configuration.js +18 -21
  21. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +2 -2
  22. data/app/models/spotlight/page_configurations.rb +2 -1
  23. data/app/views/catalog/_bulk_actions.html.erb +1 -10
  24. data/app/views/catalog/_save_search.html.erb +1 -25
  25. data/app/views/shared/_about_navbar.html.erb +1 -1
  26. data/app/views/shared/_browse_navbar.html.erb +1 -1
  27. data/app/views/shared/_curated_features_navbar.html.erb +4 -1
  28. data/app/views/spotlight/accessibility/alt_text.html.erb +1 -7
  29. data/app/views/spotlight/admin_users/index.html.erb +2 -2
  30. data/app/views/spotlight/metadata_configurations/edit.html.erb +12 -2
  31. data/app/views/spotlight/translations/_general.html.erb +2 -6
  32. data/app/views/spotlight/translations/_metadata.html.erb +1 -3
  33. data/app/views/spotlight/translations/_pages.html.erb +4 -9
  34. data/app/views/spotlight/translations/_search_fields.html.erb +3 -9
  35. data/config/locales/spotlight.en.yml +1 -1
  36. data/lib/generators/spotlight/templates/spotlight.scss +0 -1
  37. data/lib/spotlight/engine.rb +7 -0
  38. data/lib/spotlight/version.rb +1 -1
  39. metadata +10 -3
  40. data/app/assets/stylesheets/spotlight/_variables_bootstrap.scss +0 -7
@@ -4058,54 +4058,51 @@
4058
4058
 
4059
4059
  class BlacklightConfiguration {
4060
4060
  connect() {
4061
- // Add Select/Deselect all button behavior
4061
+ // Add Select/Deselect all input behavior
4062
4062
  this.addCheckboxToggleBehavior();
4063
4063
  this.addEnableToggleBehavior();
4064
4064
  }
4065
4065
 
4066
- // Add Select/Deselect all button behavior
4066
+ // Add Select/Deselect all behavior for metadata field names for a given view e.g. Item details.
4067
4067
  addCheckboxToggleBehavior() {
4068
4068
  $("[data-behavior='metadata-select']").each(function(){
4069
- var button = $(this);
4070
- var parentCell = button.parents("th");
4069
+ var selectCheckbox = $(this);
4070
+ var parentCell = selectCheckbox.parents("th");
4071
4071
  var table = parentCell.closest("table");
4072
4072
  var columnRows = $("tr td:nth-child(" + (parentCell.index() + 1) + ")", table);
4073
4073
  var checkboxes = $("input[type='checkbox']", columnRows);
4074
- swapSelectAllButtonText(button, columnRows);
4075
- // Add the check/uncheck behavior to the button
4076
- // and swap the button text if necessary
4077
- button.on('click', function(e){
4078
- e.preventDefault();
4074
+ updateSelectAllInput(selectCheckbox, columnRows);
4075
+ // Add the check/uncheck behavior to the select/deselect all checkbox
4076
+ selectCheckbox.on('click', function(e){
4079
4077
  var allChecked = allCheckboxesChecked(columnRows);
4080
4078
  columnRows.each(function(){
4081
4079
  $("input[type='checkbox']", $(this)).prop('checked', !allChecked);
4082
- swapSelectAllButtonText(button, columnRows);
4083
4080
  });
4084
4081
  });
4085
- // Swap button text when a checkbox value changes
4082
+ // When a single checkbox is selected/unselected, the "All" checkbox should be updated accordingly.
4086
4083
  checkboxes.each(function(){
4087
4084
  $(this).on('change', function(){
4088
- swapSelectAllButtonText(button, columnRows);
4085
+ updateSelectAllInput(selectCheckbox, columnRows);
4089
4086
  });
4090
- });
4087
+ });
4091
4088
  });
4089
+
4092
4090
  // Check number of checkboxes against the number of checked
4093
4091
  // checkboxes to determine if all of them are checked or not
4094
4092
  function allCheckboxesChecked(elements) {
4095
4093
  return ($("input[type='checkbox']", elements).length == $("input[type='checkbox']:checked", elements).length)
4096
4094
  }
4097
- // Swap the button text to "Deselect all"
4098
- // when all the checkboxes are checked and
4099
- // "Select all" when any are unchecked
4100
- function swapSelectAllButtonText(button, elements) {
4095
+
4096
+ // Check or uncheck the "All" checkbox for each view column, e.g. Item details, List, etc.
4097
+ function updateSelectAllInput(checkbox, elements) {
4101
4098
  if ( allCheckboxesChecked(elements) ) {
4102
- button.text(button.data('deselect-text'));
4099
+ checkbox.prop('checked', true);
4103
4100
  } else {
4104
- button.text(button.data('select-text'));
4101
+ checkbox.prop('checked', false);
4105
4102
  }
4106
4103
  }
4107
4104
  }
4108
-
4105
+
4109
4106
  addEnableToggleBehavior() {
4110
4107
  $("[data-behavior='enable-feature']").each(function(){
4111
4108
  var checkbox = $(this);
@@ -6978,8 +6975,8 @@
6978
6975
  </div>
6979
6976
  <div class="col-md-4">
6980
6977
  <input name="${this.zpr_key}" type="hidden" value="false" />
6981
- <input name="${this.zpr_key}" id="${this.formId(this.zpr_key)}" data-key=${this.zpr_key}" type="checkbox" value="true" />
6982
- <label for="${this.formId(this.zpr_key)}">${ i18n.t("blocks:solr_documents:zpr:title")}</label>
6978
+ <input name="${this.zpr_key}" id="${this.formId(this.zpr_key)}" data-key="${this.zpr_key}" type="checkbox" value="true" />
6979
+ <label for="${this.formId(this.zpr_key)}">${i18n.t("blocks:solr_documents:zpr:title")}</label>
6983
6980
  </div>
6984
6981
  </div>
6985
6982
  ${this.text_area()}