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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 982aa4e78d4586096d97f31ccfdd52bfbfe5ff7f562248454240bca9c409d910
|
|
4
|
+
data.tar.gz: b9fc47ba21552ab4f29c166f04585bbbf70b25bdbe818f70d8d3bfd2c891db58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05d918ebf0f597eaaf5950e34a74785a79a0b7f0174f9d4458c8fa5f906abefb4016f8d307548d80cdc901a7b6a8288083623f9a7db52ebeb6bcc68f29140272
|
|
7
|
+
data.tar.gz: efcc57d374d646fe0f0113298383244c85180d059db1bb4e4f24537dbf24fee5f38b3a9f8f4ea8b5cbd0bffd3a3bfaffcbf3663d667ea48f33ae26ae0f6837e9
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
runs-on: ubuntu-latest
|
|
32
32
|
strategy:
|
|
33
33
|
matrix:
|
|
34
|
-
ruby: [2.7, 3.0]
|
|
34
|
+
ruby: [2.7, '3.0']
|
|
35
35
|
steps:
|
|
36
36
|
- uses: actions/checkout@v2
|
|
37
37
|
- name: Set up Ruby
|
|
@@ -48,7 +48,7 @@ jobs:
|
|
|
48
48
|
runs-on: ubuntu-latest
|
|
49
49
|
strategy:
|
|
50
50
|
matrix:
|
|
51
|
-
ruby: [3.0]
|
|
51
|
+
ruby: ['3.0']
|
|
52
52
|
steps:
|
|
53
53
|
- uses: actions/checkout@v2
|
|
54
54
|
- name: Set up Ruby
|
|
@@ -76,17 +76,17 @@ jobs:
|
|
|
76
76
|
- name: Install dependencies
|
|
77
77
|
run: bundle install
|
|
78
78
|
env:
|
|
79
|
-
RAILS_VERSION: 6.0.3.
|
|
79
|
+
RAILS_VERSION: 6.0.3.7
|
|
80
80
|
- name: Run tests
|
|
81
81
|
run: bundle exec rake ci
|
|
82
82
|
env:
|
|
83
|
-
RAILS_VERSION: 6.0.3.
|
|
83
|
+
RAILS_VERSION: 6.0.3.7
|
|
84
84
|
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
|
85
85
|
test_rails5_2:
|
|
86
86
|
runs-on: ubuntu-latest
|
|
87
87
|
strategy:
|
|
88
88
|
matrix:
|
|
89
|
-
ruby: [2.
|
|
89
|
+
ruby: [2.7]
|
|
90
90
|
steps:
|
|
91
91
|
- uses: actions/checkout@v2
|
|
92
92
|
- name: Set up Ruby
|
|
@@ -96,17 +96,38 @@ jobs:
|
|
|
96
96
|
- name: Install dependencies
|
|
97
97
|
run: bundle install
|
|
98
98
|
env:
|
|
99
|
-
RAILS_VERSION: 5.2.4.
|
|
99
|
+
RAILS_VERSION: 5.2.4.6
|
|
100
100
|
- name: Run tests
|
|
101
101
|
run: bundle exec rake ci
|
|
102
102
|
env:
|
|
103
|
-
RAILS_VERSION: 5.2.4.
|
|
103
|
+
RAILS_VERSION: 5.2.4.6
|
|
104
104
|
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
|
105
|
+
|
|
106
|
+
test_rails7_0:
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
strategy:
|
|
109
|
+
matrix:
|
|
110
|
+
ruby: ['3.0']
|
|
111
|
+
steps:
|
|
112
|
+
- uses: actions/checkout@v2
|
|
113
|
+
- name: Set up Ruby
|
|
114
|
+
uses: ruby/setup-ruby@v1
|
|
115
|
+
with:
|
|
116
|
+
ruby-version: ${{ matrix.ruby }}
|
|
117
|
+
- name: Install dependencies
|
|
118
|
+
run: bundle install
|
|
119
|
+
env:
|
|
120
|
+
RAILS_VERSION: 7.0.0
|
|
121
|
+
- name: Run tests
|
|
122
|
+
run: bundle exec rake ci
|
|
123
|
+
env:
|
|
124
|
+
RAILS_VERSION: 7.0.0
|
|
125
|
+
ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-keeps --skip-action-cable --skip-test'
|
|
105
126
|
api_test:
|
|
106
127
|
runs-on: ubuntu-latest
|
|
107
128
|
strategy:
|
|
108
129
|
matrix:
|
|
109
|
-
ruby: [2.7, 3.0]
|
|
130
|
+
ruby: [2.7, '3.0']
|
|
110
131
|
steps:
|
|
111
132
|
- uses: actions/checkout@v2
|
|
112
133
|
- name: Set up Ruby
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
7.
|
|
1
|
+
7.23.0
|
|
@@ -7,7 +7,7 @@ module Blacklight
|
|
|
7
7
|
renders_many :constraints
|
|
8
8
|
renders_many :search_field_controls
|
|
9
9
|
renders_many :search_filter_controls, (lambda do |config:, display_facet:, presenter: nil, component: nil, **kwargs|
|
|
10
|
-
presenter ||= (config.presenter || Blacklight::FacetFieldPresenter).new(config, display_facet,
|
|
10
|
+
presenter ||= (config.presenter || Blacklight::FacetFieldPresenter).new(config, display_facet, helpers)
|
|
11
11
|
component = component || config.advanced_search_component || Blacklight::FacetFieldCheckboxesComponent
|
|
12
12
|
|
|
13
13
|
component.new(facet_field: presenter, **kwargs)
|
|
@@ -30,7 +30,7 @@ module Blacklight
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def sort_fields_select
|
|
33
|
-
options = sort_fields.values.map { |field_config| [
|
|
33
|
+
options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
|
|
34
34
|
select_tag(:sort, options_for_select(options, params[:sort]), class: "form-control sort-select")
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -63,11 +63,11 @@ module Blacklight
|
|
|
63
63
|
|
|
64
64
|
def initialize_constraints
|
|
65
65
|
constraint do
|
|
66
|
-
params =
|
|
66
|
+
params = helpers.search_state.params_for_search.except :page, :f_inclusive, :q, :search_field, :op, :index, :sort
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
adv_search_context = helpers.search_state.reset(params)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Blacklight::ConstraintsComponent.for_search_history(search_state: adv_search_context)
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
<%= content_tag :div, id: @id, class: @classes do %>
|
|
2
|
-
|
|
1
|
+
<%= content_tag @tag || :div, id: @id, class: @classes do %>
|
|
2
|
+
<% if @render_headers %>
|
|
3
|
+
<h2 class="sr-only visually-hidden"><%= t('blacklight.search.search_constraints_header') %></h2>
|
|
4
|
+
<% end %>
|
|
3
5
|
|
|
4
|
-
<%=
|
|
6
|
+
<%= render @start_over_component.new if @start_over_component %>
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
<% if @render_headers %>
|
|
9
|
+
<span class="constraints-label sr-only visually-hidden"><%= t('blacklight.search.filters.title') %></span>
|
|
10
|
+
<% end %>
|
|
7
11
|
<% if query_constraints_area.present? %>
|
|
8
12
|
<% query_constraints_area.each do |constraint| %>
|
|
9
13
|
<%= constraint %>
|
|
@@ -8,53 +8,78 @@ module Blacklight
|
|
|
8
8
|
renders_many :facet_constraints_area
|
|
9
9
|
renders_many :additional_constraints
|
|
10
10
|
|
|
11
|
+
def self.for_search_history(**kwargs)
|
|
12
|
+
new(tag: :span,
|
|
13
|
+
render_headers: false,
|
|
14
|
+
id: nil,
|
|
15
|
+
query_constraint_component: Blacklight::SearchHistoryConstraintLayoutComponent,
|
|
16
|
+
facet_constraint_component_options: { layout: Blacklight::SearchHistoryConstraintLayoutComponent },
|
|
17
|
+
start_over_component: nil,
|
|
18
|
+
**kwargs)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# rubocop:disable Metrics/ParameterLists
|
|
11
22
|
def initialize(search_state:,
|
|
23
|
+
tag: :div,
|
|
24
|
+
render_headers: true,
|
|
12
25
|
id: 'appliedParams', classes: 'clearfix constraints-container',
|
|
13
|
-
query_constraint_component: Blacklight::ConstraintLayoutComponent,
|
|
26
|
+
query_constraint_component: Blacklight::ConstraintLayoutComponent,
|
|
27
|
+
query_constraint_component_options: {},
|
|
28
|
+
facet_constraint_component: Blacklight::ConstraintComponent,
|
|
29
|
+
facet_constraint_component_options: {},
|
|
30
|
+
start_over_component: Blacklight::StartOverButtonComponent)
|
|
14
31
|
@search_state = search_state
|
|
15
32
|
@query_constraint_component = query_constraint_component
|
|
33
|
+
@query_constraint_component_options = query_constraint_component_options
|
|
16
34
|
@facet_constraint_component = facet_constraint_component
|
|
35
|
+
@facet_constraint_component_options = facet_constraint_component_options
|
|
36
|
+
@start_over_component = start_over_component
|
|
37
|
+
@render_headers = render_headers
|
|
38
|
+
@tag = tag
|
|
17
39
|
@id = id
|
|
18
40
|
@classes = classes
|
|
19
41
|
end
|
|
42
|
+
# rubocop:enable Metrics/ParameterLists
|
|
20
43
|
|
|
21
44
|
def query_constraints
|
|
22
45
|
Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) do
|
|
23
46
|
if @search_state.query_param.present?
|
|
24
|
-
|
|
47
|
+
helpers.render(
|
|
25
48
|
@query_constraint_component.new(
|
|
26
49
|
search_state: @search_state,
|
|
27
50
|
value: @search_state.query_param,
|
|
28
51
|
label: label,
|
|
29
|
-
remove_path:
|
|
30
|
-
classes: 'query'
|
|
52
|
+
remove_path: helpers.remove_constraint_url(@search_state),
|
|
53
|
+
classes: 'query',
|
|
54
|
+
**@query_constraint_component_options
|
|
31
55
|
)
|
|
32
56
|
)
|
|
33
57
|
else
|
|
34
58
|
''.html_safe
|
|
35
59
|
end
|
|
36
|
-
end +
|
|
60
|
+
end + helpers.render(@facet_constraint_component.with_collection(clause_presenters.to_a, **@facet_constraint_component_options))
|
|
37
61
|
end
|
|
38
62
|
|
|
39
63
|
def facet_constraints
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def start_over_path
|
|
44
|
-
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
45
|
-
@view_context.start_over_path
|
|
46
|
-
end
|
|
64
|
+
helpers.render(@facet_constraint_component.with_collection(facet_item_presenters.to_a, **@facet_constraint_component_options))
|
|
47
65
|
end
|
|
48
66
|
|
|
49
67
|
def render?
|
|
50
|
-
Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) {
|
|
68
|
+
Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) { helpers.query_has_constraints?(@search_state.params) }
|
|
51
69
|
end
|
|
52
70
|
|
|
53
71
|
private
|
|
54
72
|
|
|
73
|
+
# @deprecated
|
|
74
|
+
def start_over_path
|
|
75
|
+
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
76
|
+
helpers.start_over_path
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
55
80
|
def label
|
|
56
81
|
Deprecation.silence(Blacklight::ConfigurationHelperBehavior) do
|
|
57
|
-
|
|
82
|
+
helpers.constraint_query_label(@search_state.params)
|
|
58
83
|
end
|
|
59
84
|
end
|
|
60
85
|
|
|
@@ -80,17 +105,17 @@ module Blacklight
|
|
|
80
105
|
return to_enum(:clause_presenters) unless block_given?
|
|
81
106
|
|
|
82
107
|
@search_state.clause_params.each do |key, clause|
|
|
83
|
-
field_config =
|
|
84
|
-
yield Blacklight::ClausePresenter.new(key, clause, field_config,
|
|
108
|
+
field_config = helpers.blacklight_config.search_fields[clause[:field]]
|
|
109
|
+
yield Blacklight::ClausePresenter.new(key, clause, field_config, helpers)
|
|
85
110
|
end
|
|
86
111
|
end
|
|
87
112
|
|
|
88
113
|
def facet_item_presenter(facet_config, facet_item, facet_field)
|
|
89
|
-
(facet_config.item_presenter || Blacklight::FacetItemPresenter).new(facet_item, facet_config,
|
|
114
|
+
(facet_config.item_presenter || Blacklight::FacetItemPresenter).new(facet_item, facet_config, helpers, facet_field)
|
|
90
115
|
end
|
|
91
116
|
|
|
92
117
|
def inclusive_facet_item_presenter(facet_config, facet_item, facet_field)
|
|
93
|
-
Blacklight::InclusiveFacetItemPresenter.new(facet_item, facet_config,
|
|
118
|
+
Blacklight::InclusiveFacetItemPresenter.new(facet_item, facet_config, helpers, facet_field)
|
|
94
119
|
end
|
|
95
120
|
end
|
|
96
121
|
end
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
class: @link_classes,
|
|
6
6
|
data: {}.merge(({ blacklight_modal: "trigger" } if @action.modal != false) || {}) %>
|
|
7
7
|
<% else %>
|
|
8
|
-
<%=
|
|
8
|
+
<%= helpers.render(partial: @action.partial || @action.name.to_s, locals: { document: @document, document_action_config: @action }.merge(@options)) %>
|
|
9
9
|
<% end %>
|
|
@@ -20,18 +20,25 @@ module Blacklight
|
|
|
20
20
|
return true if @action.component
|
|
21
21
|
return false unless @action.partial == 'document_action'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
helpers.partial_from_blacklight?(@action.partial)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def label
|
|
27
27
|
Deprecation.silence(Blacklight::ComponentHelperBehavior) do
|
|
28
|
-
|
|
28
|
+
helpers.document_action_label(@action.name, @action)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Action buttons get their URLs in one of three ways:
|
|
33
|
+
# - the action configuration explicitly specifies a helper method to call
|
|
34
|
+
# - a url route is inferred for ActiveModel-compliant objects (the default;
|
|
35
|
+
# note that, although Rails routing is available here, we still call out to
|
|
36
|
+
# helpers regardless, because that's where applications might have overridden the
|
|
37
|
+
# default Rails routing behavior)
|
|
38
|
+
# - calling out to an implicit helper method with a conventional name (unlikely)
|
|
32
39
|
def url
|
|
33
40
|
Deprecation.silence(Blacklight::ComponentHelperBehavior) do
|
|
34
|
-
|
|
41
|
+
helpers.document_action_path(@action, @url_opts.merge(({ id: @document } if @document) || {}))
|
|
35
42
|
end
|
|
36
43
|
end
|
|
37
44
|
|
|
@@ -16,11 +16,11 @@ module Blacklight
|
|
|
16
16
|
def bookmarked?
|
|
17
17
|
return @checked unless @checked.nil?
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
helpers.bookmarked? @document
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def bookmark_path
|
|
23
|
-
@bookmark_path ||
|
|
23
|
+
@bookmark_path || helpers.bookmark_path(@document)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
<%= grouped_documents %>
|
|
5
5
|
</div>
|
|
6
6
|
<%- if @group_limit > 0 && @group.total > @group_limit %>
|
|
7
|
-
<%=
|
|
7
|
+
<%= helpers.link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(@group), class: 'more-in-group' %>
|
|
8
8
|
<%- end %>
|
|
9
9
|
</div>
|
|
@@ -13,12 +13,12 @@ module Blacklight
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def grouped_documents
|
|
16
|
-
|
|
16
|
+
helpers.render_document_index @group.docs
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def add_group_facet_params_and_redirect(group)
|
|
20
20
|
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
21
|
-
|
|
21
|
+
helpers.search_action_path(helpers.add_group_facet_params_and_redirect(group))
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="card-header">More Like This</div>
|
|
3
3
|
<div class="card-body">
|
|
4
4
|
<ul>
|
|
5
|
-
|
|
5
|
+
<% @document.more_like_this.each do |document| %>
|
|
6
6
|
<li class="more_like_this_document">
|
|
7
7
|
<span class="mlt_title"><%= link_to_document document %></span>
|
|
8
8
|
</li>
|
|
@@ -114,7 +114,7 @@ module Blacklight
|
|
|
114
114
|
def classes
|
|
115
115
|
[
|
|
116
116
|
@classes,
|
|
117
|
-
|
|
117
|
+
helpers.render_document_class(@document),
|
|
118
118
|
'document',
|
|
119
119
|
("document-position-#{@counter}" if @counter)
|
|
120
120
|
].compact.flatten
|
|
@@ -130,7 +130,7 @@ module Blacklight
|
|
|
130
130
|
private
|
|
131
131
|
|
|
132
132
|
def presenter
|
|
133
|
-
@presenter ||=
|
|
133
|
+
@presenter ||= helpers.document_presenter(@document)
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
def show?
|
|
@@ -24,7 +24,7 @@ module Blacklight
|
|
|
24
24
|
# Content for the document title area; should be an inline element
|
|
25
25
|
def title
|
|
26
26
|
if @link_to_document
|
|
27
|
-
|
|
27
|
+
helpers.link_to_document presenter.document, @title.presence || content.presence, counter: @counter, itemprop: 'name'
|
|
28
28
|
else
|
|
29
29
|
content_tag('span', @title.presence || content.presence || presenter.heading, itemprop: 'name')
|
|
30
30
|
end
|
|
@@ -39,7 +39,7 @@ module Blacklight
|
|
|
39
39
|
|
|
40
40
|
(@has_actions_slot && get_slot(:actions)) ||
|
|
41
41
|
([@document_component&.actions] if @document_component&.actions.present?) ||
|
|
42
|
-
[
|
|
42
|
+
[helpers.render_index_doc_actions(presenter.document, wrapping_class: 'index-document-functions col-sm-3 col-lg-2')]
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def counter
|
|
@@ -53,7 +53,7 @@ module Blacklight
|
|
|
53
53
|
private
|
|
54
54
|
|
|
55
55
|
def presenter
|
|
56
|
-
@presenter ||=
|
|
56
|
+
@presenter ||= helpers.document_presenter(@document)
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
end
|
|
@@ -17,7 +17,7 @@ module Blacklight
|
|
|
17
17
|
return to_enum(:presenters) unless block_given?
|
|
18
18
|
|
|
19
19
|
@facet_field.paginator.items.each do |item|
|
|
20
|
-
yield (@facet_field.facet_field.item_presenter || Blacklight::FacetItemPresenter).new(item, @facet_field.facet_field,
|
|
20
|
+
yield (@facet_field.facet_field.item_presenter || Blacklight::FacetItemPresenter).new(item, @facet_field.facet_field, helpers, @facet_field.key, @facet_field.search_state)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="inclusive_or card card-body bg-light mb-3">
|
|
2
2
|
<h5><%= t('blacklight.advanced_search.any_of') %></h5>
|
|
3
3
|
<ul class="list-unstyled facet-values">
|
|
4
|
-
<%=
|
|
4
|
+
<%= helpers.render(Blacklight::FacetItemComponent.with_collection(presenters.to_a)) %>
|
|
5
5
|
</ul>
|
|
6
6
|
</div>
|
|
@@ -22,7 +22,7 @@ module Blacklight
|
|
|
22
22
|
return to_enum(:presenters) unless block_given?
|
|
23
23
|
|
|
24
24
|
values.each do |item|
|
|
25
|
-
yield Blacklight::FacetGroupedItemPresenter.new(values, item, @facet_field.facet_field,
|
|
25
|
+
yield Blacklight::FacetGroupedItemPresenter.new(values, item, @facet_field.facet_field, helpers, @facet_field.key, @facet_field.search_state)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<%= @facet_field.label %>
|
|
4
4
|
<% end %>
|
|
5
5
|
<% component.body do %>
|
|
6
|
-
<%=
|
|
6
|
+
<%= helpers.render(Blacklight::FacetFieldInclusiveConstraintComponent.new(facet_field: @facet_field)) %>
|
|
7
7
|
<ul class="facet-values list-unstyled">
|
|
8
8
|
<%= render_facet_limit_list @facet_field.paginator, @facet_field.key %>
|
|
9
9
|
</ul>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<div class="prev_next_links btn-group">
|
|
2
|
-
<%=
|
|
2
|
+
<%= helpers.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
|
-
<%=
|
|
6
|
+
<%= helpers.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
|
-
<%=
|
|
14
|
+
<%= helpers.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
|
+
<%= helpers.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>
|
|
@@ -87,7 +87,7 @@ module Blacklight
|
|
|
87
87
|
# remove link
|
|
88
88
|
link_to(@href, class: "remove", rel: "nofollow") do
|
|
89
89
|
tag.span('✖', class: "remove-icon", aria: { hidden: true }) +
|
|
90
|
-
tag.span(
|
|
90
|
+
tag.span(helpers.t(:'blacklight.search.facets.selected.remove'), class: 'sr-only visually-hidden')
|
|
91
91
|
end
|
|
92
92
|
end + render_facet_count(classes: ["selected"])
|
|
93
93
|
end
|
|
@@ -101,7 +101,7 @@ module Blacklight
|
|
|
101
101
|
# @return [String]
|
|
102
102
|
# @private
|
|
103
103
|
def render_facet_count(options = {})
|
|
104
|
-
return
|
|
104
|
+
return helpers.render_facet_count(@hits, options) unless helpers.method(:render_facet_count).owner == Blacklight::FacetsHelperBehavior || explicit_component_configuration?
|
|
105
105
|
|
|
106
106
|
return '' if @hits.blank?
|
|
107
107
|
|
|
@@ -74,11 +74,11 @@ module Blacklight
|
|
|
74
74
|
# with overrides of deprecated helpers. In 8.x, we can just call Component#render_in
|
|
75
75
|
# and call it a day
|
|
76
76
|
def render_component(component)
|
|
77
|
-
|
|
77
|
+
helpers.render(component)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
def facet_item_presenter(facet_item)
|
|
81
|
-
(@facet_item.facet_config.item_presenter || Blacklight::FacetItemPresenter).new(facet_item, @facet_item.facet_config,
|
|
81
|
+
(@facet_item.facet_config.item_presenter || Blacklight::FacetItemPresenter).new(facet_item, @facet_item.facet_config, helpers, @facet_item.facet_field, @facet_item.search_state)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -17,9 +17,9 @@ module Blacklight
|
|
|
17
17
|
def label
|
|
18
18
|
Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
|
|
19
19
|
if @show
|
|
20
|
-
|
|
20
|
+
helpers.render_document_show_field_label @field.document, label: @field.label('show'), field: @field.key
|
|
21
21
|
else
|
|
22
|
-
|
|
22
|
+
helpers.render_index_field_label @field.document, label: @field.label, field: @field.key
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
<%= content_tag :div, id: @panel_id, class: 'facets-collapse collapse' do %>
|
|
25
25
|
<% Deprecation.silence(Blacklight::FacetsHelperBehavior) do %>
|
|
26
|
-
<%=
|
|
26
|
+
<%= helpers.render_facet_partials @fields, response: @response %>
|
|
27
27
|
<% end %>
|
|
28
28
|
<% end %>
|
|
29
29
|
<% end %>
|
|
@@ -8,18 +8,29 @@ module Blacklight
|
|
|
8
8
|
# @param [Array<String>] options explicit spellcheck options to render
|
|
9
9
|
def initialize(response:, options: nil)
|
|
10
10
|
@response = response
|
|
11
|
-
@options = options
|
|
11
|
+
@options = options
|
|
12
|
+
@options ||= options_from_response(@response)
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def link_to_query(query)
|
|
15
16
|
Deprecation.silence(Blacklight::UrlHelperBehavior) do
|
|
16
|
-
|
|
17
|
+
helpers.link_to_query(query)
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def render?
|
|
21
22
|
Deprecation.silence(Blacklight::BlacklightHelperBehavior) do
|
|
22
|
-
@options
|
|
23
|
+
@options&.any? && helpers.should_show_spellcheck_suggestions?(@response)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def options_from_response(response)
|
|
30
|
+
if response&.spelling&.collation
|
|
31
|
+
[response.spelling.collation]
|
|
32
|
+
elsif response&.spelling&.words
|
|
33
|
+
response.spelling.words
|
|
23
34
|
end
|
|
24
35
|
end
|
|
25
36
|
end
|