blacklight 7.22.2 → 7.23.0
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/.github/workflows/ruby.yml +29 -8
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +6 -0
- data/app/components/blacklight/advanced_search_form_component.rb +5 -5
- data/app/components/blacklight/constraints_component.html.erb +8 -4
- data/app/components/blacklight/constraints_component.rb +43 -18
- data/app/components/blacklight/document/action_component.html.erb +1 -1
- data/app/components/blacklight/document/action_component.rb +10 -3
- data/app/components/blacklight/document/bookmark_component.rb +2 -2
- data/app/components/blacklight/document/citation_component.rb +1 -1
- data/app/components/blacklight/document/group_component.html.erb +1 -1
- data/app/components/blacklight/document/group_component.rb +2 -2
- data/app/components/blacklight/document/more_like_this_component.html.erb +1 -1
- data/app/components/blacklight/document/more_like_this_component.rb +1 -1
- data/app/components/blacklight/document/thumbnail_component.rb +1 -1
- data/app/components/blacklight/document_component.rb +2 -2
- data/app/components/blacklight/document_title_component.rb +3 -3
- data/app/components/blacklight/facet_field_checkboxes_component.rb +1 -1
- data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +1 -1
- data/app/components/blacklight/facet_field_list_component.html.erb +1 -1
- data/app/components/blacklight/facet_field_list_component.rb +1 -1
- data/app/components/blacklight/facet_field_pagination_component.html.erb +4 -4
- data/app/components/blacklight/facet_item_component.rb +2 -2
- data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
- data/app/components/blacklight/metadata_field_component.rb +2 -2
- data/app/components/blacklight/response/facet_group_component.html.erb +1 -1
- data/app/components/blacklight/response/facet_group_component.rb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +1 -1
- data/app/components/blacklight/response/sort_component.html.erb +1 -1
- data/app/components/blacklight/response/spellcheck_component.rb +14 -3
- data/app/components/blacklight/response/view_type_button_component.rb +3 -3
- data/app/components/blacklight/response/view_type_component.rb +1 -1
- data/app/components/blacklight/search_bar_component.rb +2 -2
- data/app/components/blacklight/search_context_component.rb +3 -3
- data/app/components/blacklight/search_history_constraint_layout_component.rb +14 -0
- data/app/components/blacklight/start_over_button_component.rb +20 -0
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +2 -2
- data/app/controllers/concerns/blacklight/search_context.rb +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +12 -4
- data/app/helpers/blacklight/catalog_helper_behavior.rb +18 -7
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +12 -1
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +30 -2
- data/app/helpers/blacklight/url_helper_behavior.rb +3 -1
- data/app/javascript/blacklight/modal.js +2 -2
- data/app/models/concerns/blacklight/configurable.rb +1 -1
- data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -1
- data/app/models/concerns/blacklight/document/extensions.rb +1 -1
- data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
- data/app/models/concerns/blacklight/document.rb +1 -1
- data/app/views/catalog/_email_form.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +3 -3
- data/app/views/catalog/_start_over.html.erb +1 -1
- data/app/views/layouts/blacklight/base.html.erb +1 -0
- data/blacklight.gemspec +3 -4
- data/lib/blacklight/configuration/fields.rb +1 -1
- data/lib/blacklight/configuration.rb +2 -1
- data/lib/blacklight/deprecations/engine_configuration.rb +66 -0
- data/lib/blacklight/engine.rb +21 -10
- data/lib/blacklight/exceptions.rb +3 -0
- data/lib/blacklight/search_state/filter_field.rb +4 -4
- data/lib/blacklight/solr/repository.rb +36 -12
- data/lib/blacklight/solr/search_builder_behavior.rb +1 -4
- data/lib/generators/blacklight/assets_generator.rb +14 -10
- data/spec/components/blacklight/constraints_component_spec.rb +68 -0
- data/spec/components/blacklight/document/action_component_spec.rb +2 -1
- data/spec/components/blacklight/document_component_spec.rb +1 -1
- data/spec/components/blacklight/response/spellcheck_component_spec.rb +73 -0
- data/spec/components/blacklight/start_over_button_component_spec.rb +38 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/did_you_mean_spec.rb +21 -0
- data/spec/features/search_context_spec.rb +3 -1
- data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +2 -0
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +3 -3
- data/spec/helpers/blacklight_helper_spec.rb +8 -3
- data/spec/helpers/catalog_helper_spec.rb +6 -2
- data/spec/lib/blacklight/engine_spec.rb +41 -0
- data/spec/models/blacklight/facet_paginator_spec.rb +60 -15
- data/spec/models/blacklight/solr/repository_spec.rb +29 -21
- data/spec/models/blacklight/solr/response/facets_spec.rb +48 -10
- data/spec/presenters/blacklight/facet_item_presenter_spec.rb +1 -1
- data/spec/presenters/blacklight/field_presenter_spec.rb +2 -2
- data/spec/routing/search_history_spec.rb +9 -0
- data/spec/services/blacklight/search_service_spec.rb +8 -0
- data/spec/spec_helper.rb +2 -3
- data/spec/support/controller_level_helpers.rb +8 -0
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -1
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -0
- data/spec/views/catalog/index.html.erb_spec.rb +1 -0
- data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -1
- data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -1
- metadata +21 -22
|
@@ -16,18 +16,18 @@ module Blacklight
|
|
|
16
16
|
|
|
17
17
|
def icon
|
|
18
18
|
Deprecation.silence(Blacklight::CatalogHelperBehavior) do
|
|
19
|
-
|
|
19
|
+
helpers.render_view_type_group_icon(@view.icon || @key)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def label
|
|
24
24
|
Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
|
|
25
|
-
|
|
25
|
+
helpers.view_label(@key)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def url
|
|
30
|
-
|
|
30
|
+
helpers.url_for(@search_state.to_h.merge(view: @key))
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def selected?
|
|
@@ -57,12 +57,12 @@ module Blacklight
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def blacklight_config
|
|
60
|
-
|
|
60
|
+
helpers.blacklight_config
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def render_hash_as_hidden_fields(*args)
|
|
64
64
|
Deprecation.silence(Blacklight::HashAsHiddenFieldsHelperBehavior) do
|
|
65
|
-
|
|
65
|
+
helpers.render_hash_as_hidden_fields(*args)
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -15,19 +15,19 @@ module Blacklight
|
|
|
15
15
|
|
|
16
16
|
def item_page_entry_info
|
|
17
17
|
Deprecation.silence(Blacklight::CatalogHelperBehavior) do
|
|
18
|
-
|
|
18
|
+
helpers.item_page_entry_info
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def link_to_previous_document(*args)
|
|
23
23
|
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
24
|
-
|
|
24
|
+
helpers.link_to_previous_document(*args)
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def link_to_next_document(*args)
|
|
29
29
|
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
30
|
-
|
|
30
|
+
helpers.link_to_next_document(*args)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Blacklight
|
|
4
|
+
# Override the regular constraint layout to remove any interactive features so this can
|
|
5
|
+
# be treated as quasi-plain text
|
|
6
|
+
class SearchHistoryConstraintLayoutComponent < Blacklight::ConstraintLayoutComponent
|
|
7
|
+
def call
|
|
8
|
+
label = tag.span(t('blacklight.search.filters.label', label: @label), class: 'filter-name') if @label.present?
|
|
9
|
+
value = tag.span(@value, class: 'filter-values')
|
|
10
|
+
|
|
11
|
+
tag.span(safe_join([label, value].compact), class: 'constraint')
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Blacklight
|
|
4
|
+
class StartOverButtonComponent < ::ViewComponent::Base
|
|
5
|
+
def call
|
|
6
|
+
link_to t('blacklight.search.start_over'), start_over_path, class: 'catalog_startOverLink btn btn-primary'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# Get the path to the search action with any parameters (e.g. view type)
|
|
13
|
+
# that should be persisted across search sessions.
|
|
14
|
+
def start_over_path query_params = params
|
|
15
|
+
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
16
|
+
helpers.start_over_path(query_params)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -35,7 +35,7 @@ module Blacklight
|
|
|
35
35
|
|
|
36
36
|
options(@choices.map do |option|
|
|
37
37
|
text, value = option_text_and_value(option)
|
|
38
|
-
{ text: text, url:
|
|
38
|
+
{ text: text, url: helpers.url_for(@search_state.params_for_search(@param => value)), selected: @selected == value }
|
|
39
39
|
end)
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -15,7 +15,7 @@ module Blacklight::Bookmarks
|
|
|
15
15
|
before_action :verify_user
|
|
16
16
|
|
|
17
17
|
blacklight_config.track_search_session = false
|
|
18
|
-
blacklight_config.http_method = Blacklight::Engine.config.bookmarks_http_method
|
|
18
|
+
blacklight_config.http_method = Blacklight::Engine.config.blacklight.bookmarks_http_method
|
|
19
19
|
blacklight_config.add_results_collection_tool(:clear_bookmarks_widget)
|
|
20
20
|
|
|
21
21
|
blacklight_config.show.document_actions[:bookmark].if = false if blacklight_config.show.document_actions[:bookmark]
|
|
@@ -294,13 +294,13 @@ module Blacklight::Catalog
|
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
def sms_mappings
|
|
297
|
-
Blacklight::Engine.config.sms_mappings
|
|
297
|
+
Blacklight::Engine.config.blacklight.sms_mappings
|
|
298
298
|
end
|
|
299
299
|
|
|
300
300
|
def validate_email_params
|
|
301
301
|
if params[:to].blank?
|
|
302
302
|
flash[:error] = I18n.t('blacklight.email.errors.to.blank')
|
|
303
|
-
elsif !params[:to].match(Blacklight::Engine.config.email_regexp)
|
|
303
|
+
elsif !params[:to].match(Blacklight::Engine.config.blacklight.email_regexp)
|
|
304
304
|
flash[:error] = I18n.t('blacklight.email.errors.to.invalid', to: params[:to])
|
|
305
305
|
end
|
|
306
306
|
|
|
@@ -10,7 +10,7 @@ module Blacklight::SearchContext
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
class_methods do
|
|
14
14
|
# Save the submitted search parameters in the search session
|
|
15
15
|
def record_search_parameters opts = { only: :index }
|
|
16
16
|
before_action :set_current_search_session, opts
|
|
@@ -139,8 +139,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
|
139
139
|
Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
|
|
140
140
|
# The spelling response field may be missing from non solr repositories.
|
|
141
141
|
response.total <= spell_check_max &&
|
|
142
|
-
|
|
143
|
-
response.spelling.words.any?
|
|
142
|
+
(response.spelling&.words&.any? || response.spelling&.collation&.present? || false)
|
|
144
143
|
end
|
|
145
144
|
end
|
|
146
145
|
deprecation_deprecate should_show_spellcheck_suggestions?: 'moving into a private method of Blacklight::Response::SpellcheckComponent'
|
|
@@ -362,7 +361,8 @@ module Blacklight::BlacklightHelperBehavior
|
|
|
362
361
|
|
|
363
362
|
##
|
|
364
363
|
# Override this method if you want to use a differnet presenter for your documents
|
|
365
|
-
|
|
364
|
+
# @param [Blacklight::Document] optional, here for extension + backwards compatibility only
|
|
365
|
+
def document_presenter_class(document = nil)
|
|
366
366
|
Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
|
|
367
367
|
case action_name
|
|
368
368
|
when 'show', 'citation'
|
|
@@ -411,7 +411,15 @@ module Blacklight::BlacklightHelperBehavior
|
|
|
411
411
|
end
|
|
412
412
|
|
|
413
413
|
def partial_from_blacklight?(partial)
|
|
414
|
-
path =
|
|
414
|
+
path = if Rails::VERSION::MAJOR >= 6
|
|
415
|
+
name = partial.split('/').last
|
|
416
|
+
prefix = partial.split('/').first if partial.include?('/')
|
|
417
|
+
logger&.debug "Looking for document index partial #{partial}"
|
|
418
|
+
prefixes = lookup_context.prefixes + [prefix, ""].compact
|
|
419
|
+
lookup_context.find_all(name, prefixes, true).first&.identifier
|
|
420
|
+
else
|
|
421
|
+
lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
|
|
422
|
+
end
|
|
415
423
|
|
|
416
424
|
path&.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_path)
|
|
417
425
|
end
|
|
@@ -156,6 +156,9 @@ module Blacklight::CatalogHelperBehavior
|
|
|
156
156
|
|
|
157
157
|
##
|
|
158
158
|
# Render the sidebar partial for a document
|
|
159
|
+
# This is used as an integration point by downstream apps to add to the
|
|
160
|
+
# default sidebar.
|
|
161
|
+
# See: https://github.com/geoblacklight/geoblacklight/blob/7d3c31c7af3362879b97e2c1351a2496c728c59c/app/helpers/blacklight_helper.rb#L7
|
|
159
162
|
#
|
|
160
163
|
# @param [SolrDocument] document
|
|
161
164
|
# @return [String]
|
|
@@ -170,6 +173,8 @@ module Blacklight::CatalogHelperBehavior
|
|
|
170
173
|
|
|
171
174
|
##
|
|
172
175
|
# Render the main content partial for a document
|
|
176
|
+
# This is widely used as by downstream apps when they override their show view.
|
|
177
|
+
# See https://github.com/search?q=render_document_main_content_partial&type=Code
|
|
173
178
|
#
|
|
174
179
|
# @param [SolrDocument] _document
|
|
175
180
|
# @return [String]
|
|
@@ -316,21 +321,27 @@ module Blacklight::CatalogHelperBehavior
|
|
|
316
321
|
# Render an html <title> appropriate string for a set of search parameters
|
|
317
322
|
# @param [ActionController::Parameters] params2
|
|
318
323
|
# @return [String]
|
|
319
|
-
def render_search_to_page_title(
|
|
324
|
+
def render_search_to_page_title(search_state_or_params)
|
|
325
|
+
search_state = if search_state_or_params.is_a? Blacklight::SearchState
|
|
326
|
+
search_state_or_params
|
|
327
|
+
else
|
|
328
|
+
controller.search_state_class.new(params, blacklight_config, self)
|
|
329
|
+
end
|
|
330
|
+
|
|
320
331
|
constraints = []
|
|
321
332
|
|
|
322
|
-
if
|
|
323
|
-
q_label = label_for_search_field(
|
|
333
|
+
if search_state.query_param.present?
|
|
334
|
+
q_label = label_for_search_field(search_state.search_field.key) unless search_state.search_field&.key.blank? || default_search_field?(search_state.search_field.key)
|
|
324
335
|
|
|
325
336
|
constraints += if q_label.present?
|
|
326
|
-
[t('blacklight.search.page_title.constraint', label: q_label, value:
|
|
337
|
+
[t('blacklight.search.page_title.constraint', label: q_label, value: search_state.query_param)]
|
|
327
338
|
else
|
|
328
|
-
[
|
|
339
|
+
[search_state.query_param]
|
|
329
340
|
end
|
|
330
341
|
end
|
|
331
342
|
|
|
332
|
-
if
|
|
333
|
-
constraints +=
|
|
343
|
+
if search_state.filters.any?
|
|
344
|
+
constraints += search_state.filters.collect { |filter| render_search_to_page_title_filter(filter.key, filter.values) }
|
|
334
345
|
end
|
|
335
346
|
|
|
336
347
|
constraints.join(' / ')
|
|
@@ -191,9 +191,20 @@ module Blacklight::RenderPartialsHelperBehavior
|
|
|
191
191
|
document_index_path_templates.each do |str|
|
|
192
192
|
partial = format(str, index_view_type: view_type)
|
|
193
193
|
logger&.debug "Looking for document index partial #{partial}"
|
|
194
|
-
|
|
194
|
+
|
|
195
|
+
template = if Rails::VERSION::MAJOR >= 6
|
|
196
|
+
name = partial.split('/').last
|
|
197
|
+
prefix = partial.split('/').first if partial.include?('/')
|
|
198
|
+
|
|
199
|
+
prefixes = lookup_context.prefixes + [prefix, ""].compact
|
|
200
|
+
lookup_context.find_all(name, prefixes, true, locals.keys + [:documents], {}).first
|
|
201
|
+
else
|
|
202
|
+
lookup_context.find_all(partial, lookup_context.prefixes + [""], true, locals.keys + [:documents], {}).first
|
|
203
|
+
end
|
|
204
|
+
|
|
195
205
|
return template if template
|
|
196
206
|
end
|
|
207
|
+
|
|
197
208
|
nil
|
|
198
209
|
end
|
|
199
210
|
|
|
@@ -6,18 +6,29 @@
|
|
|
6
6
|
# Includes methods for rendering more textually on Search History page
|
|
7
7
|
# (render_search_to_s(_*))
|
|
8
8
|
module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
9
|
+
extend Deprecation
|
|
10
|
+
self.deprecation_horizon = '8.0'
|
|
11
|
+
|
|
9
12
|
# Simpler textual version of constraints, used on Search History page.
|
|
10
13
|
# Theoretically can may be DRY'd up with results page render_constraints,
|
|
11
14
|
# maybe even using the very same HTML with different CSS?
|
|
12
15
|
# But too tricky for now, too many changes to existing CSS. TODO.
|
|
13
16
|
def render_search_to_s(params)
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
return render(Blacklight::ConstraintsComponent.for_search_history(search_state: convert_to_search_state(params))) unless overridden_search_history_constraints_helper_methods?
|
|
18
|
+
|
|
19
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, 'Calling out to potentially overridden helpers for backwards compatibility.')
|
|
20
|
+
|
|
21
|
+
Deprecation.silence(Blacklight::SearchHistoryConstraintsHelperBehavior) do
|
|
22
|
+
render_search_to_s_q(params) +
|
|
23
|
+
render_search_to_s_filters(params)
|
|
24
|
+
end
|
|
16
25
|
end
|
|
26
|
+
deprecation_deprecate render_search_to_s: 'Use Blacklight::ConstraintsComponent.for_search_history instead'
|
|
17
27
|
|
|
18
28
|
##
|
|
19
29
|
# Render the search query constraint
|
|
20
30
|
def render_search_to_s_q(params)
|
|
31
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, '#render_search_to_s_q is deprecated without replacement')
|
|
21
32
|
return "".html_safe if params['q'].blank?
|
|
22
33
|
|
|
23
34
|
label = label_for_search_field(params[:search_field]) unless default_search_field?(params[:search_field])
|
|
@@ -28,6 +39,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
28
39
|
##
|
|
29
40
|
# Render the search facet constraints
|
|
30
41
|
def render_search_to_s_filters(params)
|
|
42
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, '#render_search_to_s_filters is deprecated without replacement')
|
|
31
43
|
return "".html_safe unless params[:f]
|
|
32
44
|
|
|
33
45
|
safe_join(params[:f].collect do |facet_field, value_list|
|
|
@@ -43,6 +55,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
43
55
|
# 'and'. Pass in option :escape_value => false to pass in pre-rendered
|
|
44
56
|
# html for value. key with escape_key if needed.
|
|
45
57
|
def render_search_to_s_element(key, value, _options = {})
|
|
58
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, '#render_search_to_s_element is deprecated without replacement')
|
|
46
59
|
tag.span(render_filter_name(key) + tag.span(value, class: 'filter-values'),
|
|
47
60
|
class: 'constraint')
|
|
48
61
|
end
|
|
@@ -50,6 +63,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
50
63
|
##
|
|
51
64
|
# Render the name of the facet
|
|
52
65
|
def render_filter_name name
|
|
66
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, '#render_filter_name is deprecated without replacement')
|
|
53
67
|
return "".html_safe if name.blank?
|
|
54
68
|
|
|
55
69
|
tag.span(t('blacklight.search.filters.label', label: name),
|
|
@@ -59,6 +73,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
59
73
|
##
|
|
60
74
|
# Render the value of the facet
|
|
61
75
|
def render_filter_value value, key = nil
|
|
76
|
+
Deprecation.warn(Blacklight::SearchHistoryConstraintsHelperBehavior, '#render_filter_value is deprecated without replacement')
|
|
62
77
|
display_value = value
|
|
63
78
|
Deprecation.silence(Blacklight::FacetsHelperBehavior) do
|
|
64
79
|
display_value = facet_display_value(key, value) if key
|
|
@@ -66,4 +81,17 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
|
66
81
|
tag.span(h(display_value),
|
|
67
82
|
class: 'filter-value')
|
|
68
83
|
end
|
|
84
|
+
|
|
85
|
+
private
|
|
86
|
+
|
|
87
|
+
# Check if the downstream application has overridden these methods
|
|
88
|
+
# @deprecated
|
|
89
|
+
# @private
|
|
90
|
+
def overridden_search_history_constraints_helper_methods?
|
|
91
|
+
method(:render_search_to_s_q).owner != Blacklight::FacetsHelperBehavior ||
|
|
92
|
+
method(:render_search_to_s_filters).owner != Blacklight::FacetsHelperBehavior ||
|
|
93
|
+
method(:render_search_to_s_element).owner != Blacklight::FacetsHelperBehavior ||
|
|
94
|
+
method(:render_filter_name).owner != Blacklight::FacetsHelperBehavior ||
|
|
95
|
+
method(:render_filter_value).owner != Blacklight::FacetsHelperBehavior
|
|
96
|
+
end
|
|
69
97
|
end
|
|
@@ -167,7 +167,9 @@ module Blacklight::UrlHelperBehavior
|
|
|
167
167
|
|
|
168
168
|
# Search History and Saved Searches display
|
|
169
169
|
def link_to_previous_search(params)
|
|
170
|
-
|
|
170
|
+
Deprecation.silence(Blacklight::SearchHistoryConstraintsHelperBehavior) do
|
|
171
|
+
link_to(render_search_to_s(params), search_action_path(params))
|
|
172
|
+
end
|
|
171
173
|
end
|
|
172
174
|
|
|
173
175
|
# Get url parameters to a search within a grouped result set
|
|
@@ -206,7 +206,7 @@ Blacklight.modal.checkCloseModal = function(event) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
Blacklight.modal.hide = function(el) {
|
|
209
|
-
if (bootstrap.Modal.VERSION >= "5") {
|
|
209
|
+
if (bootstrap && bootstrap.Modal && bootstrap.Modal.VERSION >= "5") {
|
|
210
210
|
bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).hide();
|
|
211
211
|
} else {
|
|
212
212
|
$(el || Blacklight.modal.modalSelector).modal('hide');
|
|
@@ -214,7 +214,7 @@ Blacklight.modal.hide = function(el) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
Blacklight.modal.show = function(el) {
|
|
217
|
-
if (bootstrap.Modal.VERSION >= "5") {
|
|
217
|
+
if (bootstrap && bootstrap.Modal && bootstrap.Modal.VERSION >= "5") {
|
|
218
218
|
bootstrap.Modal.getOrCreateInstance(el || document.querySelector(Blacklight.modal.modalSelector)).show();
|
|
219
219
|
} else {
|
|
220
220
|
$(el || Blacklight.modal.modalSelector).modal('show');
|
|
@@ -3,7 +3,7 @@ module Blacklight::Document
|
|
|
3
3
|
module SemanticFields
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
class_methods do
|
|
7
7
|
# Class-level method for accessing/setting semantic mappings
|
|
8
8
|
# for solr stored fields. Can be set by local app, key is
|
|
9
9
|
# a symbol for a semantic, value is a solr _stored_ field.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% @page_title = t('blacklight.search.page_title.title', :
|
|
1
|
+
<% @page_title = t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params), application_name: application_name) %>
|
|
2
2
|
|
|
3
3
|
<% content_for(:head) do -%>
|
|
4
4
|
<%= render 'catalog/opensearch_response_metadata', response: @response %>
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
<div class="modal-body">
|
|
7
7
|
<%= render '/shared/flash_msg' %>
|
|
8
8
|
<div class="form-group row">
|
|
9
|
-
<label class="control-label col-sm-2" for="to">
|
|
9
|
+
<label class="control-label col-sm-2" for="to">
|
|
10
10
|
<%= t('blacklight.sms.form.to') %>
|
|
11
11
|
</label>
|
|
12
12
|
<div class="col-sm-10">
|
|
13
|
-
<%= telephone_field_tag :to, params[:to], class: 'form-control' %>
|
|
13
|
+
<%= telephone_field_tag :to, params[:to], class: 'form-control', required: true %>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
16
|
<div class="form-group row">
|
|
17
17
|
<label class="control-label col-sm-2" for="carrier">
|
|
18
|
-
<%= t('blacklight.sms.form.carrier') %>
|
|
18
|
+
<%= t('blacklight.sms.form.carrier') %>
|
|
19
19
|
</label>
|
|
20
20
|
<div class="col-sm-10">
|
|
21
21
|
<%= select_tag(:carrier, options_for_select(sms_mappings.to_a.sort.unshift([t('blacklight.sms.form.carrier_prompt'),'']), params[:carrier]), class: 'form-control') %><br/>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%=
|
|
1
|
+
<%= render Blacklight::StartOverButtonComponent.new %>
|
data/blacklight.gemspec
CHANGED
|
@@ -25,18 +25,17 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
|
|
26
26
|
s.required_ruby_version = '>= 2.5'
|
|
27
27
|
|
|
28
|
-
s.add_dependency "rails", '>= 5.1', '< 7'
|
|
28
|
+
s.add_dependency "rails", '>= 5.1', '< 7.1'
|
|
29
29
|
s.add_dependency "globalid"
|
|
30
30
|
s.add_dependency "jbuilder", '~> 2.7'
|
|
31
31
|
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
|
|
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.
|
|
35
|
+
s.add_dependency "view_component", '~> 2.43'
|
|
36
36
|
|
|
37
37
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
|
38
|
-
s.add_development_dependency "rspec-rails", "~>
|
|
39
|
-
s.add_development_dependency "rspec-its"
|
|
38
|
+
s.add_development_dependency "rspec-rails", "~> 5.0"
|
|
40
39
|
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
|
|
41
40
|
s.add_development_dependency 'axe-core-rspec'
|
|
42
41
|
s.add_development_dependency "capybara", '~> 3'
|
|
@@ -8,7 +8,7 @@ module Blacklight
|
|
|
8
8
|
extend Deprecation
|
|
9
9
|
self.deprecation_horizon = 'blacklight version 8.0.0'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
class_methods do
|
|
12
12
|
# Add a configuration block for a collection of solr fields
|
|
13
13
|
def define_field_access(key, options = {})
|
|
14
14
|
key = key.to_s if respond_to? :to_s
|
|
@@ -142,7 +142,8 @@ module Blacklight
|
|
|
142
142
|
autocomplete_suggester: 'mySuggester',
|
|
143
143
|
raw_endpoint: OpenStructWithHashAccess.new(enabled: false),
|
|
144
144
|
track_search_session: true,
|
|
145
|
-
advanced_search: OpenStruct.new(enabled: false)
|
|
145
|
+
advanced_search: OpenStruct.new(enabled: false),
|
|
146
|
+
enable_search_bar_autofocus: false
|
|
146
147
|
}
|
|
147
148
|
end
|
|
148
149
|
# rubocop:enable Metrics/MethodLength
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Blacklight
|
|
4
|
+
module Deprecations
|
|
5
|
+
module EngineConfiguration
|
|
6
|
+
# rubocop:disable Style/RedundantSelf, Style/HashSyntax
|
|
7
|
+
# @deprecated
|
|
8
|
+
def bookmarks_http_method
|
|
9
|
+
self.blacklight.bookmarks_http_method
|
|
10
|
+
end
|
|
11
|
+
deprecation_deprecate bookmarks_http_method: 'Moved to `blacklight.bookmarks_http_method`'
|
|
12
|
+
|
|
13
|
+
# @deprecated
|
|
14
|
+
def bookmarks_http_method=(val)
|
|
15
|
+
self.blacklight.bookmarks_http_method = val
|
|
16
|
+
end
|
|
17
|
+
deprecation_deprecate :'bookmarks_http_method=' => 'Moved to `blacklight.bookmarks_http_method=`'
|
|
18
|
+
|
|
19
|
+
# @deprecated
|
|
20
|
+
def email_regexp
|
|
21
|
+
self.blacklight.email_regexp
|
|
22
|
+
end
|
|
23
|
+
deprecation_deprecate email_regexp: 'Moved to `blacklight.email_regexp`'
|
|
24
|
+
|
|
25
|
+
# @deprecated
|
|
26
|
+
def email_regexp=(val)
|
|
27
|
+
self.blacklight.email_regexp = val
|
|
28
|
+
end
|
|
29
|
+
deprecation_deprecate :'email_regexp=' => 'Moved to `blacklight.email_regexp=`'
|
|
30
|
+
|
|
31
|
+
# @deprecated
|
|
32
|
+
def facet_missing_param
|
|
33
|
+
self.blacklight.facet_missing_param
|
|
34
|
+
end
|
|
35
|
+
deprecation_deprecate facet_missing_param: 'Moved to `blacklight.facet_missing_param`'
|
|
36
|
+
|
|
37
|
+
# @deprecated
|
|
38
|
+
def facet_missing_param=(val)
|
|
39
|
+
self.blacklight.facet_missing_param = val
|
|
40
|
+
end
|
|
41
|
+
deprecation_deprecate :'facet_missing_param=' => 'Moved to `blacklight.facet_missing_param=`'
|
|
42
|
+
|
|
43
|
+
# @deprecated
|
|
44
|
+
def sms_mappings
|
|
45
|
+
self.blacklight.sms_mappings
|
|
46
|
+
end
|
|
47
|
+
deprecation_deprecate sms_mappings: 'Moved to `blacklight.sms_mappings`'
|
|
48
|
+
|
|
49
|
+
# @deprecated
|
|
50
|
+
def sms_mappings=(val)
|
|
51
|
+
self.blacklight.sms_mappings = val
|
|
52
|
+
end
|
|
53
|
+
deprecation_deprecate :'sms_mappings=' => 'Moved to `blacklight.sms_mappings=`'
|
|
54
|
+
# rubocop:enable Style/RedundantSelf, Style/HashSyntax
|
|
55
|
+
|
|
56
|
+
def self.deprecate_in(object)
|
|
57
|
+
class << object
|
|
58
|
+
extend Deprecation
|
|
59
|
+
self.deprecation_horizon = 'blacklight 8.0'
|
|
60
|
+
|
|
61
|
+
include Blacklight::Deprecations::EngineConfiguration
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|