blacklight 7.13.1 → 7.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/components/blacklight/facet_field_pagination_component.html.erb +4 -4
- data/app/components/blacklight/search_bar_component.html.erb +10 -8
- data/app/components/blacklight/search_bar_component.rb +14 -1
- data/app/controllers/concerns/blacklight/catalog.rb +3 -3
- data/app/controllers/concerns/blacklight/search_context.rb +1 -1
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +2 -2
- data/app/values/blacklight/types.rb +1 -1
- data/lib/blacklight/configuration/fields.rb +1 -1
- data/lib/blacklight/solr/repository.rb +3 -3
- data/lib/blacklight/solr/response.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57c80d2b77a3b8bd0d536f3800fad183aa43d5aec10b71f921dfb23cbb6b26c
|
4
|
+
data.tar.gz: 9748a16edba74f0a1f24b1d6813987196088e1d217dd621b6455ca235aec37be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af48c90bc958243c5177660307c059a974c647f27b1fd890061e6efbba253b68d4690e46547b488fee11fe92140db88d39051a0a666e656f478d89e9650fd541
|
7
|
+
data.tar.gz: '019a8e8383aff4582a98a74348c2b40cf7e57aa121213fbd43702c13ff66f2f30c455d43c06dfa0f26c39ebc74f9d34ff40f72b72ed30bdd180384f58deb25cb'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.13.
|
1
|
+
7.13.2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="prev_next_links btn-group">
|
2
|
-
<%= link_to_previous_page @facet_field.paginator, raw(t('views.pagination.previous')), params: @facet_field.search_state.to_h, param_name: param_name, class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
|
2
|
+
<%= @view_context.link_to_previous_page @facet_field.paginator, raw(t('views.pagination.previous')), params: @facet_field.search_state.to_h, param_name: param_name, class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
|
3
3
|
<%= content_tag :span, raw(t('views.pagination.previous')), class: 'disabled btn' %>
|
4
4
|
<% end %>
|
5
5
|
|
6
|
-
<%= link_to_next_page @facet_field.paginator, raw(t('views.pagination.next')), params: @facet_field.search_state.to_h, param_name: param_name, class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
|
6
|
+
<%= @view_context.link_to_next_page @facet_field.paginator, raw(t('views.pagination.next')), params: @facet_field.search_state.to_h, param_name: param_name, class: 'btn btn-link', data: { blacklight_modal: "preserve" } do %>
|
7
7
|
<%= content_tag :span, raw(t('views.pagination.next')), class: 'disabled btn' %>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
@@ -11,9 +11,9 @@
|
|
11
11
|
<div class="sort-options btn-group">
|
12
12
|
<% if @facet_field.paginator.sort == 'index' -%>
|
13
13
|
<span class="active az btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.index') %></span>
|
14
|
-
<%= link_to(t('blacklight.search.facets.sort.count'), sort_facet_url('count'), class: "sort_change numeric btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
|
14
|
+
<%= @view_context.link_to(t('blacklight.search.facets.sort.count'), sort_facet_url('count'), class: "sort_change numeric btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
|
15
15
|
<% elsif @facet_field.paginator.sort == 'count' -%>
|
16
|
-
<%=
|
16
|
+
<%= @view_context.link_to(t('blacklight.search.facets.sort.index'), sort_facet_url('index'), class: "sort_change az btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
|
17
17
|
<span class="active numeric btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.count') %></span>
|
18
18
|
<% end -%>
|
19
19
|
</div>
|
@@ -1,27 +1,29 @@
|
|
1
|
-
<%= form_tag @url, method: @method, class: @classes.join(' '), role: 'search', 'aria-label' =>
|
1
|
+
<%= form_tag @url, method: @method, class: @classes.join(' '), role: 'search', 'aria-label' => scoped_t('submit') do %>
|
2
2
|
<%= render_hash_as_hidden_fields(@params) %>
|
3
3
|
<% if @search_fields.length > 1 %>
|
4
|
-
<label for="search_field" class="sr-only"><%=
|
4
|
+
<label for="search_field" class="sr-only"><%= scoped_t('search_field.label') %></label>
|
5
5
|
<% end %>
|
6
6
|
<div class="input-group">
|
7
|
+
<%= prepend %>
|
8
|
+
|
7
9
|
<% if @search_fields.length > 1 %>
|
8
10
|
<%= select_tag(:search_field,
|
9
11
|
options_for_select(@search_fields, h(@search_field)),
|
10
|
-
title:
|
12
|
+
title: scoped_t('search_field.title'),
|
11
13
|
id: "#{@prefix}search_field",
|
12
14
|
class: "custom-select search-field") %>
|
13
15
|
<% elsif @search_fields.length == 1 %>
|
14
16
|
<%= hidden_field_tag :search_field, @search_fields.first.last %>
|
15
17
|
<% end %>
|
16
18
|
|
17
|
-
<label for="<%= @prefix %>
|
18
|
-
<%= text_field_tag
|
19
|
-
|
20
|
-
<%= content %>
|
19
|
+
<label for="<%= @prefix %><%= @query_param %>" class="sr-only"><%= scoped_t('search.label') %></label>
|
20
|
+
<%= text_field_tag @query_param, @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{@search_fields.length > 1 ? '0' : 'left'}", id: "#{@prefix}q", autocomplete: autocomplete_path.present? ? "off" : "", autofocus: @autofocus, data: { autocomplete_enabled: autocomplete_path.present?, autocomplete_path: autocomplete_path } %>
|
21
21
|
|
22
22
|
<span class="input-group-append">
|
23
|
+
<%= append %>
|
24
|
+
|
23
25
|
<button type="submit" class="btn btn-primary search-btn" id="<%= @prefix %>search">
|
24
|
-
<span class="submit-search-text"><%=
|
26
|
+
<span class="submit-search-text"><%= scoped_t('submit') %></span>
|
25
27
|
<%= blacklight_icon :search, aria_hidden: true %>
|
26
28
|
</button>
|
27
29
|
</span>
|
@@ -2,10 +2,18 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
class SearchBarComponent < ::ViewComponent::Base
|
5
|
+
with_content_areas :append, :prepend
|
6
|
+
|
5
7
|
# rubocop:disable Metrics/ParameterLists
|
6
|
-
def initialize(
|
8
|
+
def initialize(
|
9
|
+
url:, params:, classes: ['search-query-form'], presenter: nil,
|
10
|
+
prefix: '', method: 'GET', q: nil, query_param: :q,
|
11
|
+
search_field: nil, search_fields: [], autocomplete_path: nil,
|
12
|
+
autofocus: nil, i18n: { scope: 'blacklight.search.form' }
|
13
|
+
)
|
7
14
|
@url = url
|
8
15
|
@q = q || params[:q]
|
16
|
+
@query_param = query_param
|
9
17
|
@search_field = search_field || params[:search_field]
|
10
18
|
@params = params.except(:q, :search_field, :utf8, :page)
|
11
19
|
@prefix = prefix
|
@@ -15,6 +23,7 @@ module Blacklight
|
|
15
23
|
@autocomplete_path = autocomplete_path
|
16
24
|
@autofocus = autofocus
|
17
25
|
@search_fields = search_fields
|
26
|
+
@i18n = i18n
|
18
27
|
end
|
19
28
|
# rubocop:enable Metrics/ParameterLists
|
20
29
|
|
@@ -47,5 +56,9 @@ module Blacklight
|
|
47
56
|
@view_context.render_hash_as_hidden_fields(*args)
|
48
57
|
end
|
49
58
|
end
|
59
|
+
|
60
|
+
def scoped_t(key, **args)
|
61
|
+
t(key, default: t(key, scope: 'blacklight.search.form'), **@i18n, **args)
|
62
|
+
end
|
50
63
|
end
|
51
64
|
end
|
@@ -133,7 +133,7 @@ module Blacklight::Catalog
|
|
133
133
|
# Check if any search parameters have been set
|
134
134
|
# @return [Boolean]
|
135
135
|
def has_search_parameters?
|
136
|
-
params[:
|
136
|
+
params[:search_field].present? || search_state.has_constraints?
|
137
137
|
end
|
138
138
|
|
139
139
|
# TODO: deprecate this constant with #facet_limit_for
|
@@ -316,11 +316,11 @@ module Blacklight::Catalog
|
|
316
316
|
# If there are errors coming from the index page, we want to trap those sensibly
|
317
317
|
|
318
318
|
if flash[:notice] == flash_notice
|
319
|
-
logger
|
319
|
+
logger&.error "Cowardly aborting rsolr_request_error exception handling, because we redirected to a page that raises another exception"
|
320
320
|
raise exception
|
321
321
|
end
|
322
322
|
|
323
|
-
logger
|
323
|
+
logger&.error exception
|
324
324
|
|
325
325
|
flash[:notice] = flash_notice
|
326
326
|
redirect_to search_action_url
|
@@ -117,7 +117,7 @@ module Blacklight::SearchContext
|
|
117
117
|
{ prev: documents.first, next: documents.last }
|
118
118
|
end
|
119
119
|
rescue Blacklight::Exceptions::InvalidRequest => e
|
120
|
-
logger
|
120
|
+
logger&.warn "Unable to setup next and previous documents: #{e}"
|
121
121
|
nil
|
122
122
|
end
|
123
123
|
end
|
@@ -173,7 +173,7 @@ module Blacklight::RenderPartialsHelperBehavior
|
|
173
173
|
def find_document_show_template_with_view view_type, base_name, format, locals
|
174
174
|
document_partial_path_templates.each do |str|
|
175
175
|
partial = format(str, action_name: base_name, format: format, index_view_type: view_type)
|
176
|
-
logger
|
176
|
+
logger&.debug "Looking for document partial #{partial}"
|
177
177
|
template = lookup_context.find_all(partial, lookup_context.prefixes + [""], true, locals.keys + [:document], {}).first
|
178
178
|
return template if template
|
179
179
|
end
|
@@ -183,7 +183,7 @@ module Blacklight::RenderPartialsHelperBehavior
|
|
183
183
|
def find_document_index_template_with_view view_type, locals
|
184
184
|
document_index_path_templates.each do |str|
|
185
185
|
partial = format(str, index_view_type: view_type)
|
186
|
-
logger
|
186
|
+
logger&.debug "Looking for document index partial #{partial}"
|
187
187
|
template = lookup_context.find_all(partial, lookup_context.prefixes + [""], true, locals.keys + [:documents], {}).first
|
188
188
|
return template if template
|
189
189
|
end
|
@@ -151,7 +151,7 @@ module Blacklight
|
|
151
151
|
repository = repository_class.new(self)
|
152
152
|
repository.reflect_fields
|
153
153
|
rescue => e
|
154
|
-
Blacklight.logger
|
154
|
+
Blacklight.logger&.warn "Error retrieving field metadata: #{e}"
|
155
155
|
false
|
156
156
|
end
|
157
157
|
|
@@ -41,7 +41,7 @@ module Blacklight::Solr
|
|
41
41
|
# @return [boolean] true if the repository is reachable
|
42
42
|
def ping
|
43
43
|
response = connection.send_and_receive 'admin/ping', {}
|
44
|
-
Blacklight.logger
|
44
|
+
Blacklight.logger&.info("Ping [#{connection.uri}] returned: '#{response['status']}'")
|
45
45
|
response['status'] == "OK"
|
46
46
|
end
|
47
47
|
|
@@ -63,8 +63,8 @@ module Blacklight::Solr
|
|
63
63
|
|
64
64
|
solr_response = blacklight_config.response_model.new(res, solr_params, document_model: blacklight_config.document_model, blacklight_config: blacklight_config)
|
65
65
|
|
66
|
-
Blacklight.logger
|
67
|
-
Blacklight.logger
|
66
|
+
Blacklight.logger&.debug("Solr query: #{blacklight_config.http_method} #{path} #{solr_params.to_hash.inspect}")
|
67
|
+
Blacklight.logger&.debug("Solr response: #{solr_response.inspect}") if defined?(::BLACKLIGHT_VERBOSE_LOGGING) && ::BLACKLIGHT_VERBOSE_LOGGING
|
68
68
|
solr_response
|
69
69
|
end
|
70
70
|
rescue Errno::ECONNREFUSED => e
|
@@ -93,7 +93,7 @@ class Blacklight::Solr::Response < ActiveSupport::HashWithIndifferentAccess
|
|
93
93
|
value.each { |v| force_to_utf8(v) }
|
94
94
|
when String
|
95
95
|
if value.encoding != Encoding::UTF_8
|
96
|
-
Blacklight.logger
|
96
|
+
Blacklight.logger&.warn "Found a non utf-8 value in Blacklight::Solr::Response. \"#{value}\" Encoding is #{value.encoding}"
|
97
97
|
value.dup.force_encoding('UTF-8')
|
98
98
|
else
|
99
99
|
value
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.13.
|
4
|
+
version: 7.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2020-
|
20
|
+
date: 2020-11-07 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|