blacklight 8.8.3 → 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 +1 -9
- data/.rubocop.yml +2 -2
- data/.rubocop_todo.yml +0 -9
- 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 +18 -15
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +18 -15
- 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 +7 -26
- 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 +2 -2
- data/app/assets/stylesheets/blacklight/_pagination.scss +0 -4
- 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 -14
- 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/group_component.html.erb +1 -1
- data/app/components/blacklight/document/page_header_component.rb +1 -1
- data/app/components/blacklight/document/sidebar_component.rb +5 -5
- data/app/components/blacklight/document_component.rb +9 -13
- 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_item_component.rb +2 -2
- data/app/components/blacklight/facet_item_pivot_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 -7
- 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 +7 -3
- data/app/components/blacklight/skip_link_item_component.rb +18 -0
- 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 +0 -12
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -6
- data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -11
- 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 → blacklight-frontend}/facet_suggest.js +3 -3
- data/app/javascript/blacklight-frontend/index.js +18 -0
- data/app/javascript/{blacklight → blacklight-frontend}/modal.js +16 -2
- 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/_results_pagination.html.erb +2 -5
- data/app/views/catalog/_search_results.html.erb +4 -4
- data/app/views/catalog/_search_results_header.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 +1 -1
- 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/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 +7 -12
- 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/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/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 +2 -18
- data/spec/components/blacklight/search_bar_component_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 +21 -36
- 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/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
- 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 -54
- 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/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/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
- /data/app/javascript/{blacklight → blacklight-frontend}/search_context.js +0 -0
@@ -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
|
@@ -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
|
@@ -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,9 +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
|
-
|
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
|
@@ -2,12 +2,21 @@
|
|
2
2
|
|
3
3
|
module Blacklight
|
4
4
|
module SearchContext
|
5
|
+
# This is displayed on the show page when the user has a search session.
|
5
6
|
class ServerAppliedParamsComponent < Blacklight::Component
|
6
7
|
delegate :current_search_session, :link_back_to_catalog, to: :helpers
|
7
8
|
|
8
9
|
def render?
|
9
10
|
current_search_session
|
10
11
|
end
|
12
|
+
|
13
|
+
def start_over
|
14
|
+
render start_over_component.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def start_over_component
|
18
|
+
Blacklight::StartOverButtonComponent
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<nav id="skip-link" class="visually-hidden-focusable
|
1
|
+
<nav id="skip-link" class="visually-hidden-focusable" aria-label="<%= t('blacklight.skip_links.label') %>">
|
2
2
|
<div class="container-xl">
|
3
3
|
<%= link_to_main %>
|
4
4
|
<%= link_to_search %>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
module Blacklight
|
4
4
|
class SkipLinkComponent < Blacklight::Component
|
5
5
|
def link_to_search
|
6
|
-
|
6
|
+
render skip_link_item_component.new(text: t('blacklight.skip_links.search_field'), href: search_id)
|
7
7
|
end
|
8
8
|
|
9
9
|
def link_to_main
|
10
|
-
|
10
|
+
render skip_link_item_component.new(text: t('blacklight.skip_links.main_content'), href: '#main-container')
|
11
11
|
end
|
12
12
|
|
13
13
|
def search_id
|
@@ -16,8 +16,12 @@ module Blacklight
|
|
16
16
|
'#q'
|
17
17
|
end
|
18
18
|
|
19
|
+
delegate :blacklight_config, to: :helpers
|
20
|
+
delegate :skip_link_item_component, to: :blacklight_config
|
21
|
+
|
19
22
|
def link_classes
|
20
|
-
|
23
|
+
Blacklight.deprecation.warn("Use SkipLinkItemComponent instead")
|
24
|
+
'visually-hidden-focusable rounded-bottom py-2 px-3'
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
class SkipLinkItemComponent < Blacklight::Component
|
5
|
+
def initialize(text:, href:)
|
6
|
+
@text = text
|
7
|
+
@href = href
|
8
|
+
end
|
9
|
+
|
10
|
+
def call
|
11
|
+
link_to @text, @href, class: link_classes
|
12
|
+
end
|
13
|
+
|
14
|
+
def link_classes
|
15
|
+
'd-inline-flex py-2 px-3'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark topbar" aria-label="<%= aria_label %>">
|
2
2
|
<div class="<%= container_classes %>">
|
3
3
|
<%= logo_link %>
|
4
|
-
<button class="navbar-toggler
|
4
|
+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-bs-toggle="collapse" data-target="#user-util-collapse" data-bs-target="#user-util-collapse" aria-controls="user-util-collapse" aria-expanded="false" aria-label="Toggle navigation">
|
5
5
|
<span class="navbar-toggler-icon"></span>
|
6
6
|
</button>
|
7
7
|
|
@@ -83,10 +83,11 @@ module Blacklight::Catalog
|
|
83
83
|
@facet = blacklight_config.facet_fields[params[:id]]
|
84
84
|
raise ActionController::RoutingError, 'Not Found' unless @facet
|
85
85
|
|
86
|
-
|
86
|
+
query_fragment = params[:query_fragment] || ''
|
87
|
+
@response = if query_fragment.present?
|
87
88
|
search_service.facet_suggest_response(@facet.key, params[:query_fragment])
|
88
89
|
else
|
89
|
-
search_service.facet_field_response(@facet.key)
|
90
|
+
@response = search_service.facet_field_response(@facet.key)
|
90
91
|
end
|
91
92
|
@display_facet = @response.aggregations[@facet.field]
|
92
93
|
|
@@ -133,21 +133,9 @@ module Blacklight::SearchContext
|
|
133
133
|
|
134
134
|
# A list of query parameters that should not be persisted for a search
|
135
135
|
def nonpersisted_search_session_params
|
136
|
-
unless method(:blacklisted_search_session_params).source_location.first.end_with?('deprecation/method_wrappers.rb')
|
137
|
-
# The blacklisted_search_session_params was overridden, so call it.
|
138
|
-
Blacklight.deprecation.warn(self, "blacklisted_search_session_params was overriden in your app, " \
|
139
|
-
"but that method should be renamed to `nonpersisted_search_session_params'. " \
|
140
|
-
"The original behavior will be removed in the next major release.")
|
141
|
-
return blacklisted_search_session_params
|
142
|
-
end
|
143
136
|
[:commit, :counter, :total, :search_id, :page, :per_page]
|
144
137
|
end
|
145
138
|
|
146
|
-
def blacklisted_search_session_params
|
147
|
-
nonpersisted_search_session_params
|
148
|
-
end
|
149
|
-
Blacklight.deprecation.deprecate_methods(self, blacklisted_search_session_params: 'use nonpersisted_search_session_params instead')
|
150
|
-
|
151
139
|
# calls setup_previous_document then setup_next_document.
|
152
140
|
# used in the show action for single view pagination.
|
153
141
|
def setup_next_and_previous_documents
|
@@ -41,10 +41,4 @@ module Blacklight::BlacklightHelperBehavior
|
|
41
41
|
def self.blacklight_gem_path
|
42
42
|
@blacklight_gem_path ||= Gem.loaded_specs["blacklight"].full_gem_path
|
43
43
|
end
|
44
|
-
|
45
|
-
def partial_from_blacklight?(partial)
|
46
|
-
path = lookup_context.find_all(partial, lookup_context.prefixes + [""], true).first&.identifier
|
47
|
-
|
48
|
-
path.nil? ? false : path.starts_with?(Blacklight::BlacklightHelperBehavior.blacklight_gem_path)
|
49
|
-
end
|
50
44
|
end
|
@@ -102,16 +102,6 @@ module Blacklight::CatalogHelperBehavior
|
|
102
102
|
(blacklight_config.sort_fields.values.find { |f| f.sort == @response.sort } if @response && @response.sort.present?) || blacklight_config.sort_fields[params[:sort]] || default_sort_field
|
103
103
|
end
|
104
104
|
|
105
|
-
##
|
106
|
-
# Look up the current per page value, or the default if none if set
|
107
|
-
#
|
108
|
-
# @deprecated
|
109
|
-
# @return [Integer]
|
110
|
-
def current_per_page
|
111
|
-
(@response.rows if @response && @response.rows > 0) || params.fetch(:per_page, blacklight_config.default_per_page).to_i
|
112
|
-
end
|
113
|
-
Blacklight.deprecation.deprecate_methods(self, current_per_page: 'has moved to Blacklight::Search::PerPageComponent')
|
114
|
-
|
115
105
|
##
|
116
106
|
# Should we display the sort and per page widget?
|
117
107
|
#
|
@@ -197,7 +187,7 @@ module Blacklight::CatalogHelperBehavior
|
|
197
187
|
# Get the current "view type" (and ensure it is a valid type)
|
198
188
|
#
|
199
189
|
# @param [Hash] query_params the query parameters to check
|
200
|
-
# @return [Symbol]
|
190
|
+
# @return [Symbol] (e.g. :index, :gallery)
|
201
191
|
def document_index_view_type query_params = params || {}
|
202
192
|
view_param = query_params[:view]
|
203
193
|
view_param ||= session[:preferred_view] if respond_to?(:session)
|
@@ -91,18 +91,6 @@ module Blacklight::ConfigurationHelperBehavior
|
|
91
91
|
(active_sort_fields.find { |_k, config| config.respond_to?(:default) && config.default } || active_sort_fields.first)&.last
|
92
92
|
end
|
93
93
|
|
94
|
-
##
|
95
|
-
# @deprecated
|
96
|
-
# The available options for results per page, in the style of #options_for_select
|
97
|
-
def per_page_options_for_select
|
98
|
-
return [] if blacklight_config.per_page.blank?
|
99
|
-
|
100
|
-
blacklight_config.per_page.map do |count|
|
101
|
-
[t(:'blacklight.search.per_page.label', count: count).html_safe, count]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
Blacklight.deprecation.deprecate_methods(self, per_page_options_for_select: 'has moved to Blacklight::Search::PerPageComponent')
|
105
|
-
|
106
94
|
##
|
107
95
|
# Determine whether to render a field by evaluating :if and :unless conditions
|
108
96
|
#
|
@@ -24,32 +24,6 @@ module Blacklight::DocumentHelperBehavior
|
|
24
24
|
'blacklight-'
|
25
25
|
end
|
26
26
|
|
27
|
-
##
|
28
|
-
# Render the sidebar partial for a document
|
29
|
-
# This is used as an integration point by downstream apps to add to the
|
30
|
-
# default sidebar.
|
31
|
-
# See: https://github.com/geoblacklight/geoblacklight/blob/7d3c31c7af3362879b97e2c1351a2496c728c59c/app/helpers/blacklight_helper.rb#L7
|
32
|
-
#
|
33
|
-
# @param [SolrDocument] document
|
34
|
-
# @deprecated
|
35
|
-
# @return [String]
|
36
|
-
def render_document_sidebar_partial(document)
|
37
|
-
unless @render_document_sidebar_partials_deprecation_warning_shown
|
38
|
-
partials = lookup_context.find_all('show_sidebar', lookup_context.prefixes, true, [], {})
|
39
|
-
unless partials.first.identifier.starts_with? Blacklight.root
|
40
|
-
Blacklight.deprecation.warn('The partial catalog/_show_sidebar.html.erb will not be rendered by #render_document_sidebar_partial in Blacklight 9.0.' \
|
41
|
-
'Configure blacklight_config.show.sidebar_component instead (default Blacklight::Search::SidebarComponent).')
|
42
|
-
@render_document_sidebar_partials_deprecation_warning_shown = true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
render 'show_sidebar', document: document
|
47
|
-
end
|
48
|
-
|
49
|
-
Blacklight.deprecation.deprecate_methods(self,
|
50
|
-
render_document_sidebar_partial: 'has been replaced by calling the sidebar component (Blacklight::Search::SidebarComponent) directly. ' \
|
51
|
-
'Set sidebar_component in the view config.')
|
52
|
-
|
53
27
|
##
|
54
28
|
# return the Bookmarks on a set of documents (all bookmarks on the page)
|
55
29
|
# @private
|
@@ -4,18 +4,10 @@
|
|
4
4
|
# Module to help generate icon helpers for SVG images
|
5
5
|
module Blacklight::IconHelperBehavior
|
6
6
|
##
|
7
|
-
# Returns the raw SVG (String) for a Blacklight Icon
|
8
|
-
# app/assets/images/blacklight/*.svg. Caches them so we don't have to look up
|
9
|
-
# the svg everytime.
|
7
|
+
# Returns the raw SVG (String) for a Blacklight Icon
|
10
8
|
# @param [String, Symbol] icon_name
|
11
9
|
# @return [String]
|
12
10
|
def blacklight_icon(icon_name, **kwargs)
|
13
11
|
render "Blacklight::Icons::#{icon_name.to_s.camelize}Component".constantize.new(**kwargs)
|
14
|
-
rescue NameError
|
15
|
-
Blacklight.deprecation.warn(
|
16
|
-
"Falling back on the LegacyIconComponent with \"#{icon_name}\" is deprecated. Instead create the component `Blacklight::Icons::#{icon_name.to_s.camelize}Component` for this icon."
|
17
|
-
)
|
18
|
-
|
19
|
-
render Blacklight::Icons::LegacyIconComponent.new(name: icon_name, **kwargs)
|
20
12
|
end
|
21
13
|
end
|
@@ -55,8 +55,8 @@ module Blacklight
|
|
55
55
|
#
|
56
56
|
# @param [Hash] options
|
57
57
|
# @return [String]
|
58
|
-
def render_nav_actions(options = {}, &
|
59
|
-
render_filtered_partials(blacklight_config.navbar.partials, options, &
|
58
|
+
def render_nav_actions(options = {}, &)
|
59
|
+
render_filtered_partials(blacklight_config.navbar.partials, options, &)
|
60
60
|
end
|
61
61
|
|
62
62
|
##
|