blacklight 7.19.0 → 7.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +19 -1
  4. data/.rubocop.yml +4 -0
  5. data/README.md +1 -1
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/blacklight/blacklight.js +14 -5
  8. data/app/assets/stylesheets/blacklight/_balanced_list.scss +2 -2
  9. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +1 -1
  10. data/app/assets/stylesheets/blacklight/_constraints.scss +8 -5
  11. data/app/assets/stylesheets/blacklight/_controls.scss +9 -1
  12. data/app/assets/stylesheets/blacklight/_facets.scss +5 -3
  13. data/app/assets/stylesheets/blacklight/_header.scss +6 -1
  14. data/app/assets/stylesheets/blacklight/_pagination.scss +1 -1
  15. data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +1 -0
  16. data/app/components/blacklight/constraint_layout_component.html.erb +1 -1
  17. data/app/components/blacklight/constraints_component.html.erb +2 -2
  18. data/app/components/blacklight/constraints_component.rb +6 -2
  19. data/app/components/blacklight/document_component.rb +4 -4
  20. data/app/components/blacklight/facet_field_component.html.erb +3 -1
  21. data/app/components/blacklight/facet_field_no_layout_component.rb +1 -1
  22. data/app/components/blacklight/facet_item_component.rb +4 -4
  23. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  24. data/app/components/blacklight/metadata_field_layout_component.rb +1 -1
  25. data/app/components/blacklight/response/facet_group_component.html.erb +2 -0
  26. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  27. data/app/components/blacklight/response/view_type_component.html.erb +1 -1
  28. data/app/components/blacklight/search_bar_component.html.erb +3 -3
  29. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  30. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  31. data/app/components/blacklight/system/modal_component.html.erb +1 -1
  32. data/app/controllers/concerns/blacklight/bookmarks.rb +0 -3
  33. data/app/controllers/concerns/blacklight/catalog.rb +3 -0
  34. data/app/controllers/concerns/blacklight/controller.rb +9 -5
  35. data/app/controllers/concerns/blacklight/search_context.rb +1 -1
  36. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -3
  37. data/app/helpers/blacklight/component_helper_behavior.rb +1 -1
  38. data/app/javascript/blacklight/core.js +8 -1
  39. data/app/javascript/blacklight/modal.js +1 -1
  40. data/app/javascript/blacklight/search_context.js +5 -2
  41. data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
  42. data/app/views/bookmarks/index.html.erb +1 -1
  43. data/app/views/catalog/_constraints.html.erb +2 -2
  44. data/app/views/catalog/_home_text.html.erb +3 -3
  45. data/app/views/catalog/_paginate_compact.html.erb +1 -0
  46. data/app/views/catalog/_per_page_widget.html.erb +1 -1
  47. data/app/views/catalog/_search_results.html.erb +2 -2
  48. data/app/views/search_history/index.html.erb +1 -1
  49. data/app/views/shared/_header_navbar.html.erb +3 -3
  50. data/blacklight.gemspec +4 -2
  51. data/config/locales/blacklight.ar.yml +2 -2
  52. data/config/locales/blacklight.ca.yml +2 -2
  53. data/config/locales/blacklight.de.yml +6 -4
  54. data/config/locales/blacklight.en.yml +8 -4
  55. data/config/locales/blacklight.es.yml +5 -3
  56. data/config/locales/blacklight.fr.yml +5 -3
  57. data/config/locales/blacklight.hu.yml +2 -2
  58. data/config/locales/blacklight.it.yml +5 -3
  59. data/config/locales/blacklight.nl.yml +2 -2
  60. data/config/locales/blacklight.pt-BR.yml +1 -1
  61. data/config/locales/blacklight.sq.yml +2 -2
  62. data/config/locales/blacklight.zh.yml +2 -2
  63. data/lib/blacklight/search_state/filter_field.rb +9 -0
  64. data/lib/blacklight/solr/request.rb +10 -7
  65. data/lib/blacklight/solr/response/group_response.rb +3 -2
  66. data/lib/blacklight/solr/response/pagination_methods.rb +1 -1
  67. data/lib/blacklight/solr/search_builder_behavior.rb +37 -17
  68. data/lib/blacklight.rb +5 -1
  69. data/lib/generators/blacklight/assets_generator.rb +4 -2
  70. data/lib/generators/blacklight/install_generator.rb +4 -1
  71. data/lib/generators/blacklight/user_generator.rb +1 -1
  72. data/package.json +2 -2
  73. data/spec/components/blacklight/constraint_layout_component_spec.rb +3 -7
  74. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +3 -7
  75. data/spec/components/blacklight/facet_field_list_component_spec.rb +3 -7
  76. data/spec/components/blacklight/facet_item_component_spec.rb +8 -8
  77. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +3 -7
  78. data/spec/components/blacklight/hidden_search_state_component_spec.rb +7 -8
  79. data/spec/components/blacklight/metadata_field_component_spec.rb +4 -8
  80. data/spec/features/axe_spec.rb +34 -0
  81. data/spec/features/facet_missing_spec.rb +59 -0
  82. data/spec/features/facets_spec.rb +3 -3
  83. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +3 -3
  84. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +2 -2
  85. data/spec/lib/blacklight/search_state/filter_field_spec.rb +27 -0
  86. data/spec/models/blacklight/solr/request_spec.rb +0 -1
  87. data/spec/models/blacklight/solr/response/group_response_spec.rb +3 -2
  88. data/spec/models/blacklight/solr/search_builder_spec.rb +27 -1
  89. data/spec/spec_helper.rb +16 -9
  90. data/spec/support/view_component_capybara_test_helpers.rb +8 -0
  91. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -3
  92. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -2
  93. metadata +45 -11
@@ -1,4 +1,4 @@
1
1
  <%= link_to bookmarks_path, id:'bookmarks_nav', class: 'nav-link' do %>
2
2
  <%= t('blacklight.header_links.bookmarks') %>
3
- <span class="badge badge-secondary" data-role='bookmark-counter'><%= current_or_guest_user.bookmarks.count %></span>
3
+ <span class="badge badge-secondary bg-secondary" data-role='bookmark-counter'><%= current_or_guest_user.bookmarks.count %></span>
4
4
  <% end %>
@@ -13,7 +13,7 @@
13
13
  <% else %>
14
14
  <%= render 'sort_and_per_page' %>
15
15
  <%= render partial: 'tools', locals: { document_list: @response.documents } %>
16
- <h2 class='section-heading sr-only'><%= t('blacklight.bookmarks.list_title') %></h2>
16
+ <h2 class='section-heading sr-only visually-hidden'><%= t('blacklight.bookmarks.list_title') %></h2>
17
17
  <%= render_document_index %>
18
18
  <%= render 'results_pagination' %>
19
19
  <% end %>
@@ -4,10 +4,10 @@
4
4
  <% Deprecation.warn(Blacklight::RenderConstraintsHelperBehavior, 'Constraints helpers or partials were overridden; not using components') %>
5
5
  <% if Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) { query_has_constraints? } %>
6
6
  <div id="appliedParams" class="clearfix constraints-container">
7
- <h2 class="sr-only"><%= t('blacklight.search.search_constraints_header') %></h2>
7
+ <h2 class="sr-only visually-hidden"><%= t('blacklight.search.search_constraints_header') %></h2>
8
8
 
9
9
  <%= render 'start_over' %>
10
- <span class="constraints-label sr-only"><%= t('blacklight.search.filters.title') %></span>
10
+ <span class="constraints-label sr-only visually-hidden"><%= t('blacklight.search.filters.title') %></span>
11
11
  <%= render_constraints(controller.params != params ? params : search_state) %>
12
12
  </div>
13
13
  <% end %>
@@ -1,11 +1,11 @@
1
- <div class="jumbotron text-center">
1
+ <div class="jumbotron text-center p-5 mb-4 bg-light rounded-3">
2
2
  <h1 class="jumbotron-heading"><%= t('blacklight.welcome') %></h1>
3
3
 
4
4
  <p class="lead">Blacklight is a multi-institutional open-source collaboration building a better discovery platform framework.</p>
5
5
 
6
6
  <p>
7
7
  <%= link_to 'Read the Documentation', 'https://github.com/projectblacklight/blacklight/wiki', class: 'btn btn-primary' %>
8
- <%= link_to 'See Examples', 'http://projectblacklight.org', class: 'btn btn-outline-secondary' %>
8
+ <%= link_to 'See Examples', 'http://projectblacklight.org', class: 'btn btn-light' %>
9
9
  </p>
10
10
  </div>
11
11
 
@@ -31,7 +31,7 @@
31
31
 
32
32
  <%# This is the same panel shown in the Rails welcome template %>
33
33
  <div id="about" class="card">
34
- <h2 class='card-header collapsed collapse-toggle' data-toggle="collapse" data-target="#about-content"><a href="/rails/info/properties">About your application&rsquo;s environment</a></h2>
34
+ <h2 class='card-header collapsed collapse-toggle' data-toggle="collapse" data-bs-toggle="collapse" data-bs-target="#about-content" data-target="#about-content"><a href="/rails/info/properties">About your application&rsquo;s environment</a></h2>
35
35
  <div id="about-content" class="card-body collapse"></div>
36
36
  </div>
37
37
 
@@ -2,5 +2,6 @@
2
2
  response: paginate_compact,
3
3
  theme: :blacklight_compact,
4
4
  page_entries_info: page_entries_info(paginate_compact),
5
+ role: nil,
5
6
  html: { aria: {} })
6
7
  %>
@@ -1,5 +1,5 @@
1
1
  <% if show_sort_and_per_page? %>
2
- <span class="sr-only"><%= t('blacklight.search.per_page.title') %></span>
2
+ <span class="sr-only visually-hidden"><%= t('blacklight.search.per_page.title') %></span>
3
3
  <%= render(Blacklight::System::DropdownComponent.new(
4
4
  param: :per_page,
5
5
  choices: per_page_options_for_select,
@@ -12,14 +12,14 @@
12
12
  <% end %>
13
13
 
14
14
  <% content_for(:container_header) do -%>
15
- <h1 class="sr-only top-content-title"><%= t('blacklight.search.header') %></h1>
15
+ <h1 class="sr-only visually-hidden top-content-title"><%= t('blacklight.search.header') %></h1>
16
16
 
17
17
  <%= render 'constraints' %>
18
18
  <% end %>
19
19
 
20
20
  <%= render 'search_header' %>
21
21
 
22
- <h2 class="sr-only"><%= t('blacklight.search.search_results') %></h2>
22
+ <h2 class="sr-only visually-hidden"><%= t('blacklight.search.search_results') %></h2>
23
23
 
24
24
  <%- if @response.empty? %>
25
25
  <%= render "zero_results" %>
@@ -9,7 +9,7 @@
9
9
  blacklight.clear_search_history_path,
10
10
  method: :delete,
11
11
  data: { confirm: t('blacklight.search_history.clear.action_confirm') },
12
- class: 'btn btn-danger float-md-right' %>
12
+ class: 'btn btn-danger float-md-right float-md-end' %>
13
13
  <h2 class='section-heading'><%= t('blacklight.search_history.recent') %></h2>
14
14
  <table class="table table-striped search-history">
15
15
  <% @searches.each_with_index do |search,index| %>
@@ -1,7 +1,7 @@
1
1
  <nav class="navbar navbar-expand-md navbar-dark bg-dark topbar" role="navigation">
2
2
  <div class="<%= container_classes %>">
3
3
  <%= link_to application_name, root_path, class: 'mb-0 navbar-brand navbar-logo' %>
4
- <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
4
+ <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-bs-toggle="collapse" data-target="#user-util-collapse" data-bs-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
5
5
  <span class="navbar-toggler-icon"></span>
6
6
  </button>
7
7
 
@@ -11,8 +11,8 @@
11
11
  </div>
12
12
  </nav>
13
13
 
14
- <div class="navbar-search navbar navbar-light bg-light" role="navigation">
14
+ <%= content_tag :div, class: 'navbar-search navbar navbar-light bg-light', role: 'navigation', aria: { label: t('blacklight.search.header') } do %>
15
15
  <div class="<%= container_classes %>">
16
16
  <%= render_search_bar %>
17
17
  </div>
18
- </div>
18
+ <% end %>
data/blacklight.gemspec CHANGED
@@ -32,14 +32,16 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency "deprecation"
33
33
  s.add_dependency "i18n", '>= 1.7.0' # added named parameters
34
34
  s.add_dependency "ostruct", '>= 0.3.2'
35
- s.add_dependency "view_component", '>= 2.28.0'
35
+ s.add_dependency "view_component", '~> 2.42'
36
36
 
37
37
  s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
38
38
  s.add_development_dependency "rspec-rails", "~> 4.0.0.beta2"
39
39
  s.add_development_dependency "rspec-its"
40
40
  s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
41
+ s.add_development_dependency 'axe-core-rspec'
41
42
  s.add_development_dependency "capybara", '~> 3'
42
- s.add_development_dependency 'apparition'
43
+ s.add_development_dependency 'webdrivers'
44
+ s.add_development_dependency 'selenium-webdriver'
43
45
  s.add_development_dependency 'engine_cart', '~> 2.1'
44
46
  s.add_development_dependency "equivalent-xml"
45
47
  s.add_development_dependency "simplecov"
@@ -157,7 +157,7 @@ ar:
157
157
  request_error: "معذرة، لم أفهم ما تبحث عنه."
158
158
  invalid_solr_id: "معذرة! لقد طلبت سجلًا غير موجود."
159
159
  per_page:
160
- label: '%{count}<span class="sr-only"> لكل صفحة</span>'
160
+ label: '%{count}<span class="sr-only visually-hidden"> لكل صفحة</span>'
161
161
  button_label: '%{count} لكل صفحة' # TODO: Remove during major release
162
162
  button_label_html: '%{count}<span class="d-none d-sm-inline"> لكل صفحة</span>'
163
163
  title: 'عدد النتائج المعروضة في الصفحة'
@@ -209,7 +209,7 @@ ar:
209
209
  count: 'ترتيب رقمي'
210
210
  index: 'ترتيب أبجدي'
211
211
  count: '%{number}'
212
- more_html: 'المزيد <span class="sr-only">%{field_name}</span> »'
212
+ more_html: 'المزيد <span class="sr-only visually-hidden">%{field_name}</span> »'
213
213
  selected:
214
214
  remove: '[إزالة]'
215
215
  missing: "[غير موجود]"
@@ -147,7 +147,7 @@ ca:
147
147
  request_error: "No ha estat possible entendre la cerca"
148
148
  invalid_solr_id: "El registre que heu sol·licitat no existeix."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> per pàgina</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> per pàgina</span>'
151
151
  button_label: '%{count} per pàgina' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per pàgina</span>'
153
153
  title: 'Nombre de resultats a mostrar per pàgina'
@@ -189,7 +189,7 @@ ca:
189
189
  count: 'Numèricament'
190
190
  index: 'Alfabèticament'
191
191
  count: '%{number}'
192
- more_html: 'més <span class="sr-only">%{field_name}</span> »'
192
+ more_html: 'més <span class="sr-only visually-hidden">%{field_name}</span> »'
193
193
  selected:
194
194
  remove: '[eliminar]'
195
195
  missing: "[Desaparegut]"
@@ -147,7 +147,7 @@ de:
147
147
  request_error: "Entschuldigung, ich habe Ihre Suche nicht verstanden."
148
148
  invalid_solr_id: "Entschuldigung, Sie haben einen nicht vorhandenen Datensatz angefordert."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> pro Seite</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> pro Seite</span>'
151
151
  button_label: '%{count} pro Seite' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> pro Seite</span>'
153
153
  title: 'Anzahl der Ergebnisse, die pro Seite angezeigt werden'
@@ -169,7 +169,7 @@ de:
169
169
  pagination:
170
170
  title: 'Ergebnisse Navigation'
171
171
  pagination_info:
172
- no_items_found: 'Kein %{entry_name} gefunden'
172
+ no_items_found: 'Keine %{entry_name} gefunden'
173
173
  single_item_found: '<strong>1</strong> %{entry_name} gefunden'
174
174
  pages:
175
175
  one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> von <strong>%{total_num}</strong>'
@@ -190,7 +190,7 @@ de:
190
190
  count: 'Numerisch ordnen'
191
191
  index: 'A-Z Ordnen'
192
192
  count: '%{number}'
193
- more_html: 'mehr <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'mehr <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[entfernen]'
196
196
  missing: [fehlt]
@@ -230,7 +230,9 @@ de:
230
230
  list: "Liste"
231
231
 
232
232
  entry_name:
233
- default: 'Eintrag'
233
+ default:
234
+ one: Eintrag
235
+ other: Enträge
234
236
  grouped:
235
237
  default: 'gruppiertes Ergebnis'
236
238
 
@@ -147,7 +147,7 @@ en:
147
147
  request_error: "Sorry, I don't understand your search."
148
148
  invalid_solr_id: "Sorry, you have requested a record that doesn't exist."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> per page</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> per page</span>'
151
151
  button_label: '%{count} per page' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per page</span>'
153
153
  title: 'Number of results to display per page'
@@ -189,7 +189,7 @@ en:
189
189
  count: 'Numerical Sort'
190
190
  index: 'A-Z Sort'
191
191
  count: '%{number}'
192
- more_html: 'more <span class="sr-only">%{field_name}</span> »'
192
+ more_html: 'more <span class="sr-only visually-hidden">%{field_name}</span> »'
193
193
  selected:
194
194
  remove: '[remove]'
195
195
  missing: "[Missing]"
@@ -230,9 +230,13 @@ en:
230
230
  list: "List"
231
231
 
232
232
  entry_name:
233
- default: 'entry'
233
+ default:
234
+ one: 'entry'
235
+ other: 'entries'
234
236
  grouped:
235
- default: 'grouped result'
237
+ default:
238
+ one: 'grouped result'
239
+ other: 'grouped results'
236
240
 
237
241
  did_you_mean: 'Did you mean to type: %{options}?'
238
242
 
@@ -147,7 +147,7 @@ es:
147
147
  request_error: "Lo siento, no entiendo esta búsqueda"
148
148
  invalid_solr_id: "Lo sentimos, usted ha solicitado un registro que no existe."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> por página</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> por página</span>'
151
151
  button_label: '%{count} por página' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> por página</span>'
153
153
  title: 'El número de resultados a mostrar por página'
@@ -190,7 +190,7 @@ es:
190
190
  count: 'Ordenación numérica'
191
191
  index: 'Ordenación A-Z'
192
192
  count: '%{number}'
193
- more_html: 'más <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'más <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[borrar]'
196
196
  missing: '[Falta]'
@@ -230,7 +230,9 @@ es:
230
230
  list: "Lista"
231
231
 
232
232
  entry_name:
233
- default: 'entrada'
233
+ default:
234
+ one: 'entrada'
235
+ other: 'entradas'
234
236
  grouped:
235
237
  default: 'resultado agrupado'
236
238
 
@@ -150,7 +150,7 @@ fr:
150
150
  request_error: "Pardon, nous n'avons pas compris votre recherche."
151
151
  invalid_solr_id: "Vous avez demandé une notice qui n'existe pas."
152
152
  per_page:
153
- label: '%{count}<span class="sr-only"> par page</span>'
153
+ label: '%{count}<span class="sr-only visually-hidden"> par page</span>'
154
154
  button_label: '%{count} par page' # TODO: Remove during major release
155
155
  button_label_html: '%{count}<span class="d-none d-sm-inline"> par page</span>'
156
156
  title: 'Nombre de résultats à afficher par page'
@@ -193,7 +193,7 @@ fr:
193
193
  count: 'Du + au - fréquent'
194
194
  index: 'Tri de A à Z'
195
195
  count: '%{number}'
196
- more_html: 'plus <span class="sr-only">%{field_name}</span> »'
196
+ more_html: 'plus <span class="sr-only visually-hidden">%{field_name}</span> »'
197
197
  selected:
198
198
  remove: '[ X ]'
199
199
  missing: '[manquante]'
@@ -234,7 +234,9 @@ fr:
234
234
 
235
235
 
236
236
  entry_name:
237
- default: 'résultat'
237
+ default:
238
+ one: 'résultat'
239
+ other: 'résultats'
238
240
  grouped:
239
241
  default: 'résultat groupé'
240
242
 
@@ -147,7 +147,7 @@ hu:
147
147
  request_error: "Elnézést, nem tudom értelmezni a keresést."
148
148
  invalid_solr_id: "Elnézést, de az Ön által kért rekord nem létezik."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> oldalanként</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> oldalanként</span>'
151
151
  button_label: '%{count} oldalanként' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> oldalanként</span>'
153
153
  title: 'Az eredmények száma oldalanként'
@@ -190,7 +190,7 @@ hu:
190
190
  count: 'Numerikus rendezés'
191
191
  index: 'A-Z rendezés'
192
192
  count: '%{number}'
193
- more_html: 'több <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'több <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[eltávolítás]'
196
196
  missing: "[Hiányzó]"
@@ -147,7 +147,7 @@ it:
147
147
  request_error: "La richiesta non è comprensibile."
148
148
  invalid_solr_id: "Il numero di scheda richiesto non esiste."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> per pagina</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> per pagina</span>'
151
151
  button_label: '%{count} per pagina' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per pagina</span>'
153
153
  title: 'Risultati per pagina'
@@ -190,7 +190,7 @@ it:
190
190
  count: 'Ordina per numero'
191
191
  index: 'Ordina A-Z'
192
192
  count: '%{number}'
193
- more_html: 'altri <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'altri <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[cancella]'
196
196
  missing: [Mancante]
@@ -230,7 +230,9 @@ it:
230
230
  list: "Lista"
231
231
 
232
232
  entry_name:
233
- default: 'termine di ricerca'
233
+ default:
234
+ one: 'termine di ricerca'
235
+ other: 'termini di ricerca'
234
236
  grouped:
235
237
  default: 'risultato raggruppato'
236
238
 
@@ -147,7 +147,7 @@ nl:
147
147
  request_error: "Sorry, ik kon uw zoekopdracht niet begrijpen."
148
148
  invalid_solr_id: "Sorry, u vroeg een onbestaande record op."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> per pagina</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> per pagina</span>'
151
151
  button_label: '%{count} per pagina' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> per pagina</span>'
153
153
  title: 'Toon aantal zoekresultaten per pagina'
@@ -190,7 +190,7 @@ nl:
190
190
  count: 'Numeriek sorteren'
191
191
  index: 'A-Z Sorteren'
192
192
  count: '%{number}'
193
- more_html: 'Meer <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'Meer <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[verwijder]'
196
196
  missing: "[Ontbrekend]"
@@ -191,7 +191,7 @@ pt-BR:
191
191
  count: 'Ordenar por Número'
192
192
  index: 'Ordem Alfabética A-Z'
193
193
  count: '%{number}'
194
- more_html: 'mais <span class="sr-only">%{field_name}</span> »'
194
+ more_html: 'mais <span class="sr-only visually-hidden">%{field_name}</span> »'
195
195
  selected:
196
196
  remove: '[remover]'
197
197
  missing: [Ausência]
@@ -147,7 +147,7 @@ sq:
147
147
  request_error: "Na vjen keq, unë nuk e kuptoj kërkimin tuaj."
148
148
  invalid_solr_id: "Na vjen keq, ju keni kërkuar një të dhënë që nuk ekziston."
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> për faqe</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> për faqe</span>'
151
151
  button_label: '%{count} për faqe' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> për faqe</span>'
153
153
  title: 'Numri i rezultateve që do të shfaqen për faqe'
@@ -190,7 +190,7 @@ sq:
190
190
  count: 'Renditja numerike'
191
191
  index: 'A-Z Renditja'
192
192
  count: '%{number}'
193
- more_html: 'Më shumë <span class="sr-only">%{field_name}</span> »'
193
+ more_html: 'Më shumë <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[fshije]'
196
196
  missing: "[Mungon]"
@@ -147,7 +147,7 @@ zh:
147
147
  request_error: "抱歉,我不明白你要找什么。"
148
148
  invalid_solr_id: "抱歉,你要找的结果不存在。"
149
149
  per_page:
150
- label: '%{count}<span class="sr-only"> 每页</span>'
150
+ label: '%{count}<span class="sr-only visually-hidden"> 每页</span>'
151
151
  button_label: '%{count} 每页' # TODO: Remove during major release
152
152
  button_label_html: '%{count}<span class="d-none d-sm-inline"> 每页</span>'
153
153
  title: '每页显示结果数'
@@ -190,7 +190,7 @@ zh:
190
190
  count: '按数量排序'
191
191
  index: '按字母排序'
192
192
  count: '%{number}'
193
- more_html: '更多 <span class="sr-only">%{field_name}</span> »'
193
+ more_html: '更多 <span class="sr-only visually-hidden">%{field_name}</span> »'
194
194
  selected:
195
195
  remove: '[删除]'
196
196
  missing: "[未找到]"
@@ -83,10 +83,19 @@ module Blacklight
83
83
  Deprecation.warn(self, 'Normalizing parameters in FilterField#remove is deprecated')
84
84
  collection = collection.values
85
85
  end
86
+
86
87
  params[param][key] = collection - Array(value)
87
88
  params[param].delete(key) if params[param][key].empty?
88
89
  params.delete(param) if params[param].empty?
89
90
 
91
+ # Handle missing field queries.
92
+ missing = I18n.t("blacklight.search.facets.missing")
93
+ if (item.respond_to?(:fq) && item.fq == "-#{key}:[* TO *]") ||
94
+ item == missing
95
+ params[param].delete("-#{key}:")
96
+ params[param].delete(key) if params[param][key] == [""]
97
+ end
98
+
90
99
  new_state.reset(params)
91
100
  end
92
101
 
@@ -2,7 +2,10 @@
2
2
  class Blacklight::Solr::InvalidParameter < ArgumentError; end
3
3
 
4
4
  class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
5
+ # @deprecated
5
6
  SINGULAR_KEYS = %w(facet fl q qt rows start spellcheck spellcheck.q sort per_page wt hl group defType)
7
+
8
+ # @deprecated
6
9
  ARRAY_KEYS = %w(facet.field facet.query facet.pivot fq hl.fl)
7
10
 
8
11
  def initialize(constructor = {})
@@ -12,9 +15,6 @@ class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
12
15
  else
13
16
  super(constructor)
14
17
  end
15
- ARRAY_KEYS.each do |key|
16
- self[key] ||= []
17
- end
18
18
  end
19
19
 
20
20
  def append_query(query)
@@ -49,26 +49,29 @@ class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess
49
49
  end
50
50
 
51
51
  def append_filter_query(query)
52
+ self['fq'] ||= []
53
+ self['fq'] = Array(self['fq']) if self['fq'].is_a? String
54
+
52
55
  self['fq'] << query
53
56
  end
54
57
 
55
58
  def append_facet_fields(values)
59
+ self['facet.field'] ||= []
56
60
  self['facet.field'] += Array(values)
57
61
  end
58
62
 
59
63
  def append_facet_query(values)
64
+ self['facet.query'] ||= []
60
65
  self['facet.query'] += Array(values)
61
66
  end
62
67
 
63
68
  def append_facet_pivot(query)
69
+ self['facet.pivot'] ||= []
64
70
  self['facet.pivot'] << query
65
71
  end
66
72
 
67
73
  def append_highlight_field(query)
74
+ self['hl.fl'] ||= []
68
75
  self['hl.fl'] << query
69
76
  end
70
-
71
- def to_hash
72
- reject { |key, value| ARRAY_KEYS.include?(key) && value.blank? }
73
- end
74
77
  end
@@ -45,8 +45,9 @@ class Blacklight::Solr::Response::GroupResponse
45
45
  def entry_name(options)
46
46
  I18n.t(
47
47
  "blacklight.entry_name.grouped.#{key}",
48
- default: :'blacklight.entry_name.grouped.default'
49
- ).pluralize(options[:count])
48
+ default: :'blacklight.entry_name.grouped.default',
49
+ count: options[:count]
50
+ )
50
51
  end
51
52
 
52
53
  def method_missing meth, *args, &block
@@ -24,6 +24,6 @@ module Blacklight::Solr::Response::PaginationMethods
24
24
  ##
25
25
  # Meant to have the same signature as Kaminari::PaginatableArray#entry_name
26
26
  def entry_name(options)
27
- I18n.t('blacklight.entry_name.default').pluralize(options[:count])
27
+ I18n.t('blacklight.entry_name.default', count: options[:count])
28
28
  end
29
29
  end
@@ -5,10 +5,12 @@ module Blacklight::Solr
5
5
 
6
6
  included do
7
7
  self.default_processor_chain = [
8
- :default_solr_parameters, :add_query_to_solr, :add_facet_fq_to_solr,
8
+ :default_solr_parameters, :add_search_field_default_parameters,
9
+ :add_query_to_solr, :add_facet_fq_to_solr,
9
10
  :add_facetting_to_solr, :add_solr_fields_to_query, :add_paging_to_solr,
10
11
  :add_sorting_to_solr, :add_group_config_to_solr,
11
12
  :add_facet_paging_to_solr, :add_adv_search_clauses,
13
+ :add_missing_field_query,
12
14
  :add_additional_filters
13
15
  ]
14
16
  end
@@ -18,22 +20,17 @@ module Blacklight::Solr
18
20
  # merge to dup values, to avoid later mutating the original by mistake.
19
21
  def default_solr_parameters(solr_parameters)
20
22
  blacklight_config.default_solr_params.each do |key, value|
21
- solr_parameters[key] = if value.respond_to? :deep_dup
22
- value.deep_dup
23
- elsif value.respond_to?(:dup) && value.duplicable?
24
- value.dup
25
- else
26
- value
27
- end
23
+ solr_parameters[key] ||= if value.respond_to? :deep_dup
24
+ value.deep_dup
25
+ elsif value.respond_to?(:dup) && value.duplicable?
26
+ value.dup
27
+ else
28
+ value
29
+ end
28
30
  end
29
31
  end
30
32
 
31
- ##
32
- # Take the user-entered query, and put it in the solr params,
33
- # including config's "search field" params for current search field.
34
- # also include setting spellcheck.q.
35
- # rubocop:disable Metrics/CyclomaticComplexity
36
- def add_query_to_solr(solr_parameters)
33
+ def add_search_field_default_parameters(solr_parameters)
37
34
  ###
38
35
  # legacy behavior of user param :qt is passed through, but over-ridden
39
36
  # by actual search field config if present. We might want to remove
@@ -47,10 +44,21 @@ module Blacklight::Solr
47
44
  ###
48
45
  # Merge in search field configured values, if present, over-writing general
49
46
  # defaults
50
-
51
47
  if search_field
52
48
  solr_parameters[:qt] = search_field.qt if search_field.qt
53
- solr_parameters.merge!(search_field.solr_parameters) if search_field.solr_parameters
49
+
50
+ solr_parameters.deep_merge!(search_field.solr_parameters) if search_field.solr_parameters
51
+ end
52
+ end
53
+
54
+ ##
55
+ # Take the user-entered query, and put it in the solr params,
56
+ # including config's "search field" params for current search field.
57
+ # also include setting spellcheck.q.
58
+ def add_query_to_solr(solr_parameters)
59
+ unless processor_chain.include?(:add_search_field_default_parameters)
60
+ Deprecation.warn(Blacklight::Solr::SearchBuilderBehavior, 'Please include :add_search_field_default_parameters in your process chain')
61
+ add_search_field_default_parameters(solr_parameters)
54
62
  end
55
63
 
56
64
  ##
@@ -73,7 +81,19 @@ module Blacklight::Solr
73
81
  solr_parameters.append_query search_state.query_param
74
82
  end
75
83
  end
76
- # rubocop:enable Metrics/CyclomaticComplexity
84
+
85
+ ##
86
+ # Build and append a missing field query.
87
+ ##
88
+ def add_missing_field_query(solr_parameters)
89
+ return unless solr_parameters["facet.missing"]
90
+
91
+ solr_parameters[:fq] = [] if solr_parameters[:fq].blank?
92
+
93
+ solr_parameters[:fq].append(*(blacklight_params["f"] || [])
94
+ .select { |f| f.match(/^-/) }
95
+ .map { |k, _v| "#{k}[* TO *]" })
96
+ end
77
97
 
78
98
  def add_additional_filters(solr_parameters, additional_filters = nil)
79
99
  q = additional_filters || @additional_filters
data/lib/blacklight.rb CHANGED
@@ -96,7 +96,11 @@ module Blacklight
96
96
  end
97
97
 
98
98
  begin
99
- @blacklight_yml = YAML.safe_load(blacklight_erb)
99
+ @blacklight_yml = if RUBY_VERSION > '2.6'
100
+ YAML.safe_load(blacklight_erb, aliases: true)
101
+ else
102
+ YAML.safe_load(blacklight_erb, [], [], true)
103
+ end
100
104
  rescue => e
101
105
  raise("#{blacklight_config_file} was found, but could not be parsed.\n#{e.inspect}")
102
106
  end