blacklight 7.18.1 → 7.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) 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 +8 -4
  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/content_areas_shim.rb +2 -1
  20. data/app/components/blacklight/document_component.rb +10 -10
  21. data/app/components/blacklight/facet_field_component.html.erb +3 -1
  22. data/app/components/blacklight/facet_field_no_layout_component.rb +1 -1
  23. data/app/components/blacklight/facet_item_component.rb +4 -4
  24. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  25. data/app/components/blacklight/metadata_field_layout_component.rb +2 -2
  26. data/app/components/blacklight/response/facet_group_component.html.erb +2 -0
  27. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  28. data/app/components/blacklight/response/view_type_component.html.erb +1 -1
  29. data/app/components/blacklight/search_bar_component.html.erb +3 -3
  30. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  31. data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
  32. data/app/components/blacklight/system/modal_component.html.erb +1 -1
  33. data/app/controllers/concerns/blacklight/bookmarks.rb +0 -3
  34. data/app/controllers/concerns/blacklight/catalog.rb +3 -0
  35. data/app/controllers/concerns/blacklight/controller.rb +9 -5
  36. data/app/controllers/concerns/blacklight/search_context.rb +1 -1
  37. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -3
  38. data/app/helpers/blacklight/component_helper_behavior.rb +1 -1
  39. data/app/helpers/blacklight/render_partials_helper_behavior.rb +5 -1
  40. data/app/javascript/blacklight/core.js +5 -1
  41. data/app/javascript/blacklight/modal.js +1 -1
  42. data/app/javascript/blacklight/search_context.js +5 -2
  43. data/app/views/blacklight/nav/_bookmark.html.erb +1 -1
  44. data/app/views/bookmarks/index.html.erb +1 -1
  45. data/app/views/catalog/_constraints.html.erb +2 -2
  46. data/app/views/catalog/_document.html.erb +4 -3
  47. data/app/views/catalog/_document_list.html.erb +3 -2
  48. data/app/views/catalog/_home_text.html.erb +3 -3
  49. data/app/views/catalog/_paginate_compact.html.erb +1 -0
  50. data/app/views/catalog/_per_page_widget.html.erb +1 -1
  51. data/app/views/catalog/_search_results.html.erb +2 -2
  52. data/app/views/search_history/index.html.erb +1 -1
  53. data/app/views/shared/_header_navbar.html.erb +3 -3
  54. data/blacklight.gemspec +4 -2
  55. data/config/locales/blacklight.ar.yml +2 -2
  56. data/config/locales/blacklight.ca.yml +2 -2
  57. data/config/locales/blacklight.de.yml +6 -4
  58. data/config/locales/blacklight.en.yml +8 -4
  59. data/config/locales/blacklight.es.yml +5 -3
  60. data/config/locales/blacklight.fr.yml +5 -3
  61. data/config/locales/blacklight.hu.yml +2 -2
  62. data/config/locales/blacklight.it.yml +5 -3
  63. data/config/locales/blacklight.nl.yml +2 -2
  64. data/config/locales/blacklight.pt-BR.yml +1 -1
  65. data/config/locales/blacklight.sq.yml +2 -2
  66. data/config/locales/blacklight.zh.yml +2 -2
  67. data/lib/blacklight/configuration/view_config.rb +3 -1
  68. data/lib/blacklight/configuration.rb +7 -1
  69. data/lib/blacklight/nested_open_struct_with_hash_access.rb +14 -11
  70. data/lib/blacklight/open_struct_with_hash_access.rb +1 -1
  71. data/lib/blacklight/search_builder.rb +1 -1
  72. data/lib/blacklight/search_state/filter_field.rb +9 -0
  73. data/lib/blacklight/solr/request.rb +10 -7
  74. data/lib/blacklight/solr/response/group_response.rb +3 -2
  75. data/lib/blacklight/solr/response/pagination_methods.rb +1 -1
  76. data/lib/blacklight/solr/search_builder_behavior.rb +38 -18
  77. data/lib/blacklight.rb +5 -1
  78. data/lib/generators/blacklight/assets_generator.rb +4 -2
  79. data/lib/generators/blacklight/install_generator.rb +4 -1
  80. data/lib/generators/blacklight/user_generator.rb +1 -1
  81. data/package.json +2 -2
  82. data/spec/components/blacklight/constraint_layout_component_spec.rb +3 -7
  83. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +3 -7
  84. data/spec/components/blacklight/facet_field_list_component_spec.rb +3 -7
  85. data/spec/components/blacklight/facet_item_component_spec.rb +8 -8
  86. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +3 -7
  87. data/spec/components/blacklight/hidden_search_state_component_spec.rb +7 -8
  88. data/spec/components/blacklight/metadata_field_component_spec.rb +4 -8
  89. data/spec/features/axe_spec.rb +34 -0
  90. data/spec/features/facet_missing_spec.rb +59 -0
  91. data/spec/features/facets_spec.rb +3 -3
  92. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +3 -3
  93. data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +2 -2
  94. data/spec/helpers/blacklight_helper_spec.rb +18 -0
  95. data/spec/lib/blacklight/nested_open_struct_with_hash_access_spec.rb +23 -1
  96. data/spec/lib/blacklight/search_state/filter_field_spec.rb +27 -0
  97. data/spec/models/blacklight/configuration_spec.rb +10 -0
  98. data/spec/models/blacklight/solr/request_spec.rb +0 -1
  99. data/spec/models/blacklight/solr/response/group_response_spec.rb +3 -2
  100. data/spec/models/blacklight/solr/search_builder_spec.rb +27 -1
  101. data/spec/spec_helper.rb +16 -9
  102. data/spec/support/view_component_capybara_test_helpers.rb +8 -0
  103. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -3
  104. data/spec/views/catalog/_document.html.erb_spec.rb +9 -0
  105. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  106. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -2
  107. metadata +45 -11
@@ -84,12 +84,16 @@ module Blacklight::RenderPartialsHelperBehavior
84
84
  # @param [Hash] locals to pass to the render call
85
85
  # @return [String]
86
86
  def render_document_index_with_view view, documents, locals = {}
87
+ view_config = blacklight_config&.view_config(view)
88
+
89
+ return render partial: view_config.template, locals: locals.merge(documents: documents, view_config: view_config) if view_config&.template
90
+
87
91
  template = cached_view ['index', view].join('_') do
88
92
  find_document_index_template_with_view(view, locals)
89
93
  end
90
94
 
91
95
  if template
92
- template.render(self, locals.merge(documents: documents))
96
+ template.render(self, locals.merge(documents: documents, view_config: view_config))
93
97
  else
94
98
  ''
95
99
  end
@@ -38,4 +38,8 @@ Blacklight.listeners().forEach(function(listener) {
38
38
  })
39
39
  })
40
40
 
41
- $('.no-js').removeClass('no-js').addClass('js');
41
+ Blacklight.onLoad(function () {
42
+ const elem = document.querySelector('.no-js')
43
+ elem.classList.remove('no-js')
44
+ elem.classList.add('js')
45
+ })
@@ -106,7 +106,7 @@ Blacklight.modal.onFailure = function(jqXHR, textStatus, errorThrown) {
106
106
 
107
107
  var contents = '<div class="modal-header">' +
108
108
  '<div class="modal-title">There was a problem with your request.</div>' +
109
- '<button type="button" class="blacklight-modal-close close" data-dismiss="modal" aria-label="Close">' +
109
+ '<button type="button" class="blacklight-modal-close btn-close close" data-dismiss="modal" aria-label="Close">' +
110
110
  ' <span aria-hidden="true">&times;</span>' +
111
111
  '</button></div>' +
112
112
  ' <div class="modal-body"><p>Expected a successful response from the server, but got an error</p>' +
@@ -15,6 +15,9 @@ Blacklight.doSearchContextBehavior = function() {
15
15
  })
16
16
  };
17
17
 
18
+ Blacklight.csrfToken = () => document.querySelector('meta[name=csrf-token]')?.content
19
+ Blacklight.csrfParam = () => document.querySelector('meta[name=csrf-param]')?.content
20
+
18
21
  // this is the Rails.handleMethod with a couple adjustments, described inline:
19
22
  // first, we're attaching this directly to the event handler, so we can check for meta-keys
20
23
  Blacklight.handleSearchContextMethod = function(event) {
@@ -27,8 +30,8 @@ Blacklight.handleSearchContextMethod = function(event) {
27
30
  // instead of using the normal href, we need to use the context href instead
28
31
  let href = link.getAttribute('data-context-href')
29
32
  let target = link.getAttribute('target')
30
- let csrfToken = Rails.csrfToken()
31
- let csrfParam = Rails.csrfParam()
33
+ let csrfToken = Blacklight.csrfToken()
34
+ let csrfParam = Blacklight.csrfParam()
32
35
  let form = document.createElement('form')
33
36
  form.method = 'post'
34
37
  form.action = href
@@ -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,6 +1,7 @@
1
1
  <% # container for a single doc -%>
2
- <%= render (blacklight_config.view_config(document_index_view_type).document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) do |component| %>
3
- <% component.public_send(blacklight_config.view_config(document_index_view_type).document_component.blank? && blacklight_config.view_config(document_index_view_type).partials.any? ? :body : :partial) do %>
4
- <%= render_document_partials document, blacklight_config.view_config(document_index_view_type).partials, component: component, document_counter: document_counter %>
2
+ <% view_config = local_assigns[:view_config] || blacklight_config.view_config(document_index_view_type) %>
3
+ <%= render (view_config.document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(document), counter: document_counter_with_offset(document_counter)) do |component| %>
4
+ <% component.public_send(view_config.document_component.blank? && view_config.partials.any? ? :body : :partial) do %>
5
+ <%= render_document_partials document, view_config.partials, component: component, document_counter: document_counter %>
5
6
  <% end %>
6
7
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <% # container for all documents in index list view -%>
2
- <div id="documents" class="documents-<%= document_index_view_type %>">
3
- <%= render documents, :as => :document %>
2
+ <% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
3
+ <div id="documents" class="documents-<%= view_config&.key || document_index_view_type %>">
4
+ <%= render documents, as: :document, view_config: view_config %>
4
5
  </div>
@@ -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.0'
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: "[未找到]"
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  class Blacklight::Configuration
3
3
  class ViewConfig < Blacklight::OpenStructWithHashAccess
4
+ # @!attribute template
5
+ # @return [String] partial to render around the documents
4
6
  # @!attribute partials
5
7
  # @return [Array<String>] partials to render for each document(see #render_document_partials)
6
8
  # @!attribute document_presenter_class
@@ -20,7 +22,7 @@ class Blacklight::Configuration
20
22
  end
21
23
 
22
24
  def display_label(deprecated_key = nil, **options)
23
- Deprecation.warn('Passing the key argument to ViewConfig#display_label is deprecated') if deprecated_key.present?
25
+ Deprecation.warn(Blacklight::Configuration::ViewConfig, 'Passing the key argument to ViewConfig#display_label is deprecated') if deprecated_key.present?
24
26
 
25
27
  I18n.t(
26
28
  :"blacklight.search.view_title.#{deprecated_key || key}",
@@ -170,6 +170,8 @@ module Blacklight
170
170
  def initialize(hash = {})
171
171
  super(self.class.default_values.deep_dup.merge(hash))
172
172
  yield(self) if block_given?
173
+
174
+ @view_config ||= {}
173
175
  end
174
176
 
175
177
  def document_model
@@ -333,7 +335,6 @@ module Blacklight
333
335
  view_type = nil
334
336
  end
335
337
 
336
- @view_config ||= {}
337
338
  @view_config[[view_type, action_name]] ||= begin
338
339
  if view_type.nil?
339
340
  action_config(action_name)
@@ -428,6 +429,11 @@ module Blacklight
428
429
  fields.merge(show_fields)
429
430
  end
430
431
 
432
+ def freeze
433
+ each { |_k, v| v.is_a?(OpenStruct) && v.freeze }
434
+ super
435
+ end
436
+
431
437
  private
432
438
 
433
439
  def add_action(config_hash, name, opts)
@@ -14,12 +14,12 @@ module Blacklight
14
14
 
15
15
  def initialize(klass, hash = {})
16
16
  @nested_class = klass
17
- value = hash.transform_values do |v|
18
- if v.is_a? Hash
19
- nested_class.new(v)
20
- else
21
- v
22
- end
17
+ value = hash.each_with_object({}) do |(k, v), h|
18
+ h[k] = if v.is_a? Hash
19
+ nested_class.new({ key: k.to_sym }.merge(v))
20
+ else
21
+ v
22
+ end
23
23
  end
24
24
 
25
25
  super value
@@ -37,7 +37,7 @@ module Blacklight
37
37
  # into another NestedOpenStructWithHashAccess
38
38
  def []=(key, value)
39
39
  if value.is_a? Hash
40
- send "#{key}=", nested_class.new(value)
40
+ send "#{key}=", nested_class.new({ key: key.to_sym }.merge(value))
41
41
  else
42
42
  super
43
43
  end
@@ -93,19 +93,22 @@ module Blacklight
93
93
  len = args.length
94
94
 
95
95
  res = if mid.to_s.end_with?('!')
96
- m = mid[0...-1]
96
+ m = mid[0...-1].to_sym
97
97
  new_ostruct_member!(m)
98
98
  @table[m]
99
99
  elsif mid.to_s.end_with?('=')
100
- m = mid[0...-1]
100
+ m = mid[0...-1].to_sym
101
101
  new_ostruct_member!(m)
102
102
  @table[m] = args.first
103
103
  elsif len.zero? && kwargs.blank? && !block
104
- Deprecation.warn("Initializing a #{nested_class} implicitly (by calling #{mid}) is deprecated. Call it as #{mid}! or pass initialize arguments")
104
+ Deprecation.warn(Blacklight::NestedOpenStructWithHashAccess,
105
+ "Initializing a #{nested_class} implicitly (by calling #{mid}) is deprecated. Call it as #{mid}! or pass initialize arguments")
106
+
107
+ new_ostruct_member!(mid)
105
108
  @table[mid]
106
109
  else
107
110
  new_ostruct_member!(mid)
108
- @table[mid] = nested_class.new(*args, **kwargs)
111
+ @table[mid] = nested_class.new(key: mid, **(args.first || {}), **kwargs)
109
112
  end
110
113
 
111
114
  block&.call(res)
@@ -6,7 +6,7 @@ module Blacklight
6
6
  class OpenStructWithHashAccess < OpenStruct
7
7
  delegate :keys, :each, :map, :has_key?, :key?, :include?, :empty?,
8
8
  :length, :delete, :delete_if, :keep_if, :clear, :reject!, :select!,
9
- :replace, :fetch, :to_json, :as_json, :any?, to: :to_h
9
+ :replace, :fetch, :to_json, :as_json, :any?, :freeze, :unfreeze, :frozen?, to: :to_h
10
10
 
11
11
  ##
12
12
  # Expose the internal hash