blacklight 7.38.0 → 7.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.github/workflows/ruby.yml +1 -43
- data/.rubocop.yml +13 -4
- data/.rubocop_todo.yml +396 -160
- data/Gemfile +0 -8
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_constraints.scss +4 -4
- data/app/components/blacklight/advanced_search_form_component.html.erb +2 -2
- data/app/components/blacklight/document_component.html.erb +4 -0
- data/app/components/blacklight/document_component.rb +27 -4
- data/app/components/blacklight/document_title_component.rb +4 -1
- data/app/components/blacklight/facet_component.rb +2 -2
- data/app/components/blacklight/facet_field_checkboxes_component.html.erb +1 -1
- data/app/components/blacklight/icons/icon_component.rb +9 -4
- data/app/components/blacklight/response/pagination_component.rb +6 -1
- data/app/components/blacklight/response/sort_component.html.erb +1 -6
- data/app/components/blacklight/response/sort_component.rb +17 -2
- data/app/components/blacklight/response/spellcheck_component.rb +1 -1
- data/app/components/blacklight/response/view_type_button_component.rb +1 -1
- data/app/components/blacklight/response/view_type_component.rb +1 -1
- data/app/components/blacklight/search/per_page_component.html.erb +2 -0
- data/app/components/blacklight/search/per_page_component.rb +50 -0
- data/app/components/blacklight/system/dropdown_button_component.rb +18 -0
- data/app/components/blacklight/system/dropdown_component.rb +4 -7
- data/app/components/blacklight/system/flash_message_component.html.erb +1 -1
- data/app/components/blacklight/system/flash_message_component.rb +1 -1
- data/app/components/blacklight/system/modal_component.rb +1 -1
- data/app/helpers/blacklight/catalog_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/icon_helper_behavior.rb +3 -0
- data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
- data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -10
- data/app/views/kaminari/blacklight/_page.html.erb +1 -2
- data/app/views/shared/_flash_messages.html.erb +1 -1
- data/blacklight.gemspec +8 -5
- data/docker-compose.yml +0 -2
- data/lib/blacklight/configuration/view_config.rb +6 -0
- data/lib/blacklight/configuration.rb +4 -17
- data/lib/blacklight/open_struct_with_hash_access.rb +0 -15
- data/lib/blacklight/solr/response.rb +0 -12
- data/lib/blacklight/solr/search_builder_behavior.rb +2 -0
- data/lib/blacklight/solr.rb +0 -6
- data/lib/blacklight.rb +5 -20
- data/lib/generators/blacklight/assets_generator.rb +0 -3
- data/package.json +1 -1
- data/spec/components/blacklight/document/action_component_spec.rb +1 -6
- data/spec/components/blacklight/document_component_spec.rb +50 -0
- data/spec/components/blacklight/icons/icon_component_spec.rb +42 -0
- data/spec/components/blacklight/response/pagination_component_spec.rb +53 -0
- data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
- data/spec/models/blacklight/solr/search_builder_spec.rb +13 -0
- data/spec/services/blacklight/search_service_spec.rb +12 -12
- data/spec/spec_helper.rb +0 -28
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -0
- data/spec/views/catalog/index.atom.builder_spec.rb +2 -1
- data/template.demo.rb +7 -7
- metadata +61 -12
data/Gemfile
CHANGED
@@ -36,14 +36,6 @@ else
|
|
36
36
|
unless ENV['VIEW_COMPONENT_VERSION'].to_s == ""
|
37
37
|
gem 'view_component', ENV.fetch('VIEW_COMPONENT_VERSION')
|
38
38
|
end
|
39
|
-
|
40
|
-
case ENV['RAILS_VERSION']
|
41
|
-
when /^6.0/
|
42
|
-
gem 'sass-rails', '>= 6'
|
43
|
-
gem 'webpacker', '~> 4.0'
|
44
|
-
when /^5.[12]/
|
45
|
-
gem 'sass-rails', '~> 5.0'
|
46
|
-
end
|
47
39
|
end
|
48
40
|
# END ENGINE_CART BLOCK
|
49
41
|
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.39.0
|
@@ -15,19 +15,19 @@
|
|
15
15
|
white-space: nowrap;
|
16
16
|
|
17
17
|
@media (max-width: breakpoint-min(sm)) {
|
18
|
-
max-width: breakpoint-min(sm) * .5;
|
18
|
+
max-width: breakpoint-min(sm) * 0.5;
|
19
19
|
}
|
20
20
|
|
21
21
|
@media (min-width: breakpoint-min(sm)) and (max-width: breakpoint-max(sm)) {
|
22
|
-
max-width: breakpoint-min(sm) * .5;
|
22
|
+
max-width: breakpoint-min(sm) * 0.5;
|
23
23
|
}
|
24
24
|
|
25
25
|
@media (min-width: breakpoint-min(md)) and (max-width: breakpoint-max(md)) {
|
26
|
-
max-width: breakpoint-min(md) * .5;
|
26
|
+
max-width: breakpoint-min(md) * 0.5;
|
27
27
|
}
|
28
28
|
|
29
29
|
@media (min-width: breakpoint-min(lg)) {
|
30
|
-
max-width: breakpoint-min(lg) * .5;
|
30
|
+
max-width: breakpoint-min(lg) * 0.5;
|
31
31
|
}
|
32
32
|
|
33
33
|
&:hover, &:active {
|
@@ -40,8 +40,8 @@
|
|
40
40
|
|
41
41
|
<% if sort_fields_select %>
|
42
42
|
<div class="form-group row mb-4">
|
43
|
-
<%= content_tag :h2, t('blacklight.advanced_search.form.sort_label'), id: 'advanced-search-sort-label', class: 'col-md-3
|
44
|
-
<div class="col">
|
43
|
+
<%= content_tag :h2, t('blacklight.advanced_search.form.sort_label'), id: 'advanced-search-sort-label', class: 'col-md-3 text-md-right' %>
|
44
|
+
<div class="col-md-9">
|
45
45
|
<%= sort_fields_select %>
|
46
46
|
</div>
|
47
47
|
</div>
|
@@ -88,6 +88,7 @@ module Blacklight
|
|
88
88
|
# rubocop:disable Metrics/ParameterLists
|
89
89
|
# @param document [Blacklight::Document]
|
90
90
|
# @param presenter [Blacklight::DocumentPresenter]
|
91
|
+
# @param partials [Array, nil] view partial names that should be used to provide content for the `partials` slot
|
91
92
|
# @param id [String] HTML id for the root element
|
92
93
|
# @param classes [Array, String] additional HTML classes for the root element
|
93
94
|
# @param component [Symbol, String] HTML tag type to use for the root element
|
@@ -96,7 +97,7 @@ module Blacklight
|
|
96
97
|
# @param document_counter [Number, nil] alternatively, the document's position in a collection and,
|
97
98
|
# @param counter_offset [Number] with `document_counter`, the offset of the start of that collection counter to the overall result set
|
98
99
|
# @param show [Boolean] are we showing only a single document (vs a list of search results); used for backwards-compatibility
|
99
|
-
def initialize(document: nil, presenter: nil,
|
100
|
+
def initialize(document: nil, presenter: nil, partials: nil,
|
100
101
|
id: nil, classes: [], component: :article, title_component: nil,
|
101
102
|
metadata_component: nil,
|
102
103
|
embed_component: nil,
|
@@ -107,8 +108,13 @@ module Blacklight
|
|
107
108
|
raise ArgumentError, 'missing keyword: :document or :presenter'
|
108
109
|
end
|
109
110
|
|
110
|
-
|
111
|
-
|
111
|
+
if document.is_a?(Blacklight::DocumentPresenter) && presenter.nil?
|
112
|
+
@presenter = document
|
113
|
+
@document = @presenter.document || args[self.class.collection_parameter]
|
114
|
+
else
|
115
|
+
@document = document || presenter&.document || args[self.class.collection_parameter]
|
116
|
+
@presenter = presenter
|
117
|
+
end
|
112
118
|
|
113
119
|
@component = component
|
114
120
|
@title_component = title_component
|
@@ -129,6 +135,7 @@ module Blacklight
|
|
129
135
|
@counter ||= @document_counter + COLLECTION_INDEX_OFFSET + counter_offset if @document_counter.present?
|
130
136
|
|
131
137
|
@show = show
|
138
|
+
@view_partials = partials
|
132
139
|
end
|
133
140
|
# rubocop:enable Metrics/ParameterLists
|
134
141
|
|
@@ -145,12 +152,28 @@ module Blacklight
|
|
145
152
|
def before_render
|
146
153
|
set_slot(:title, nil) unless title
|
147
154
|
set_slot(:thumbnail, nil, component: @thumbnail_component || presenter.view_config&.thumbnail_component) unless thumbnail || show?
|
148
|
-
set_slot(:metadata, nil, component: @metadata_component || presenter&.view_config&.metadata_component, fields: presenter.field_presenters) unless metadata
|
155
|
+
set_slot(:metadata, nil, component: @metadata_component || presenter&.view_config&.metadata_component, fields: presenter.field_presenters, show: @show) unless metadata
|
149
156
|
set_slot(:embed, nil, component: @embed_component || presenter.view_config&.embed_component) unless embed
|
157
|
+
|
158
|
+
# Blacklight 8 allows applications to pass in the partials to render instead of requiring the template to render the slots.
|
159
|
+
if partials.empty? && view_partials.present? # rubocop:disable Style/GuardClause
|
160
|
+
@render_partials = true
|
161
|
+
view_partials.each do |view_partial|
|
162
|
+
with_partial(view_partial) do
|
163
|
+
helpers.render_document_partial @document, view_partial, component: self, document_counter: @counter
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def render_partials?
|
170
|
+
@render_partials || presenter.view_config&.render_partials_in_component?
|
150
171
|
end
|
151
172
|
|
152
173
|
private
|
153
174
|
|
175
|
+
attr_reader :view_partials
|
176
|
+
|
154
177
|
def presenter
|
155
178
|
@presenter ||= helpers.document_presenter(@document)
|
156
179
|
end
|
@@ -7,7 +7,7 @@ module Blacklight
|
|
7
7
|
renders_many :actions
|
8
8
|
|
9
9
|
# rubocop:disable Metrics/ParameterLists
|
10
|
-
def initialize(title = nil, document: nil, presenter: nil, as: :h3, counter: nil, classes: 'index_title document-title-heading col', link_to_document: true, document_component: nil)
|
10
|
+
def initialize(title = nil, document: nil, presenter: nil, as: :h3, counter: nil, classes: 'index_title document-title-heading col', link_to_document: true, document_component: nil, actions: true)
|
11
11
|
raise ArgumentError, 'missing keyword: :document or :presenter' if presenter.nil? && document.nil?
|
12
12
|
|
13
13
|
@title = title
|
@@ -18,6 +18,7 @@ module Blacklight
|
|
18
18
|
@classes = classes
|
19
19
|
@link_to_document = link_to_document
|
20
20
|
@document_component = document_component
|
21
|
+
@actions = actions
|
21
22
|
end
|
22
23
|
# rubocop:enable Metrics/ParameterLists
|
23
24
|
|
@@ -32,6 +33,8 @@ module Blacklight
|
|
32
33
|
|
33
34
|
# Content for the document actions area
|
34
35
|
def actions
|
36
|
+
return [] unless @actions
|
37
|
+
|
35
38
|
if block_given?
|
36
39
|
@has_actions_slot = true
|
37
40
|
return super
|
@@ -11,7 +11,7 @@ module Blacklight
|
|
11
11
|
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
12
12
|
# @param [Blacklight::Configuration] blacklight_config
|
13
13
|
# @param [Boolean] layout
|
14
|
-
# rubocop:disable Metrics/
|
14
|
+
# rubocop:disable Metrics/ParameterLists
|
15
15
|
def initialize(display_facet_or_field_config: nil, display_facet: nil, field_config: nil, response: nil, blacklight_config: nil, component: nil, **component_args)
|
16
16
|
if display_facet_or_field_config.is_a? Blacklight::FacetFieldPresenter
|
17
17
|
@facet_field_presenter = display_facet_or_field_config
|
@@ -33,7 +33,7 @@ module Blacklight
|
|
33
33
|
@component = component || (@field_config.component == true ? Blacklight::FacetFieldListComponent : @field_config.component)
|
34
34
|
@component_args = component_args
|
35
35
|
end
|
36
|
-
# rubocop:enable Metrics/
|
36
|
+
# rubocop:enable Metrics/ParameterLists
|
37
37
|
|
38
38
|
def render?
|
39
39
|
helpers.should_render_field?(@field_config, @display_facet)
|
@@ -2,15 +2,16 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
module Icons
|
5
|
-
# This is the
|
5
|
+
# This is the base class for icon components. You should extend this class for each icon.
|
6
|
+
#
|
6
7
|
# You can override the default svg by setting:
|
7
|
-
# Blacklight::Icons::
|
8
|
+
# Blacklight::Icons::MyIconComponent.svg = '<svg>your SVG here</svg>'
|
8
9
|
class IconComponent < ::ViewComponent::Base
|
9
10
|
# rubocop:disable Metrics/ParameterLists
|
10
11
|
def initialize(svg: nil, tag: :span, name: nil, label: nil, aria_hidden: nil, classes: nil, **options)
|
11
12
|
self.svg = svg if svg
|
12
|
-
@classes = Array(classes) + ['blacklight-icons', "blacklight-icons-#{name}"]
|
13
13
|
@name = name
|
14
|
+
@assigned_classes = Array(classes)
|
14
15
|
@tag = tag
|
15
16
|
@options = options.merge(aria: options.fetch(:aria, {}).reverse_merge(label: label, hidden: aria_hidden))
|
16
17
|
end
|
@@ -18,12 +19,16 @@ module Blacklight
|
|
18
19
|
|
19
20
|
def call
|
20
21
|
tag.public_send(@tag, svg&.html_safe, # rubocop:disable Rails/OutputSafety
|
21
|
-
class:
|
22
|
+
class: classes,
|
22
23
|
**@options)
|
23
24
|
end
|
24
25
|
|
25
26
|
class_attribute :svg
|
26
27
|
|
28
|
+
def classes
|
29
|
+
@classes ||= @assigned_classes + ['blacklight-icons', "blacklight-icons-#{name}"]
|
30
|
+
end
|
31
|
+
|
27
32
|
def name
|
28
33
|
@name ||= self.class.name.demodulize.underscore.sub('_component', '')
|
29
34
|
end
|
@@ -17,7 +17,12 @@ module Blacklight
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def pagination
|
20
|
-
|
20
|
+
args = configured_options.merge(@pagination_args).compact
|
21
|
+
helpers.paginate @response, **args
|
22
|
+
end
|
23
|
+
|
24
|
+
def configured_options
|
25
|
+
controller.blacklight_config.index.pagination_options
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
module Response
|
5
|
-
class SortComponent <
|
6
|
-
def initialize(param: 'sort', choices: {},
|
5
|
+
class SortComponent < Blacklight::Component
|
6
|
+
def initialize(search_state:, param: 'sort', choices: {}, id: 'sort-dropdown', classes: [], selected: nil)
|
7
7
|
@param = param
|
8
8
|
@choices = choices
|
9
9
|
@search_state = search_state
|
@@ -11,6 +11,21 @@ module Blacklight
|
|
11
11
|
@classes = classes
|
12
12
|
@selected = selected
|
13
13
|
end
|
14
|
+
|
15
|
+
# You may override this method in a subclass if you want to use a different dropdown component
|
16
|
+
def dropdown_class
|
17
|
+
Blacklight::System::DropdownComponent
|
18
|
+
end
|
19
|
+
|
20
|
+
def dropdown
|
21
|
+
render(dropdown_class.new(
|
22
|
+
param: @param,
|
23
|
+
choices: @choices,
|
24
|
+
id: @id,
|
25
|
+
search_state: @search_state,
|
26
|
+
selected: @selected
|
27
|
+
))
|
28
|
+
end
|
14
29
|
end
|
15
30
|
end
|
16
31
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Response
|
5
5
|
# Render spellcheck results for a search query
|
6
|
-
class SpellcheckComponent <
|
6
|
+
class SpellcheckComponent < Blacklight::Component
|
7
7
|
# @param [Blacklight::Response] response
|
8
8
|
# @param [Array<String>] options explicit spellcheck options to render
|
9
9
|
def initialize(response:, options: nil)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Response
|
5
5
|
# Render spellcheck results for a search query
|
6
|
-
class ViewTypeButtonComponent <
|
6
|
+
class ViewTypeButtonComponent < Blacklight::Component
|
7
7
|
with_collection_parameter :view
|
8
8
|
# @param [Blacklight::Configuration::View] view
|
9
9
|
def initialize(view:, key: nil, selected: false, search_state: nil, classes: 'btn btn-outline-secondary btn-icon')
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Response
|
5
5
|
# Render spellcheck results for a search query
|
6
|
-
class ViewTypeComponent <
|
6
|
+
class ViewTypeComponent < Blacklight::Component
|
7
7
|
renders_many :views, 'Blacklight::Response::ViewTypeButtonComponent'
|
8
8
|
|
9
9
|
# @param [Blacklight::Response] response
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Search
|
5
|
+
class PerPageComponent < Blacklight::Component
|
6
|
+
def initialize(blacklight_config:, response:, search_state:)
|
7
|
+
@blacklight_config = blacklight_config
|
8
|
+
@response = response
|
9
|
+
@search_state = search_state
|
10
|
+
end
|
11
|
+
|
12
|
+
def render?
|
13
|
+
helpers.show_sort_and_per_page?
|
14
|
+
end
|
15
|
+
|
16
|
+
# You may override this method in a subclass if you want to use a different dropdown component
|
17
|
+
def dropdown_class
|
18
|
+
Blacklight::System::DropdownComponent
|
19
|
+
end
|
20
|
+
|
21
|
+
def dropdown
|
22
|
+
render(dropdown_class.new(
|
23
|
+
param: :per_page,
|
24
|
+
choices: per_page_options_for_select,
|
25
|
+
id: 'per_page-dropdown',
|
26
|
+
search_state: @search_state,
|
27
|
+
selected: current_per_page,
|
28
|
+
interpolation: :count
|
29
|
+
))
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# @return [Integer]
|
34
|
+
def current_per_page
|
35
|
+
(@response.rows if @response && @response.rows > 0) || # rubocop:disable Style/NumericPredicate
|
36
|
+
params.fetch(:per_page, @blacklight_config.default_per_page).to_i
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# The available options for results per page, in the style of #options_for_select
|
41
|
+
def per_page_options_for_select
|
42
|
+
return [] if @blacklight_config.per_page.blank?
|
43
|
+
|
44
|
+
@blacklight_config.per_page.map do |count|
|
45
|
+
[t(:'blacklight.search.per_page.label', count: count).html_safe, count]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module System
|
5
|
+
class DropdownButtonComponent < Blacklight::Component
|
6
|
+
def initialize(label:, classes: %w[btn btn-outline-secondary dropdown-toggle])
|
7
|
+
@classes = classes
|
8
|
+
@label = label
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
button_tag class: @classes, aria: { expanded: false }, data: { toggle: 'dropdown', 'bs-toggle': 'dropdown' } do
|
13
|
+
safe_join([@label, content_tag(:span, '', class: 'caret')])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,12 +2,9 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
module System
|
5
|
-
class DropdownComponent <
|
6
|
-
renders_one :button,
|
7
|
-
|
8
|
-
safe_join([label, content_tag(:span, '', class: 'caret')])
|
9
|
-
end
|
10
|
-
end)
|
5
|
+
class DropdownComponent < Blacklight::Component
|
6
|
+
renders_one :button, DropdownButtonComponent
|
7
|
+
|
11
8
|
renders_many :options, (lambda do |text:, url:, selected: false|
|
12
9
|
link_to(text, url, class: "dropdown-item #{'active' if selected}", role: 'menuitem', aria: { current: ('page' if selected) })
|
13
10
|
end)
|
@@ -29,7 +26,7 @@ module Blacklight
|
|
29
26
|
end
|
30
27
|
|
31
28
|
def before_render
|
32
|
-
with_button(
|
29
|
+
with_button(label: button_label) unless button
|
33
30
|
|
34
31
|
return if options.any?
|
35
32
|
|
@@ -127,10 +127,12 @@ module Blacklight::CatalogHelperBehavior
|
|
127
127
|
##
|
128
128
|
# Look up the current per page value, or the default if none if set
|
129
129
|
#
|
130
|
+
# @deprecated
|
130
131
|
# @return [Integer]
|
131
132
|
def current_per_page
|
132
133
|
(@response.rows if @response && @response.rows > 0) || params.fetch(:per_page, blacklight_config.default_per_page).to_i
|
133
134
|
end
|
135
|
+
deprecation_deprecate current_per_page: 'has moved to Blacklight::Search::PerPageComponent'
|
134
136
|
|
135
137
|
##
|
136
138
|
# Get the classes to add to a document's div
|
@@ -207,6 +207,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
207
207
|
deprecation_deprecate default_per_page: "Use blacklight_config.default_per_page instead"
|
208
208
|
|
209
209
|
##
|
210
|
+
# @deprecated
|
210
211
|
# The available options for results per page, in the style of #options_for_select
|
211
212
|
def per_page_options_for_select
|
212
213
|
return [] if blacklight_config.per_page.blank?
|
@@ -215,6 +216,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
215
216
|
[t(:'blacklight.search.per_page.label', count: count).html_safe, count]
|
216
217
|
end
|
217
218
|
end
|
219
|
+
deprecation_deprecate per_page_options_for_select: 'has moved to Blacklight::Search::PerPageComponent'
|
218
220
|
|
219
221
|
##
|
220
222
|
# Determine whether to render a field by evaluating :if and :unless conditions
|
@@ -10,6 +10,9 @@ module Blacklight::IconHelperBehavior
|
|
10
10
|
# @param [String, Symbol] icon_name
|
11
11
|
# @return [String]
|
12
12
|
def blacklight_icon(icon_name, **kwargs)
|
13
|
+
return render(icon_name.new) if icon_name.is_a?(Class)
|
14
|
+
return render(icon_name) if icon_name.is_a?(ViewComponent::Base)
|
15
|
+
|
13
16
|
render "Blacklight::Icons::#{icon_name.to_s.camelize}Component".constantize.new(**kwargs)
|
14
17
|
rescue NameError
|
15
18
|
Rails.cache.fetch([:blacklight_icons, icon_name, kwargs]) do
|
@@ -40,11 +40,11 @@ module Blacklight
|
|
40
40
|
end
|
41
41
|
|
42
42
|
##
|
43
|
-
# Class used for specifying main layout container classes.
|
44
|
-
#
|
43
|
+
# Class used for specifying main layout container classes.
|
44
|
+
# Set config.full_width_layout to true to use a fluid layout.
|
45
45
|
# @return [String]
|
46
46
|
def container_classes
|
47
|
-
'container'
|
47
|
+
blacklight_config.full_width_layout ? 'container-fluid' : 'container'
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -30,7 +30,7 @@ module Blacklight::Document
|
|
30
30
|
# but extensions should call super and modify hash returned, to avoid
|
31
31
|
# unintentionally erasing values provided by other extensions.
|
32
32
|
def to_semantic_values
|
33
|
-
@semantic_value_hash ||= self.class.field_semantics.each_with_object(Hash.new
|
33
|
+
@semantic_value_hash ||= self.class.field_semantics.each_with_object(Hash.new { |hash, key| hash[key] = [] }) do |(key, field_names), hash|
|
34
34
|
##
|
35
35
|
# Handles single string field_name or an array of field_names
|
36
36
|
value = Array.wrap(field_names).map { |field_name| self[field_name] }.flatten.compact
|
@@ -1,10 +1 @@
|
|
1
|
-
|
2
|
-
<span class="sr-only visually-hidden"><%= t('blacklight.search.per_page.title') %></span>
|
3
|
-
<%= render(Blacklight::System::DropdownComponent.new(
|
4
|
-
param: :per_page,
|
5
|
-
choices: per_page_options_for_select,
|
6
|
-
id: 'per_page-dropdown',
|
7
|
-
search_state: search_state,
|
8
|
-
selected: current_per_page,
|
9
|
-
interpolation: :count)) %>
|
10
|
-
<% end %>
|
1
|
+
<%= render Blacklight::Search::PerPageComponent.new(search_state: search_state, blacklight_config: blacklight_config, response: @response) %>
|
@@ -11,9 +11,8 @@
|
|
11
11
|
|
12
12
|
<li class="page-item <%= 'active' if page.current? %>">
|
13
13
|
<% if page.current? %>
|
14
|
-
<span class="page-link" aria-
|
14
|
+
<span class="page-link" aria-current="page"><%= page_display %><span class="sr-only visually-hidden"> <%= t('views.pagination.aria.current_page', page: page_display) %></span></span>
|
15
15
|
<% else %>
|
16
16
|
<%= link_to page_display, url, :remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil, class: 'page-link', aria: { label: t('views.pagination.aria.go_to_page', page: page_display) } %>
|
17
17
|
<% end %>
|
18
18
|
</li>
|
19
|
-
|
data/blacklight.gemspec
CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
s.require_paths = ["lib"]
|
25
25
|
|
26
|
-
s.required_ruby_version = '>= 2.
|
26
|
+
s.required_ruby_version = '>= 2.7'
|
27
27
|
|
28
|
-
s.add_dependency "rails", '>=
|
28
|
+
s.add_dependency "rails", '>= 6.1', '< 7.3'
|
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
|
@@ -34,9 +34,10 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_dependency "ostruct", '>= 0.3.2'
|
35
35
|
s.add_dependency "view_component", '>= 2.66', '< 4'
|
36
36
|
s.add_dependency 'hashdiff'
|
37
|
+
s.add_dependency "zeitwerk"
|
37
38
|
|
38
39
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
39
|
-
s.add_development_dependency "rspec-rails", ">=
|
40
|
+
s.add_development_dependency "rspec-rails", ">= 6.0" # some versions tested need >= 6.0
|
40
41
|
s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
|
41
42
|
s.add_development_dependency 'axe-core-rspec'
|
42
43
|
s.add_development_dependency "capybara", '~> 3'
|
@@ -44,9 +45,11 @@ Gem::Specification.new do |s|
|
|
44
45
|
s.add_development_dependency 'engine_cart', '~> 2.1'
|
45
46
|
s.add_development_dependency "equivalent-xml"
|
46
47
|
s.add_development_dependency "simplecov"
|
47
|
-
s.add_development_dependency "rubocop", '~>
|
48
|
+
s.add_development_dependency "rubocop", '~> 1.66'
|
49
|
+
s.add_development_dependency "rubocop-capybara", '~> 2.21'
|
48
50
|
s.add_development_dependency "rubocop-rails", '~> 2.6'
|
49
|
-
s.add_development_dependency "rubocop-rspec", '~>
|
51
|
+
s.add_development_dependency "rubocop-rspec", '~> 3.0'
|
52
|
+
s.add_development_dependency "rubocop-rspec_rails", '~> 2.30'
|
50
53
|
s.add_development_dependency "i18n-tasks"
|
51
54
|
s.add_development_dependency "solr_wrapper"
|
52
55
|
end
|
data/docker-compose.yml
CHANGED
@@ -5,6 +5,8 @@ class Blacklight::Configuration
|
|
5
5
|
# @return [String] partial to render around the documents
|
6
6
|
# @!attribute partials
|
7
7
|
# @return [Array<String>] partials to render for each document(see #render_document_partials)
|
8
|
+
# @!attribute [w] render_partials_in_component
|
9
|
+
# @return [Boolean] whether to render partials in the component. This is false by default in Blacklight 7, but true in Blacklight 8.
|
8
10
|
# @!attribute document_presenter_class
|
9
11
|
# @return [Class] document presenter class used by helpers and views
|
10
12
|
# @!attribute document_component
|
@@ -42,6 +44,10 @@ class Blacklight::Configuration
|
|
42
44
|
)
|
43
45
|
end
|
44
46
|
|
47
|
+
def render_partials_in_component?
|
48
|
+
render_partials_in_component
|
49
|
+
end
|
50
|
+
|
45
51
|
class Show < ViewConfig
|
46
52
|
# @!attribute route
|
47
53
|
# @return [Hash] Default route parameters for 'show' requests.
|