blacklight 8.12.2 → 9.0.0.beta1
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/.env +3 -3
- data/.github/pull_request_template.md +7 -0
- data/.github/workflows/ruby.yml +98 -0
- data/.rubocop.yml +2 -2
- data/.rubocop_todo.yml +0 -9
- data/.solr_wrapper.yml +0 -2
- data/README.md +30 -8
- data/VERSION +1 -1
- data/app/assets/builds/blacklight.css +448 -0
- data/app/assets/javascripts/blacklight/blacklight.esm.js +8 -51
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +8 -51
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -4
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -3
- data/app/assets/stylesheets/blacklight/_bookmark.scss +44 -41
- data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -29
- data/app/assets/stylesheets/blacklight/_constraints.scss +15 -24
- data/app/assets/stylesheets/blacklight/_controls.scss +2 -18
- data/app/assets/stylesheets/blacklight/_facets.scss +15 -82
- data/app/assets/stylesheets/blacklight/_group.scss +2 -5
- data/app/assets/stylesheets/blacklight/_header.scss +4 -11
- data/app/assets/stylesheets/blacklight/_icons.scss +0 -8
- data/app/assets/stylesheets/blacklight/_modal.scss +9 -10
- data/app/assets/stylesheets/blacklight/_pagination.scss +3 -5
- data/app/assets/stylesheets/blacklight/_search_form.scss +0 -1
- data/app/assets/stylesheets/blacklight/_search_history.scss +0 -4
- data/app/assets/stylesheets/blacklight/_search_results.scss +1 -15
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +9 -17
- data/app/assets/stylesheets/blacklight/build.scss +4 -0
- data/app/components/blacklight/advanced_search_form_component.rb +1 -1
- data/app/components/blacklight/constraint_component.rb +1 -1
- data/app/components/blacklight/constraint_layout_component.html.erb +2 -2
- data/app/components/blacklight/constraints_component.html.erb +2 -2
- data/app/components/blacklight/constraints_component.rb +1 -1
- data/app/components/blacklight/document/action_component.rb +3 -1
- data/app/components/blacklight/document/bookmark_component.html.erb +3 -3
- data/app/components/blacklight/document/bookmark_component.rb +0 -1
- data/app/components/blacklight/document/group_component.html.erb +1 -1
- data/app/components/blacklight/document/page_header_component.rb +3 -3
- data/app/components/blacklight/document/sidebar_component.rb +5 -5
- data/app/components/blacklight/document_component.rb +14 -20
- data/app/components/blacklight/document_title_component.rb +3 -2
- data/app/components/blacklight/facet_field_component.html.erb +5 -5
- data/app/components/blacklight/facet_field_list_component.rb +4 -22
- data/app/components/blacklight/facet_field_pagination_component.html.erb +2 -2
- 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/header_component.rb +2 -2
- data/app/components/blacklight/response/facet_group_component.html.erb +3 -18
- data/app/components/blacklight/response/facet_group_component.rb +7 -23
- data/app/components/blacklight/response/facet_toggle_button_component.html.erb +16 -0
- data/app/components/blacklight/response/facet_toggle_button_component.rb +14 -0
- data/app/components/blacklight/response/pagination_component.html.erb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +2 -1
- data/app/components/blacklight/response/sort_component.rb +1 -0
- data/app/components/blacklight/response/view_type_button_component.html.erb +1 -1
- data/app/components/blacklight/response/view_type_component.html.erb +1 -1
- data/app/components/blacklight/search/facet_suggest_input.html.erb +7 -10
- data/app/components/blacklight/search/facet_suggest_input.rb +0 -4
- data/app/components/blacklight/search/per_page_component.html.erb +1 -1
- data/app/components/blacklight/search/per_page_component.rb +1 -0
- data/app/components/blacklight/search/sidebar_component.html.erb +1 -1
- data/app/components/blacklight/search/sidebar_component.rb +1 -1
- data/app/components/blacklight/search_bar_component.html.erb +3 -3
- data/app/components/blacklight/search_bar_component.rb +2 -2
- data/app/components/blacklight/search_button_component.rb +2 -2
- data/app/components/blacklight/search_context/server_applied_params_component.html.erb +2 -2
- data/app/components/blacklight/search_context/server_applied_params_component.rb +9 -0
- data/app/components/blacklight/skip_link_component.html.erb +1 -1
- data/app/components/blacklight/skip_link_component.rb +2 -1
- data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
- data/app/components/blacklight/system/dropdown_component.rb +1 -1
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +3 -2
- data/app/controllers/concerns/blacklight/search_context.rb +1 -13
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -6
- data/app/helpers/blacklight/catalog_helper_behavior.rb +0 -10
- data/app/helpers/blacklight/configuration_helper_behavior.rb +0 -12
- data/app/helpers/blacklight/document_helper_behavior.rb +0 -26
- data/app/helpers/blacklight/icon_helper_behavior.rb +1 -9
- data/app/helpers/blacklight/layout_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +0 -14
- data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
- data/app/javascript/{blacklight → blacklight-frontend}/bookmark_toggle.js +1 -1
- data/app/javascript/{blacklight → blacklight-frontend}/core.js +2 -10
- data/app/javascript/{blacklight → blacklight-frontend}/debounce.js +1 -1
- data/app/javascript/blacklight-frontend/facet_suggest.js +26 -0
- data/app/javascript/blacklight-frontend/index.js +18 -0
- data/app/javascript/{blacklight → blacklight-frontend}/modal.js +2 -14
- data/app/javascript/{blacklight → blacklight-frontend}/search_context.js +2 -3
- data/app/models/concerns/blacklight/document.rb +0 -11
- data/app/models/concerns/blacklight/user.rb +1 -1
- data/app/presenters/blacklight/facet_field_presenter.rb +2 -2
- data/app/presenters/blacklight/json_presenter.rb +3 -1
- data/app/services/blacklight/search_params_yaml_coder.rb +0 -2
- data/app/views/bookmarks/_clear_bookmarks_widget.html.erb +0 -2
- data/app/views/bookmarks/index.html.erb +1 -1
- data/app/views/catalog/_document.atom.builder +1 -1
- data/app/views/catalog/_document.html.erb +1 -1
- data/app/views/catalog/_results_pagination.html.erb +2 -5
- data/app/views/catalog/_search_results.html.erb +3 -3
- data/app/views/catalog/_search_results_header.html.erb +1 -1
- data/app/views/catalog/_show_main_content.html.erb +1 -1
- data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
- data/app/views/catalog/_sort_widget.html.erb +1 -0
- data/app/views/catalog/facet.html.erb +9 -9
- data/app/views/catalog/show.html.erb +2 -3
- data/app/views/kaminari/blacklight/_paginator.html.erb +1 -2
- data/app/views/layouts/blacklight/base.html.erb +3 -7
- data/app/views/search_history/index.html.erb +0 -2
- data/blacklight.gemspec +4 -4
- data/config/importmap.rb +1 -1
- data/config/locales/blacklight.ar.yml +4 -4
- data/config/locales/blacklight.ca.yml +124 -124
- data/config/locales/blacklight.de.yml +2 -2
- data/config/locales/blacklight.en.yml +14 -14
- data/config/locales/blacklight.es.yml +4 -4
- data/config/locales/blacklight.fr.yml +4 -4
- data/config/locales/blacklight.hu.yml +4 -4
- data/config/locales/blacklight.it.yml +3 -3
- data/config/locales/blacklight.nl.yml +3 -3
- data/config/locales/blacklight.pt-BR.yml +3 -3
- data/config/locales/blacklight.sq.yml +4 -4
- data/config/locales/blacklight.zh.yml +4 -4
- data/lib/blacklight/component.rb +1 -2
- data/lib/blacklight/configuration/display_field.rb +1 -1
- data/lib/blacklight/configuration/fields.rb +3 -3
- data/lib/blacklight/configuration/view_config.rb +0 -2
- data/lib/blacklight/configuration.rb +5 -11
- data/lib/blacklight/engine.rb +0 -6
- data/lib/blacklight/open_struct_with_hash_access.rb +4 -4
- data/lib/blacklight/search_builder.rb +4 -4
- data/lib/blacklight/search_state/filter_field.rb +2 -2
- data/lib/blacklight/solr/request.rb +1 -7
- data/lib/blacklight/solr/response/group_response.rb +2 -2
- data/lib/blacklight.rb +1 -1
- data/lib/generators/blacklight/assets/importmap_generator.rb +8 -24
- data/lib/generators/blacklight/assets/propshaft_generator.rb +1 -1
- data/lib/generators/blacklight/assets_generator.rb +3 -3
- data/lib/generators/blacklight/controller_generator.rb +3 -3
- data/lib/generators/blacklight/templates/.solr_wrapper.yml +0 -2
- data/lib/generators/blacklight/user_generator.rb +9 -10
- data/package.json +14 -4
- data/rollup.config.js +1 -1
- data/spec/components/blacklight/document/action_component_spec.rb +1 -5
- data/spec/components/blacklight/document/sidebar_component_spec.rb +5 -20
- data/spec/components/blacklight/document_component_spec.rb +9 -14
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +2 -2
- data/spec/components/blacklight/facet_field_list_component_spec.rb +2 -2
- data/spec/components/blacklight/search/facet_suggest_input_spec.rb +3 -27
- data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
- data/spec/controllers/blacklight/catalog_spec.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/features/axe_spec.rb +6 -11
- data/spec/features/bookmarks_spec.rb +48 -11
- data/spec/features/facets_spec.rb +22 -90
- data/spec/features/search_context_spec.rb +1 -2
- data/spec/features/search_filters_spec.rb +6 -6
- data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +0 -9
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +1 -1
- data/spec/lib/blacklight/parameters_spec.rb +1 -12
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +0 -18
- data/spec/models/blacklight/solr/request_spec.rb +7 -0
- data/spec/services/blacklight/search_service_spec.rb +1 -1
- data/spec/support/presenter_test_helpers.rb +1 -1
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
- data/spec/views/catalog/facet.html.erb_spec.rb +0 -8
- data/spec/views/catalog/index.atom.builder_spec.rb +0 -2
- data/spec/views/catalog/index.html.erb_spec.rb +6 -3
- data/spec/views/catalog/show.html.erb_spec.rb +1 -0
- data/tasks/blacklight.rake +8 -5
- metadata +30 -64
- data/.github/matrix.json +0 -92
- data/.github/workflows/build.yml +0 -16
- data/.github/workflows/lint.yml +0 -25
- data/.github/workflows/main.yml +0 -24
- data/.github/workflows/test.yml +0 -58
- data/app/assets/stylesheets/blacklight/_autocomplete.scss +0 -25
- data/app/assets/stylesheets/blacklight/_mixins.scss +0 -20
- data/app/components/blacklight/icons/legacy_icon_component.rb +0 -30
- data/app/javascript/blacklight/facet_suggest.js +0 -48
- data/app/javascript/blacklight/index.js +0 -18
- data/app/views/catalog/_constraints.html.erb +0 -1
- data/app/views/catalog/_facets.html.erb +0 -5
- data/app/views/catalog/_search_form.html.erb +0 -7
- data/app/views/catalog/_search_header.html.erb +0 -1
- data/app/views/catalog/_show_sidebar.html.erb +0 -3
- data/app/views/catalog/_show_tools.html.erb +0 -2
- data/app/views/catalog/_start_over.html.erb +0 -1
- data/app/views/shared/_header_navbar.html.erb +0 -1
- data/lib/generators/blacklight/assets/sprockets_generator.rb +0 -68
- data/spec/components/blacklight/system/dropdown_component_spec.rb +0 -26
- data/spec/views/catalog/_search_header.erb_spec.rb +0 -14
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -24
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +0 -37
- /data/app/javascript/{blacklight → blacklight-frontend}/button_focus.js +0 -0
- /data/app/javascript/{blacklight → blacklight-frontend}/checkbox_submit.js +0 -0
- /data/app/javascript/{blacklight → blacklight-frontend}/modalForm.js +0 -0
@@ -8,9 +8,9 @@
|
|
8
8
|
absent: t('blacklight.search.bookmarks.absent'),
|
9
9
|
inprogress: t('blacklight.search.bookmarks.inprogress')
|
10
10
|
}) do %>
|
11
|
-
<div class="
|
12
|
-
<label class="toggle-bookmark" data-checkboxsubmit-target="label">
|
13
|
-
<input type="checkbox" class="toggle-bookmark <%= bookmark_icon ? 'd-none' : '' %>" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if bookmarked? %>>
|
11
|
+
<div class="toggle-bookmark">
|
12
|
+
<label class="toggle-bookmark-label" data-checkboxsubmit-target="label">
|
13
|
+
<input type="checkbox" class="toggle-bookmark-input <%= bookmark_icon ? 'd-none' : '' %>" data-checkboxsubmit-target="checkbox" <%= 'checked="checked"' if bookmarked? %>>
|
14
14
|
<%= bookmark_icon %>
|
15
15
|
<span data-checkboxsubmit-target="span"><%= bookmarked? ? t('blacklight.search.bookmarks.present') : t('blacklight.search.bookmarks.absent') %></span>
|
16
16
|
</label>
|
@@ -4,6 +4,6 @@
|
|
4
4
|
<%= grouped_documents %>
|
5
5
|
</div>
|
6
6
|
<%- if @group_limit > 0 && @group.total > @group_limit %>
|
7
|
-
<%= helpers.link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(@group), class: 'more-in-group' %>
|
7
|
+
<%= helpers.link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(@group), class: 'more-in-group float-right' %>
|
8
8
|
<%- end %>
|
9
9
|
</div>
|
@@ -4,12 +4,12 @@ module Blacklight
|
|
4
4
|
module Document
|
5
5
|
# Render the start over and prev/next displays
|
6
6
|
class PageHeaderComponent < Blacklight::Component
|
7
|
-
attr_reader :document, :search_context, :search_session
|
7
|
+
attr_reader :document, :blacklight_config, :search_context, :search_session
|
8
8
|
|
9
9
|
delegate :blacklight_config, to: :helpers
|
10
10
|
|
11
11
|
def initialize(document:, search_context:, search_session:)
|
12
|
-
super
|
12
|
+
super
|
13
13
|
@search_context = search_context
|
14
14
|
@search_session = search_session
|
15
15
|
@document = document
|
@@ -40,7 +40,7 @@ module Blacklight
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def header_container_classes
|
43
|
-
has_header_tools? ? 'row pagination-search-widgets pb-
|
43
|
+
has_header_tools? ? 'row pagination-search-widgets pb-3' : 'pagination-search-widgets pb-3'
|
44
44
|
end
|
45
45
|
|
46
46
|
def header_actions
|
@@ -16,12 +16,12 @@ module Blacklight
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def
|
20
|
-
blacklight_config.view_config(:show).show_tools_component
|
21
|
-
|
22
|
-
end
|
19
|
+
def show_tools_component_class
|
20
|
+
blacklight_config.view_config(:show).show_tools_component
|
21
|
+
end
|
23
22
|
|
24
|
-
|
23
|
+
def render_show_tools
|
24
|
+
render show_tools_component_class.new(document: document)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -22,9 +22,6 @@ module Blacklight
|
|
22
22
|
class DocumentComponent < Blacklight::Component
|
23
23
|
with_collection_parameter :document
|
24
24
|
|
25
|
-
# ViewComponent 3 changes iteration counters to begin at 0 rather than 1
|
26
|
-
COLLECTION_INDEX_OFFSET = ViewComponent::VERSION::MAJOR < 3 ? 0 : 1
|
27
|
-
|
28
25
|
# Content appearing before the document
|
29
26
|
renders_one :header
|
30
27
|
|
@@ -37,7 +34,7 @@ module Blacklight
|
|
37
34
|
|
38
35
|
# The document title with some reasonable default behavior
|
39
36
|
renders_one :title, (lambda do |*args, component: nil, **kwargs|
|
40
|
-
component ||=
|
37
|
+
component ||= view_config.title_component || Blacklight::DocumentTitleComponent
|
41
38
|
|
42
39
|
component.new(*args, counter: @counter, document: @document, presenter: @presenter, as: @title_component, actions: !@show, link_to_document: !@show, document_component: self, **kwargs)
|
43
40
|
end)
|
@@ -45,7 +42,7 @@ module Blacklight
|
|
45
42
|
renders_one :embed, (lambda do |static_content = nil, *args, component: nil, **kwargs|
|
46
43
|
next static_content if static_content.present?
|
47
44
|
|
48
|
-
component ||=
|
45
|
+
component ||= view_config.embed_component
|
49
46
|
|
50
47
|
next unless component
|
51
48
|
|
@@ -56,7 +53,7 @@ module Blacklight
|
|
56
53
|
renders_one :metadata, (lambda do |static_content = nil, *args, component: nil, fields: nil, **kwargs|
|
57
54
|
next static_content if static_content.present?
|
58
55
|
|
59
|
-
component ||=
|
56
|
+
component ||= view_config.metadata_component || Blacklight::DocumentMetadataComponent
|
60
57
|
|
61
58
|
component.new(*args, fields: fields || @presenter&.field_presenters || [], **kwargs)
|
62
59
|
end)
|
@@ -67,7 +64,7 @@ module Blacklight
|
|
67
64
|
renders_one :thumbnail, (lambda do |image_options_or_static_content = {}, *args, component: nil, **kwargs|
|
68
65
|
next image_options_or_static_content if image_options_or_static_content.is_a? String
|
69
66
|
|
70
|
-
component ||=
|
67
|
+
component ||= view_config.thumbnail_component || Blacklight::Document::ThumbnailComponent
|
71
68
|
|
72
69
|
component.new(*args, document: @document, presenter: @presenter, counter: @counter, image_options: image_options_or_static_content, **kwargs)
|
73
70
|
end)
|
@@ -81,7 +78,6 @@ module Blacklight
|
|
81
78
|
|
82
79
|
# rubocop:disable Metrics/ParameterLists
|
83
80
|
# @param document [Blacklight::DocumentPresenter]
|
84
|
-
# @param presenter [Blacklight::DocumentPresenter] alias for document
|
85
81
|
# @param partials [Array, nil] view partial names that should be used to provide content for the `partials` slot
|
86
82
|
# @param id [String] HTML id for the root element
|
87
83
|
# @param classes [Array, String] additional HTML classes for the root element
|
@@ -91,14 +87,11 @@ module Blacklight
|
|
91
87
|
# @param document_counter [Number, nil] provided by ViewComponent collection iteration
|
92
88
|
# @param counter_offset [Number] the offset of the start of the collection counter parameter for the component to the overall result set
|
93
89
|
# @param show [Boolean] are we showing only a single document (vs a list of search results); used for backwards-compatibility
|
94
|
-
def initialize(document: nil,
|
90
|
+
def initialize(document: nil, partials: nil,
|
95
91
|
id: nil, classes: [], component: :article, title_component: nil,
|
96
92
|
counter: nil, document_counter: nil, counter_offset: 0,
|
97
93
|
show: false, **args)
|
98
|
-
|
99
|
-
|
100
|
-
# .collection_parameter only works in view_component3, and functionality removed in BL9
|
101
|
-
@presenter = presenter || document || (self.class.respond_to?(:collection_parameter) && args[self.class.collection_parameter])
|
94
|
+
@presenter = document || args[self.class.collection_parameter]
|
102
95
|
@document = @presenter.document
|
103
96
|
@view_partials = partials || []
|
104
97
|
|
@@ -108,9 +101,8 @@ module Blacklight
|
|
108
101
|
@classes = classes
|
109
102
|
|
110
103
|
@counter = counter
|
111
|
-
|
112
|
-
@
|
113
|
-
@counter ||= @document_counter + COLLECTION_INDEX_OFFSET + counter_offset if @document_counter.present?
|
104
|
+
@document_counter = document_counter || args.fetch(self.class.collection_counter_parameter, nil)
|
105
|
+
@counter ||= 1 + @document_counter + counter_offset if @document_counter.present?
|
114
106
|
|
115
107
|
@show = show
|
116
108
|
end
|
@@ -127,10 +119,10 @@ module Blacklight
|
|
127
119
|
end
|
128
120
|
|
129
121
|
def before_render
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
122
|
+
set_slot(:title, nil) unless title
|
123
|
+
set_slot(:thumbnail, nil) unless thumbnail || show?
|
124
|
+
set_slot(:metadata, nil, fields: presenter.field_presenters, show: @show) unless metadata
|
125
|
+
set_slot(:embed, nil) unless embed
|
134
126
|
|
135
127
|
view_partials.each do |view_partial|
|
136
128
|
with_partial(view_partial) do
|
@@ -141,6 +133,8 @@ module Blacklight
|
|
141
133
|
|
142
134
|
private
|
143
135
|
|
136
|
+
delegate :view_config, to: :@presenter
|
137
|
+
|
144
138
|
attr_reader :document_counter, :presenter, :view_partials
|
145
139
|
|
146
140
|
def show?
|
@@ -7,7 +7,8 @@ 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 h5', link_to_document: true, document_component: nil,
|
11
|
+
actions: true)
|
11
12
|
raise ArgumentError, 'missing keyword: :document or :presenter' if presenter.nil? && document.nil?
|
12
13
|
|
13
14
|
@title = title
|
@@ -42,7 +43,7 @@ module Blacklight
|
|
42
43
|
|
43
44
|
(@has_actions_slot && get_slot(:actions)) ||
|
44
45
|
([@document_component&.actions] if @document_component&.actions.present?) ||
|
45
|
-
[helpers.render_index_doc_actions(presenter.document, wrapping_class: 'index-document-functions col-sm-3 col-lg-2')]
|
46
|
+
[helpers.render_index_doc_actions(presenter.document, wrapping_class: 'index-document-functions col-sm-3 col-lg-2 mb-4 mb-sm-0')]
|
46
47
|
end
|
47
48
|
|
48
49
|
def counter
|
@@ -1,20 +1,20 @@
|
|
1
|
-
<div class="
|
2
|
-
<h3 class="
|
1
|
+
<div class="accordion-item facet-limit blacklight-<%= @facet_field.key %> <%= 'facet-limit-active' if @facet_field.active? %>">
|
2
|
+
<h3 class="accordion-header p-0 facet-field-heading h6" id="<%= header_html_id %>">
|
3
3
|
<button
|
4
4
|
type="button"
|
5
|
-
class="btn
|
5
|
+
class="btn accordion-button <%= "collapsed" if @facet_field.collapsed? %>"
|
6
6
|
data-toggle="collapse"
|
7
7
|
data-bs-toggle="collapse"
|
8
8
|
data-target="#<%= html_id %>"
|
9
9
|
data-bs-target="#<%= html_id %>"
|
10
10
|
aria-expanded="<%= @facet_field.collapsed? ? 'false' : 'true' %>"
|
11
|
-
|
11
|
+
arial-controls="<%= html_id %>"
|
12
12
|
>
|
13
13
|
<%= label %>
|
14
14
|
</button>
|
15
15
|
</h3>
|
16
16
|
<div id="<%= html_id %>" role="region" aria-labelledby="<%= header_html_id %>" class="panel-collapse facet-content collapse <%= "show" unless @facet_field.collapsed? %>">
|
17
|
-
<div class="
|
17
|
+
<div class="accordion-body">
|
18
18
|
<%= body %>
|
19
19
|
|
20
20
|
<% if @facet_field.modal_path %>
|
@@ -7,24 +7,6 @@ module Blacklight
|
|
7
7
|
@layout = layout == false ? FacetFieldNoLayoutComponent : Blacklight::FacetFieldComponent
|
8
8
|
end
|
9
9
|
|
10
|
-
##
|
11
|
-
# Renders the list of values
|
12
|
-
# removes any elements where render_facet_item returns a nil value. This enables an application
|
13
|
-
# to filter undesireable facet items so they don't appear in the UI
|
14
|
-
# @deprecated
|
15
|
-
def render_facet_limit_list(paginator, facet_field, wrapping_element = :li)
|
16
|
-
return render(facet_items(wrapping_element: wrapping_element)) if paginator == @facet_field.paginator && facet_field == @facet_field.key
|
17
|
-
|
18
|
-
facet_config ||= helpers.facet_configuration_for_field(facet_field)
|
19
|
-
|
20
|
-
collection = paginator.items.map do |item|
|
21
|
-
facet_item_presenter(item, facet_config, facet_field)
|
22
|
-
end
|
23
|
-
|
24
|
-
render(facet_item_component_class(facet_config).with_collection(collection, wrapping_element: wrapping_element))
|
25
|
-
end
|
26
|
-
Blacklight.deprecation.deprecate_methods(self, render_facet_limit_list: 'Call e.g. `render facet_items` instead')
|
27
|
-
|
28
10
|
def facet_items(wrapping_element: :li, **item_args)
|
29
11
|
facet_item_component_class.with_collection(facet_item_presenters, wrapping_element: wrapping_element, **item_args)
|
30
12
|
end
|
@@ -39,12 +21,12 @@ module Blacklight
|
|
39
21
|
@facet_field.paginator&.items&.any?
|
40
22
|
end
|
41
23
|
|
42
|
-
def facet_item_presenter(facet_item
|
43
|
-
|
24
|
+
def facet_item_presenter(facet_item)
|
25
|
+
facet_config.item_presenter.new(facet_item, facet_config, helpers, @facet_field.key)
|
44
26
|
end
|
45
27
|
|
46
|
-
def facet_item_component_class
|
47
|
-
|
28
|
+
def facet_item_component_class
|
29
|
+
facet_config.item_component
|
48
30
|
end
|
49
31
|
|
50
32
|
def facet_config
|
@@ -1,10 +1,10 @@
|
|
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
|
-
<%= content_tag :
|
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
|
-
<%= content_tag :
|
7
|
+
<%= content_tag :span, raw(t('views.pagination.next')), class: 'disabled btn' %>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
10
10
|
|
@@ -54,8 +54,8 @@ module Blacklight
|
|
54
54
|
tag.span(label, class: "selected") +
|
55
55
|
# remove link
|
56
56
|
link_to(href, class: "remove", rel: "nofollow") do
|
57
|
-
render(Blacklight::Icons::RemoveComponent.new) +
|
58
|
-
tag.span(helpers.t(:'blacklight.search.facets.selected.remove'), class: '
|
57
|
+
render(Blacklight::Icons::RemoveComponent.new(aria_hidden: true)) +
|
58
|
+
tag.span(helpers.t(:'blacklight.search.facets.selected.remove'), class: 'visually-hidden')
|
59
59
|
end
|
60
60
|
end + render_facet_count(classes: ["selected"])
|
61
61
|
end
|
@@ -32,7 +32,7 @@ module Blacklight
|
|
32
32
|
|
33
33
|
id = "h-#{self.class.mint_id}" if @collapsing && has_items?
|
34
34
|
|
35
|
-
content_tag @wrapping_element,
|
35
|
+
content_tag @wrapping_element, class: 'treeitem' do
|
36
36
|
concat(content_tag('span', class: "d-flex flex-row align-items-center") do
|
37
37
|
concat facet_toggle_button(id) if has_items? && @collapsing
|
38
38
|
concat content_tag('span', render(facet), class: "facet-values d-flex flex-row flex-grow-1 #{'facet-leaf-node' if has_items? && @collapsing}", id: id && "#{id}_label")
|
@@ -75,7 +75,7 @@ module Blacklight
|
|
75
75
|
def toggle_icon(type)
|
76
76
|
content_tag 'span', class: type do
|
77
77
|
concat @icons[type]
|
78
|
-
concat content_tag('span', t(type, scope: 'blacklight.search.facets.pivot'), class: '
|
78
|
+
concat content_tag('span', t(type, scope: 'blacklight.search.facets.pivot'), class: 'visually-hidden')
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -19,8 +19,8 @@ module Blacklight
|
|
19
19
|
# Hack so that the default lambdas are triggered
|
20
20
|
# so that we don't have to do c.with_top_bar() in the call.
|
21
21
|
def before_render
|
22
|
-
|
23
|
-
|
22
|
+
set_slot(:top_bar, nil) unless top_bar
|
23
|
+
set_slot(:search_bar, nil) unless search_bar
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -1,27 +1,12 @@
|
|
1
1
|
<% # main container for facets/limits menu -%>
|
2
2
|
<%= content_tag :div, id: @id, class: 'facets sidenav facets-toggleable-md' do %>
|
3
3
|
<div class="facets-header">
|
4
|
-
<%= content_tag :h2, @title, class: 'facets-heading' if @title %>
|
4
|
+
<%= content_tag :h2, @title, class: 'facets-heading h4' if @title %>
|
5
5
|
|
6
|
-
<%=
|
7
|
-
class: 'btn btn-outline-secondary facet-toggle-button d-block d-lg-none',
|
8
|
-
type: 'button',
|
9
|
-
data: {
|
10
|
-
toggle: 'collapse',
|
11
|
-
target: "##{@panel_id}",
|
12
|
-
'bs-toggle': 'collapse',
|
13
|
-
'bs-target': "##{@panel_id}"
|
14
|
-
},
|
15
|
-
aria: {
|
16
|
-
controls: @panel_id,
|
17
|
-
expanded: 'false',
|
18
|
-
} do %>
|
19
|
-
<span data-show-label><%= t('blacklight.search.facets.group.open') %></span>
|
20
|
-
<span data-hide-label><%= t('blacklight.search.facets.group.close') %></span>
|
21
|
-
<% end %>
|
6
|
+
<%= collapse_toggle_button(@panel_id) %>
|
22
7
|
</div>
|
23
8
|
|
24
|
-
<div id="<%= @panel_id %>" class="facets-collapse collapse">
|
9
|
+
<div id="<%= @panel_id %>" class="facets-collapse d-lg-block collapse accordion">
|
25
10
|
<%= body %>
|
26
11
|
</div>
|
27
12
|
<% end %>
|
@@ -6,42 +6,26 @@ module Blacklight
|
|
6
6
|
class FacetGroupComponent < Blacklight::Component
|
7
7
|
renders_one :body
|
8
8
|
|
9
|
-
# @param [Blacklight::Response] response
|
10
|
-
# @param [Array<Blacklight::Configuration::FacetField>] fields facet fields to render
|
11
|
-
# @param [String] title the title of the facet group section
|
12
9
|
# @param [String] id a unique identifier for the group
|
13
|
-
|
10
|
+
# @param [String] title the title of the facet group section
|
11
|
+
def initialize(id:, title: nil)
|
14
12
|
@groupname = id
|
15
13
|
@id = id ? "facets-#{id}" : 'facets'
|
16
14
|
@title = title || I18n.t("blacklight.search.#{@id}.title")
|
17
15
|
@panel_id = id ? "facet-panel-#{id}-collapse" : 'facet-panel-collapse'
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
@response = response
|
18
|
+
def collapse_toggle_button(panel_id)
|
19
|
+
render button_component.new(panel_id: panel_id)
|
22
20
|
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
set_slot(:body, nil) { default_body } unless body?
|
22
|
+
def button_component
|
23
|
+
Blacklight::Response::FacetToggleButtonComponent
|
27
24
|
end
|
28
25
|
|
29
26
|
def render?
|
30
27
|
body.present?
|
31
28
|
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
# @deprecated
|
36
|
-
def default_body
|
37
|
-
Blacklight.deprecation.warn('Rendering the Blacklight::FacetGroupComponent without a body slot is deprecated.')
|
38
|
-
render(Blacklight::FacetComponent.with_collection(@fields, response: @response))
|
39
|
-
end
|
40
|
-
|
41
|
-
# @deprecated
|
42
|
-
def blacklight_config
|
43
|
-
helpers.blacklight_config
|
44
|
-
end
|
45
29
|
end
|
46
30
|
end
|
47
31
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= content_tag :button,
|
2
|
+
class: @classes,
|
3
|
+
type: 'button',
|
4
|
+
data: {
|
5
|
+
toggle: 'collapse',
|
6
|
+
target: "##{@panel_id}",
|
7
|
+
'bs-toggle': 'collapse',
|
8
|
+
'bs-target': "##{@panel_id}"
|
9
|
+
},
|
10
|
+
aria: {
|
11
|
+
controls: @panel_id,
|
12
|
+
expanded: 'false',
|
13
|
+
} do %>
|
14
|
+
<span data-show-label><%= t('blacklight.search.facets.group.open') %></span>
|
15
|
+
<span data-hide-label><%= t('blacklight.search.facets.group.close') %></span>
|
16
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
module Response
|
5
|
+
# Render the button that shows or collapses the facets on a narrow viewport
|
6
|
+
class FacetToggleButtonComponent < Blacklight::Component
|
7
|
+
# @param [String] panel_id
|
8
|
+
def initialize(panel_id:, classes: 'btn btn-outline-secondary facet-toggle-button d-block d-lg-none')
|
9
|
+
@panel_id = panel_id
|
10
|
+
@classes = classes
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -6,9 +6,10 @@ module Blacklight
|
|
6
6
|
class PaginationComponent < Blacklight::Component
|
7
7
|
# @param [Blacklight::Response] response
|
8
8
|
# @param [Hash] html html options for the pagination container
|
9
|
-
def initialize(response:, html: {}, **pagination_args)
|
9
|
+
def initialize(response:, html: {}, classes: 'paginate-section', **pagination_args)
|
10
10
|
@response = response
|
11
11
|
@html = html
|
12
|
+
@classes = classes
|
12
13
|
@pagination_args = pagination_args
|
13
14
|
end
|
14
15
|
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%= link_to url, title: label, aria: aria_attributes, class: "#{Array(@classes).join(' ')} view-type-#{ @key.to_s.parameterize } #{"active" if selected?}" do %>
|
2
2
|
<%= icon %>
|
3
|
-
<span class="caption"><%= label %></span>
|
3
|
+
<span class="caption visually-hidden"><%= label %></span>
|
4
4
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="view-type">
|
2
|
-
<span class="
|
2
|
+
<span class="visually-hidden"><%= t('blacklight.search.view_title') %></span>
|
3
3
|
<div class="view-type-group btn-group">
|
4
4
|
<% views.each do |view| %>
|
5
5
|
<%= view %>
|
@@ -1,12 +1,9 @@
|
|
1
|
-
<label for="
|
1
|
+
<label for="facet-suggest-<%= facet.key %>">
|
2
2
|
<%= I18n.t('blacklight.search.facets.suggest.label', field_label: presenter&.label) %>
|
3
3
|
</label>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
},
|
11
|
-
placeholder: I18n.t('blacklight.search.form.search.placeholder')
|
12
|
-
%>
|
4
|
+
<input class="facet-suggest form-control"
|
5
|
+
id="facet-suggest-<%= facet.key %>"
|
6
|
+
data-facet-field="<%= facet.key %>"
|
7
|
+
name="facet_suggest_<%= facet.key %>"
|
8
|
+
placeholder="<%= I18n.t('blacklight.search.form.search.placeholder') %>">
|
9
|
+
</input>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<span class="
|
1
|
+
<span class="visually-hidden"><%= t('blacklight.search.per_page.title') %></span>
|
2
2
|
<%= dropdown %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<search>
|
2
2
|
<% facet_group_names.each do |groupname| %>
|
3
3
|
<% fields = facet_fields_in_group(groupname) %>
|
4
|
-
<%= render group_component_class.new(id: groupname
|
4
|
+
<%= render group_component_class.new(id: groupname) do |component| %>
|
5
5
|
<% component.with_body do %>
|
6
6
|
<%= render Blacklight::FacetComponent.with_collection(fields, response: response) %>
|
7
7
|
<% end %>
|
@@ -6,7 +6,7 @@ module Blacklight
|
|
6
6
|
def initialize(blacklight_config:, response:, view_config:)
|
7
7
|
@blacklight_config = blacklight_config
|
8
8
|
@response = response
|
9
|
-
@group_component_class = view_config.facet_group_component
|
9
|
+
@group_component_class = view_config.facet_group_component
|
10
10
|
end
|
11
11
|
|
12
12
|
attr_reader :group_component_class, :response
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= form_with url: @url, local: true, method: @method, class: @classes.join(' '), scope: @prefix, role: 'search', **@form_options do |f| %>
|
3
3
|
<%= render Blacklight::HiddenSearchStateComponent.new(params: @params) %>
|
4
4
|
<% if search_fields.length > 1 %>
|
5
|
-
<%= f.label :search_field, scoped_t('search_field.label'), class: '
|
5
|
+
<%= f.label :search_field, scoped_t('search_field.label'), class: 'visually-hidden' %>
|
6
6
|
<% end %>
|
7
7
|
<% before_input_groups.each do |input_group| %>
|
8
8
|
<%= input_group %>
|
@@ -20,9 +20,9 @@
|
|
20
20
|
<%= f.hidden_field :search_field, value: search_fields.first.last %>
|
21
21
|
<% end %>
|
22
22
|
|
23
|
-
<%= f.label @query_param, scoped_t('search.label'), class: '
|
23
|
+
<%= f.label @query_param, scoped_t('search.label'), class: 'visually-hidden' %>
|
24
24
|
<% if autocomplete_path.present? %>
|
25
|
-
<auto-complete src="<%= autocomplete_path %>" for="autocomplete-popup" class="search-autocomplete-wrapper <%= rounded_border_class %>">
|
25
|
+
<auto-complete src="<%= autocomplete_path %>" for="autocomplete-popup" class="search-autocomplete-wrapper form-control <%= rounded_border_class %>">
|
26
26
|
<%= f.search_field @query_param, value: @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control #{rounded_border_class}", autofocus: @autofocus, aria: { label: scoped_t('search.label'), autocomplete: 'list', controls: 'autocomplete-popup' } %>
|
27
27
|
<ul id="autocomplete-popup" class="dropdown-menu" role="listbox" aria-label="<%= scoped_t('search.label') %>" hidden></ul>
|
28
28
|
</auto-complete>
|
@@ -11,7 +11,7 @@ module Blacklight
|
|
11
11
|
def initialize(
|
12
12
|
url:, params:,
|
13
13
|
advanced_search_url: nil,
|
14
|
-
classes: [
|
14
|
+
classes: %w[search-query-form col-md-12 col-lg-8], prefix: nil,
|
15
15
|
method: 'GET', q: nil, query_param: :q,
|
16
16
|
search_field: nil, autocomplete_path: nil,
|
17
17
|
autofocus: nil, i18n: { scope: 'blacklight.search.form' },
|
@@ -63,7 +63,7 @@ module Blacklight
|
|
63
63
|
def rounded_border_class
|
64
64
|
return 'rounded-0' if search_fields.length > 1
|
65
65
|
|
66
|
-
'rounded-
|
66
|
+
'rounded-start'
|
67
67
|
end
|
68
68
|
|
69
69
|
private
|
@@ -8,8 +8,8 @@ module Blacklight
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def call
|
11
|
-
tag.button(class: 'btn btn-primary search-btn', type: 'submit', id: @id) do
|
12
|
-
tag.span(@text, class: "
|
11
|
+
tag.button(class: 'btn btn-primary search-btn', type: 'submit', id: @id, aria: { label: @text }) do
|
12
|
+
tag.span(@text, class: "d-none d-md-inline me-sm-1 submit-search-text", aria: { hidden: true }) +
|
13
13
|
render(Blacklight::Icons::SearchComponent.new)
|
14
14
|
end
|
15
15
|
end
|