blacklight 9.0.0.beta4 → 9.0.0.beta6
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/VERSION +1 -1
- data/app/assets/builds/blacklight.css +26 -18
- data/app/assets/javascripts/blacklight/blacklight.esm.js +12 -4
- data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/blacklight.js +12 -4
- data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +25 -25
- data/app/components/blacklight/advanced_search_form_component.html.erb +4 -4
- data/app/components/blacklight/advanced_search_form_component.rb +2 -2
- data/app/components/blacklight/constraint_component.html.erb +1 -5
- data/app/components/blacklight/constraint_component.rb +11 -0
- data/app/components/blacklight/constraints_component.rb +5 -3
- data/app/components/blacklight/document/bookmark_component.html.erb +1 -1
- data/app/components/blacklight/document/bookmark_component.rb +9 -3
- data/app/components/blacklight/document/group_component.html.erb +1 -1
- data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
- data/app/components/blacklight/facets/checkboxes_component.html.erb +4 -4
- data/app/components/blacklight/facets/field_component.html.erb +0 -2
- data/app/components/blacklight/facets/list_component.html.erb +1 -1
- data/app/components/blacklight/facets/list_component.rb +8 -3
- data/app/components/blacklight/facets/pivot_list_component.rb +4 -1
- data/app/components/blacklight/facets/suggest_component.html.erb +1 -1
- data/app/components/blacklight/search_bar_component.html.erb +1 -1
- data/app/components/blacklight/top_navbar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +6 -1
- data/app/helpers/blacklight/catalog_helper_behavior.rb +4 -2
- data/app/helpers/blacklight/facets_helper_behavior.rb +0 -14
- data/app/javascript/blacklight-frontend/button_focus.js +1 -1
- data/app/javascript/blacklight-frontend/checkbox_submit.js +2 -2
- data/app/javascript/blacklight-frontend/modal.js +9 -1
- data/app/presenters/blacklight/facet_field_presenter.rb +9 -0
- data/app/presenters/blacklight/facet_grouped_item_presenter.rb +6 -0
- data/app/presenters/blacklight/facet_item_pivot_presenter.rb +1 -1
- data/app/presenters/blacklight/facet_item_presenter.rb +5 -0
- data/app/views/catalog/_email_form.html.erb +4 -4
- data/app/views/catalog/_sms_form.html.erb +4 -4
- data/app/views/catalog/advanced_search.html.erb +1 -1
- data/app/views/catalog/index.json.jbuilder +5 -3
- data/app/views/layouts/blacklight/base.html.erb +1 -1
- data/config/locales/blacklight.it.yml +1 -1
- data/lib/blacklight/search_state.rb +2 -0
- data/lib/blacklight.rb +1 -1
- data/lib/generators/blacklight/templates/catalog_controller.rb +3 -1
- data/package.json +1 -1
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +1 -1
- data/spec/components/blacklight/facets/list_component_spec.rb +6 -0
- data/spec/components/blacklight/facets/pivot_list_component_spec.rb +10 -0
- data/spec/features/advanced_search_spec.rb +3 -1
- data/spec/features/facets_spec.rb +5 -5
- data/spec/features/search_filters_spec.rb +3 -1
- metadata +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
.
|
1
|
+
.facets {
|
2
2
|
--bl-facet-active-bg: var(--bs-success);
|
3
3
|
--bl-facet-active-color: var(--bs-white);
|
4
4
|
--bl-facet-active-item-color: var(--bs-success);
|
@@ -151,32 +151,33 @@
|
|
151
151
|
position: relative;
|
152
152
|
}
|
153
153
|
|
154
|
-
/*
|
154
|
+
/* Pivot Facets
|
155
155
|
-------------------------------------------------- */
|
156
156
|
|
157
157
|
.pivot-facet {
|
158
|
-
|
159
|
-
|
158
|
+
--bl-facet-toggle-width: 1em;
|
159
|
+
--bl-facet-toggle-height: var(--bl-facet-toggle-width);
|
160
|
+
--bl-facet-toggle-margin: 0.5em;
|
161
|
+
--bl-facet-toggle-show-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square" viewBox="0 0 16 16"><path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" /><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z" /></svg>');
|
162
|
+
--bl-facet-toggle-hide-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-dash-square" viewBox="0 0 16 16"><path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" /><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z" /></svg>');
|
163
|
+
|
164
|
+
// If the item has no expand button, we align it with its siblings that do
|
165
|
+
// by giving it left margin equal to the sum of the button's width & margin
|
166
|
+
li.treeitem:not(:has(button.facet-toggle-handle)) {
|
167
|
+
margin-left: calc(var(--bl-facet-toggle-width) + var(--bl-facet-toggle-margin));
|
160
168
|
}
|
161
169
|
}
|
162
170
|
|
163
|
-
$facet-toggle-show-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square" viewBox="0 0 16 16"><path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" /><path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z" /></svg>') !default;
|
164
|
-
$facet-toggle-hide-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-dash-square" viewBox="0 0 16 16"><path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" /><path d="M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z" /></svg>') !default;
|
165
|
-
$facet-toggle-width: 1em !default;
|
166
|
-
$facet-toggle-height: $facet-toggle-width !default;
|
167
|
-
|
168
171
|
.facet-toggle-handle {
|
172
|
+
--bs-btn-hover-bg: var(--bs-btn-hover-bg);
|
173
|
+
--bs-btn-active-bg: var(--bs-btn-active-bg);
|
169
174
|
margin-block: 0;
|
170
175
|
padding-block: 0;
|
171
|
-
padding
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
.pivot-facet & {
|
177
|
-
// shift pivot values a little more aggressively for better compact display
|
178
|
-
margin-inline-start: -2 * $btn-padding-x;
|
179
|
-
}
|
176
|
+
padding: 0;
|
177
|
+
border: 0;
|
178
|
+
width: var(--bl-facet-toggle-width);
|
179
|
+
height: var(--bl-facet-toggle-height);
|
180
|
+
margin-right: var(--bl-facet-toggle-margin);
|
180
181
|
|
181
182
|
&.collapsed {
|
182
183
|
.show {
|
@@ -198,18 +199,17 @@ $facet-toggle-height: $facet-toggle-width !default;
|
|
198
199
|
|
199
200
|
.show .icon,
|
200
201
|
.hide .icon {
|
201
|
-
width:
|
202
|
-
height:
|
203
|
-
padding: $btn-padding-y $btn-padding-x;
|
202
|
+
width: var(--bl-facet-toggle-width);
|
203
|
+
height: var(--bl-facet-toggle-height);
|
204
204
|
}
|
205
205
|
|
206
206
|
.show .icon {
|
207
|
-
background: transparent escape-svg(
|
208
|
-
|
207
|
+
background: transparent escape-svg(var(--bl-facet-toggle-show-icon)) center /
|
208
|
+
var(--bl-facet-toggle-width) auto no-repeat;
|
209
209
|
}
|
210
210
|
|
211
211
|
.hide .icon {
|
212
|
-
background: transparent escape-svg(
|
213
|
-
|
212
|
+
background: transparent escape-svg(var(--bl-facet-toggle-hide-icon)) center /
|
213
|
+
var(--bl-facet-toggle-width) auto no-repeat;
|
214
214
|
}
|
215
215
|
}
|
@@ -27,8 +27,8 @@
|
|
27
27
|
<div class="limit-criteria mb-4">
|
28
28
|
<h2 class="limit-criteria-heading h3"><%= t('blacklight.advanced_search.form.limit_criteria_heading_html')%></h2>
|
29
29
|
|
30
|
-
<div id="advanced_search_facets" class="limit_input row">
|
31
|
-
<div class="advanced-facet-limits
|
30
|
+
<div id="advanced_search_facets" class="facets limit_input row">
|
31
|
+
<div class="advanced-facet-limits accordion col-md-9 offset-md-3">
|
32
32
|
<% search_filter_controls.each do |control| %>
|
33
33
|
<%= control %>
|
34
34
|
<% end %>
|
@@ -39,7 +39,7 @@
|
|
39
39
|
</div>
|
40
40
|
|
41
41
|
<% if sort_fields_select %>
|
42
|
-
<div class="
|
42
|
+
<div class="row mb-4">
|
43
43
|
<%= content_tag :h2, t('blacklight.advanced_search.form.sort_label'), id: 'advanced-search-sort-label', class: 'col-md-3 text-md-right' %>
|
44
44
|
<div class="col-md-9">
|
45
45
|
<%= sort_fields_select %>
|
@@ -47,7 +47,7 @@
|
|
47
47
|
</div>
|
48
48
|
<% end %>
|
49
49
|
|
50
|
-
<div class="
|
50
|
+
<div class="row">
|
51
51
|
<div class="submit-buttons col-md-9 offset-md-3">
|
52
52
|
<%= submit_tag t('blacklight.advanced_search.form.search_btn_html'), class: 'btn btn-primary advanced-search-submit', id: "advanced-search-submit" %>
|
53
53
|
<%= link_to t('blacklight.advanced_search.form.start_over_html'), request.path, :class =>"btn btn-link advanced-search-start-over" %>
|
@@ -31,7 +31,7 @@ module Blacklight
|
|
31
31
|
options = sort_fields.values.map { |field_config| [helpers.sort_field_label(field_config.key), field_config.key] }
|
32
32
|
return unless options.any?
|
33
33
|
|
34
|
-
select_tag(:sort, options_for_select(options, params[:sort]), class: "form-select
|
34
|
+
select_tag(:sort, options_for_select(options, params[:sort]), class: "form-select sort-select w-auto", aria: { labelledby: 'advanced-search-sort-label' })
|
35
35
|
end
|
36
36
|
|
37
37
|
# Filtered params to pass to hidden search fields
|
@@ -46,7 +46,7 @@ module Blacklight
|
|
46
46
|
search_fields.values.each.with_index do |field, i|
|
47
47
|
with_search_field_control do
|
48
48
|
fields_for('clause[]', i, include_id: false) do |f|
|
49
|
-
content_tag(:div, class: '
|
49
|
+
content_tag(:div, class: 'advanced-search-field row mb-3') do
|
50
50
|
f.label(:query, field.display_label('search'), class: "col-sm-3 col-form-label text-md-right") +
|
51
51
|
content_tag(:div, class: 'col-sm-9') do
|
52
52
|
f.hidden_field(:field, value: field.key) +
|
@@ -1,5 +1 @@
|
|
1
|
-
<%= render
|
2
|
-
classes: (Array(@classes) + ["filter-#{@facet_item_presenter.key.parameterize}"]).join(' '),
|
3
|
-
label: @facet_item_presenter.field_label,
|
4
|
-
value: @facet_item_presenter.constraint_label,
|
5
|
-
remove_path: @facet_item_presenter.remove_href)) %>
|
1
|
+
<%= render @layout.new(classes: classes, label: field_label, value: constraint_label, remove_path: remove_href) %>
|
@@ -4,10 +4,21 @@ module Blacklight
|
|
4
4
|
class ConstraintComponent < Blacklight::Component
|
5
5
|
with_collection_parameter :facet_item_presenter
|
6
6
|
|
7
|
+
# @param [Blacklight::FacetItemPresenter] facet_item_presenter
|
8
|
+
# @param [Array<String>] classes
|
9
|
+
# @param [Blacklight::ConstraintLayoutComponent] layout
|
7
10
|
def initialize(facet_item_presenter:, classes: %w[filter mx-1], layout: Blacklight::ConstraintLayoutComponent)
|
8
11
|
@facet_item_presenter = facet_item_presenter
|
9
12
|
@classes = classes
|
10
13
|
@layout = layout
|
11
14
|
end
|
15
|
+
|
16
|
+
attr_accessor :facet_item_presenter
|
17
|
+
|
18
|
+
delegate :field_label, :constraint_label, :remove_href, to: :facet_item_presenter
|
19
|
+
|
20
|
+
def classes
|
21
|
+
@classes + ["filter-#{facet_item_presenter.key.parameterize}"]
|
22
|
+
end
|
12
23
|
end
|
13
24
|
end
|
@@ -85,7 +85,7 @@ module Blacklight
|
|
85
85
|
if val.is_a?(Array)
|
86
86
|
yield inclusive_facet_item_presenter(facet.config, val, facet.key) if val.any?(&:present?)
|
87
87
|
else
|
88
|
-
yield facet_item_presenter(facet.config, val
|
88
|
+
yield facet_item_presenter(facet.config, val)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -100,8 +100,10 @@ module Blacklight
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
|
104
|
-
|
103
|
+
# @params [Blacklight::Configuration::FacetField] facet_config
|
104
|
+
# @params [String] facet_item the value of the facet item
|
105
|
+
def facet_item_presenter(facet_config, facet_item)
|
106
|
+
helpers.facet_field_presenter(facet_config, {}).item_presenter(facet_item)
|
105
107
|
end
|
106
108
|
|
107
109
|
def inclusive_facet_item_presenter(facet_config, facet_item, facet_field)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%- # we don't use the per-form csrf token -%>
|
2
2
|
<%= form_tag(bookmark_path,
|
3
3
|
authenticity_token: false,
|
4
|
-
method:
|
4
|
+
method: bookmarked? ? :delete : :put,
|
5
5
|
class: "bookmark-toggle",
|
6
6
|
data: {
|
7
7
|
present: t('blacklight.search.bookmarks.present'),
|
@@ -3,16 +3,22 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Document
|
5
5
|
# Render a bookmark widget to bookmark / unbookmark a document
|
6
|
-
class BookmarkComponent < Blacklight::
|
6
|
+
class BookmarkComponent < Blacklight::Component
|
7
7
|
# @param [Blacklight::Document] document
|
8
|
-
# @param [Blacklight::Configuration::ToolConfig] action
|
8
|
+
# @param [Blacklight::Configuration::ToolConfig] action - only used to pass a key for the wrapping action.
|
9
9
|
# @param [Boolean] checked
|
10
10
|
# @param [Object] bookmark_path the rails route to use for bookmarks
|
11
11
|
def initialize(document:, action: nil, checked: nil, bookmark_path: nil, **)
|
12
12
|
@document = document
|
13
13
|
@checked = checked
|
14
14
|
@bookmark_path = bookmark_path
|
15
|
-
|
15
|
+
@action = action
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
# Used by ActionsComponent
|
20
|
+
def key
|
21
|
+
@action&.key || :bookmark
|
16
22
|
end
|
17
23
|
|
18
24
|
def bookmarked?
|
@@ -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 float-
|
7
|
+
<%= helpers.link_to t('blacklight.search.group.more'), add_group_facet_params_and_redirect(@group), class: 'more-in-group float-end' %>
|
8
8
|
<%- end %>
|
9
9
|
</div>
|
@@ -38,7 +38,7 @@ module Blacklight
|
|
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")
|
39
39
|
end)
|
40
40
|
if has_items?
|
41
|
-
concat(content_tag('ul', class: "
|
41
|
+
concat(content_tag('ul', class: "list-unstyled ps-3 #{'collapse' if @collapsing} #{'show' if expanded?}", id: id, role: 'group') do
|
42
42
|
render(
|
43
43
|
self.class.with_collection(
|
44
44
|
@facet_item.facet_item_presenters.to_a
|
@@ -64,7 +64,7 @@ module Blacklight
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def facet_toggle_button(id)
|
67
|
-
content_tag 'button', class: %w[btn facet-toggle-handle] + [('collapsed' unless expanded?)],
|
67
|
+
content_tag 'button', class: %w[btn focus-ring facet-toggle-handle] + [('collapsed' unless expanded?)],
|
68
68
|
data: { toggle: 'collapse', 'bs-toggle': 'collapse', target: "##{id}", 'bs-target': "##{id}" },
|
69
69
|
aria: { expanded: expanded?, controls: id, describedby: "#{id}_label" } do
|
70
70
|
concat toggle_icon(:show)
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<ul class="facet-values list-unstyled blacklight-facet-checkboxes">
|
8
8
|
<% presenters.each_with_index do |presenter, idx| -%>
|
9
9
|
<li>
|
10
|
-
<span class="facet-checkbox">
|
10
|
+
<span class="facet-checkbox flex-shrink-0">
|
11
11
|
<%= check_box_tag "f_inclusive[#{@facet_field.key}][]", presenter.value, presenter.selected?, id: "f_inclusive_#{@facet_field.key}_#{idx}"%>
|
12
12
|
</span>
|
13
13
|
|
14
|
-
<span>
|
15
|
-
<%= label_tag "f_inclusive_#{@facet_field.key}_#{idx}" do %>
|
16
|
-
<span class="facet-label"><%= presenter.label %></span>
|
14
|
+
<span class="facet-label-and-count flex-grow-1">
|
15
|
+
<%= label_tag "f_inclusive_#{@facet_field.key}_#{idx}", class: 'd-flex' do %>
|
16
|
+
<span class="facet-label flex-grow-1"><%= presenter.label %></span>
|
17
17
|
<span class="facet-count"><%= t('blacklight.search.facets.count', number: number_with_delimiter(presenter.hits)) %></span>
|
18
18
|
<% end %>
|
19
19
|
</span>
|
@@ -3,9 +3,7 @@
|
|
3
3
|
<button
|
4
4
|
type="button"
|
5
5
|
class="btn accordion-button <%= "collapsed" if @facet_field.collapsed? %>"
|
6
|
-
data-toggle="collapse"
|
7
6
|
data-bs-toggle="collapse"
|
8
|
-
data-target="#<%= html_id %>"
|
9
7
|
data-bs-target="#<%= html_id %>"
|
10
8
|
aria-expanded="<%= @facet_field.collapsed? ? 'false' : 'true' %>"
|
11
9
|
aria-controls="<%= html_id %>"
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% end %>
|
5
5
|
<% component.with_body do %>
|
6
6
|
<%= render(Blacklight::Facets::InclusiveConstraintComponent.new(facet_field: @facet_field)) %>
|
7
|
-
<%= content_tag :ul, class:
|
7
|
+
<%= content_tag :ul, class: @classes, role: @role do %>
|
8
8
|
<%= render facet_items %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -3,13 +3,18 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Facets
|
5
5
|
class ListComponent < Blacklight::Component
|
6
|
-
|
6
|
+
# @param [Blacklight::FacetFieldPresenter] facet_field
|
7
|
+
def initialize(facet_field:,
|
8
|
+
classes: %w[facet-values list-unstyled],
|
9
|
+
role: nil,
|
10
|
+
layout: nil)
|
7
11
|
@facet_field = facet_field
|
12
|
+
@classes = classes
|
8
13
|
@role = role
|
9
14
|
@layout = layout == false ? Blacklight::Facets::NoLayoutComponent : Blacklight::Facets::FieldComponent
|
10
15
|
end
|
11
16
|
|
12
|
-
attr_accessor :layout, :role
|
17
|
+
attr_accessor :layout, :classes, :role
|
13
18
|
|
14
19
|
def facet_items(wrapping_element: :li, **item_args)
|
15
20
|
facet_item_component_class.with_collection(facet_item_presenters, wrapping_element: wrapping_element, **item_args)
|
@@ -26,7 +31,7 @@ module Blacklight
|
|
26
31
|
end
|
27
32
|
|
28
33
|
def facet_item_presenter(facet_item)
|
29
|
-
|
34
|
+
@facet_field.item_presenter(facet_item)
|
30
35
|
end
|
31
36
|
|
32
37
|
def facet_item_component_class
|
@@ -3,7 +3,10 @@
|
|
3
3
|
module Blacklight
|
4
4
|
module Facets
|
5
5
|
class PivotListComponent < Blacklight::Facets::ListComponent
|
6
|
-
def initialize(facet_field:,
|
6
|
+
def initialize(facet_field:,
|
7
|
+
classes: %w[pivot-facet facet-values list-unstyled],
|
8
|
+
role: 'tree',
|
9
|
+
layout: nil)
|
7
10
|
super
|
8
11
|
end
|
9
12
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
options_for_select(search_fields, h(@search_field)),
|
16
16
|
{},
|
17
17
|
title: scoped_t('search_field.title'),
|
18
|
-
class: "
|
18
|
+
class: "form-select search-field") %>
|
19
19
|
<% elsif search_fields.length == 1 %>
|
20
20
|
<%= f.hidden_field :search_field, value: search_fields.first.last %>
|
21
21
|
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<nav class="navbar navbar-expand-md bg-dark topbar" aria-label="<%= aria_label %>">
|
2
2
|
<div class="<%= container_classes %>">
|
3
3
|
<%= logo_link %>
|
4
|
-
<button class="navbar-toggler" type="button" data-
|
4
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="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
|
|
@@ -23,7 +23,7 @@ module Blacklight::Catalog
|
|
23
23
|
|
24
24
|
# get search results from the solr index
|
25
25
|
def index
|
26
|
-
@response =
|
26
|
+
@response = retrieve_search_results
|
27
27
|
|
28
28
|
respond_to do |format|
|
29
29
|
format.html { store_preferred_view }
|
@@ -143,6 +143,11 @@ module Blacklight::Catalog
|
|
143
143
|
|
144
144
|
private
|
145
145
|
|
146
|
+
# This method may be overridden to customize search behavior.
|
147
|
+
def retrieve_search_results
|
148
|
+
search_service.search_results
|
149
|
+
end
|
150
|
+
|
146
151
|
#
|
147
152
|
# non-routable methods ->
|
148
153
|
#
|
@@ -130,10 +130,12 @@ module Blacklight::CatalogHelperBehavior
|
|
130
130
|
# @return [String]
|
131
131
|
def render_search_to_page_title_filter(facet, values)
|
132
132
|
facet_config = facet_configuration_for_field(facet)
|
133
|
-
|
133
|
+
facet_presenter = facet_field_presenter(facet_config, {})
|
134
|
+
filter_label = facet_presenter.label
|
134
135
|
filter_value = if values.size < 3
|
135
136
|
values.map do |value|
|
136
|
-
|
137
|
+
item_presenter = facet_presenter.item_presenter(value)
|
138
|
+
label = item_presenter.label
|
137
139
|
label = strip_tags(label) if label.html_safe?
|
138
140
|
label
|
139
141
|
end.to_sentence
|
@@ -15,18 +15,4 @@ module Blacklight::FacetsHelperBehavior
|
|
15
15
|
.except(:page)
|
16
16
|
url_for opts
|
17
17
|
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def facet_value_for_facet_item item
|
22
|
-
if item.respond_to? :value
|
23
|
-
item.value
|
24
|
-
else
|
25
|
-
item
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def facet_item_presenter(facet_config, facet_item, facet_field)
|
30
|
-
facet_config.item_presenter.new(facet_item, facet_config, self, facet_field)
|
31
|
-
end
|
32
18
|
end
|
@@ -2,7 +2,7 @@ const ButtonFocus = (e) => {
|
|
2
2
|
// Button clicks should change focus. As of 10/3/19, Firefox for Mac and
|
3
3
|
// Safari both do not set focus to a button on button click.
|
4
4
|
// See https://zellwk.com/blog/inconsistent-button-behavior/ for background information
|
5
|
-
if (e.target.matches('[data-
|
5
|
+
if (e.target.matches('[data-bs-toggle="collapse"]')) {
|
6
6
|
e.target.focus()
|
7
7
|
}
|
8
8
|
}
|
@@ -44,8 +44,8 @@ export default class CheckboxSubmit {
|
|
44
44
|
counter.innerHTML = json.bookmarks.count;
|
45
45
|
});
|
46
46
|
|
47
|
-
var e = new CustomEvent('bookmark.blacklight', { detail: { checked: this.checked } });
|
48
|
-
|
47
|
+
var e = new CustomEvent('bookmark.blacklight', { detail: { checked: this.checked }, bubbles: true });
|
48
|
+
this.formTarget.dispatchEvent(e)
|
49
49
|
}).catch((error) => {
|
50
50
|
this.handleError(error)
|
51
51
|
})
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
<div data-blacklight-modal="container">
|
34
34
|
<div class="modal-header">
|
35
|
-
<button type="button" class="close" data-bl-dismiss="modal" aria-hidden="true">×</button>
|
35
|
+
<button type="button" class="btn-close" data-bl-dismiss="modal" aria-hidden="true">×</button>
|
36
36
|
<h3 class="modal-title">Request Placed</h3>
|
37
37
|
</div>
|
38
38
|
|
@@ -157,6 +157,14 @@ const Modal = (() => {
|
|
157
157
|
else if (e.target.matches(`${modal.modalSelector}`) || e.target.closest('[data-bl-dismiss="modal"]'))
|
158
158
|
modal.hide()
|
159
159
|
})
|
160
|
+
|
161
|
+
// Make sure user-agent dismissal of html 'dialog', etc `esc` key, triggers
|
162
|
+
// our hide logic, including events and scroll restoration.
|
163
|
+
modal.target().addEventListener('cancel', (e) => {
|
164
|
+
e.preventDefault(); // 'hide' will close the modal unless cancelled
|
165
|
+
|
166
|
+
modal.hide();
|
167
|
+
});
|
160
168
|
};
|
161
169
|
|
162
170
|
modal.hide = function (el) {
|
@@ -7,6 +7,10 @@ module Blacklight
|
|
7
7
|
delegate :key, :suggest, to: :facet_field
|
8
8
|
delegate :field_name, to: :display_facet
|
9
9
|
|
10
|
+
# @param [Blacklight::Configuration::FacetField] facet_field
|
11
|
+
# @param [Blacklight::Solr::Response::Facets::FacetField] display_facet
|
12
|
+
# @param [#search_action_path,#facet_field_presenter] view_context
|
13
|
+
# @param [Blacklight::SearchState] search_state
|
10
14
|
def initialize(facet_field, display_facet, view_context, search_state = view_context.search_state)
|
11
15
|
@facet_field = facet_field
|
12
16
|
@display_facet = display_facet
|
@@ -14,6 +18,11 @@ module Blacklight
|
|
14
18
|
@search_state = search_state
|
15
19
|
end
|
16
20
|
|
21
|
+
# @param [Blacklight::Solr::Response::Facets::FacetItem, String] facet_item
|
22
|
+
def item_presenter(facet_item)
|
23
|
+
facet_field.item_presenter.new(facet_item, facet_field, view_context, key, search_state)
|
24
|
+
end
|
25
|
+
|
17
26
|
def collapsed?
|
18
27
|
!active? && facet_field.collapse
|
19
28
|
end
|
@@ -6,6 +6,12 @@ module Blacklight
|
|
6
6
|
|
7
7
|
delegate :key, to: :facet_config
|
8
8
|
|
9
|
+
# @param [Array<String>] group
|
10
|
+
# @param [String] facet_item
|
11
|
+
# @param [Blacklight::Configuration::FacetField] facet_config
|
12
|
+
# @param [#search_action_path] view_context
|
13
|
+
# @param [String] facet_field
|
14
|
+
# @param [Blacklight::SearchState] search_state
|
9
15
|
def initialize(group, facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
|
10
16
|
super(facet_item, facet_config, view_context, facet_field, search_state)
|
11
17
|
@group = group
|
@@ -6,6 +6,11 @@ module Blacklight
|
|
6
6
|
|
7
7
|
delegate :key, to: :facet_config
|
8
8
|
|
9
|
+
# @param [Blacklight::Solr::Response::Facets::FacetItem, String] facet_item
|
10
|
+
# @param [Blacklight::Configuration::FacetField] facet_config
|
11
|
+
# @param [#search_action_path,#facet_field_presenter] view_context
|
12
|
+
# @param [String] facet_field the name of the facet field. Same as facet_config.key
|
13
|
+
# @param [Blacklight::SearchState] search_state
|
9
14
|
def initialize(facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
|
10
15
|
@facet_item = facet_item
|
11
16
|
@facet_config = facet_config
|
@@ -6,8 +6,8 @@
|
|
6
6
|
|
7
7
|
<div class="modal-body">
|
8
8
|
<%= render '/shared/flash_msg' %>
|
9
|
-
<div class="
|
10
|
-
<label class="
|
9
|
+
<div class="row">
|
10
|
+
<label class="col-form-label col-sm-2" for="to">
|
11
11
|
<%= t('blacklight.email.form.to') %>
|
12
12
|
</label>
|
13
13
|
<div class="col-sm-10">
|
@@ -15,8 +15,8 @@
|
|
15
15
|
</div>
|
16
16
|
</div>
|
17
17
|
|
18
|
-
<div class="
|
19
|
-
<label class="
|
18
|
+
<div class="row">
|
19
|
+
<label class="col-form-label col-sm-2" for="message">
|
20
20
|
<%= t('blacklight.email.form.message') %>
|
21
21
|
</label>
|
22
22
|
<div class="col-sm-10">
|
@@ -5,16 +5,16 @@
|
|
5
5
|
method: :post do %>
|
6
6
|
<div class="modal-body">
|
7
7
|
<%= render '/shared/flash_msg' %>
|
8
|
-
<div class="
|
9
|
-
<label class="
|
8
|
+
<div class="row">
|
9
|
+
<label class="col-form-label col-sm-2" for="to">
|
10
10
|
<%= t('blacklight.sms.form.to') %>
|
11
11
|
</label>
|
12
12
|
<div class="col-sm-10">
|
13
13
|
<%= telephone_field_tag :to, params[:to], class: 'form-control', required: true %>
|
14
14
|
</div>
|
15
15
|
</div>
|
16
|
-
<div class="
|
17
|
-
<label class="
|
16
|
+
<div class="row">
|
17
|
+
<label class="col-form-label col-sm-2" for="carrier">
|
18
18
|
<%= t('blacklight.sms.form.carrier') %>
|
19
19
|
</label>
|
20
20
|
<div class="col-sm-10">
|
@@ -42,9 +42,11 @@ json.included do
|
|
42
42
|
json.id facet.name
|
43
43
|
json.attributes do
|
44
44
|
facet_config = facet_configuration_for_field(facet.name)
|
45
|
-
|
45
|
+
facet_presenter = facet_field_presenter(facet_config, facet)
|
46
|
+
json.label facet_presenter.label
|
46
47
|
json.items do
|
47
48
|
json.array! facet.items do |item|
|
49
|
+
item_presenter = facet_presenter.item_presenter(item)
|
48
50
|
json.id
|
49
51
|
json.attributes do
|
50
52
|
json.label item.label
|
@@ -52,10 +54,10 @@ json.included do
|
|
52
54
|
json.hits item.hits
|
53
55
|
end
|
54
56
|
json.links do
|
55
|
-
if search_state.filter(facet_config).include?(
|
57
|
+
if search_state.filter(facet_config).include?(item.value)
|
56
58
|
json.remove search_action_path(search_state.filter(facet.name).remove(item.value))
|
57
59
|
else
|
58
|
-
json.self
|
60
|
+
json.self item_presenter.href(only_path: false)
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<main id="main-container" class="<%= container_classes %>" aria-label="<%= t('blacklight.main.aria.main_container') %>">
|
33
33
|
<%= content_for(:container_header) %>
|
34
34
|
|
35
|
-
<%= render
|
35
|
+
<%= render 'shared/flash_msg', layout: 'shared/flash_messages' if flash.any? %>
|
36
36
|
|
37
37
|
<div class="row">
|
38
38
|
<%= content_for?(:content) ? yield(:content) : yield %>
|
@@ -82,6 +82,8 @@ module Blacklight
|
|
82
82
|
blacklight_config.facet_fields.each_value.map { |value| filter(value) }
|
83
83
|
end
|
84
84
|
|
85
|
+
# Return the list of filters (i.e. facets) that have been applied in the current search
|
86
|
+
# @return [Array<FilterField>]
|
85
87
|
def filters
|
86
88
|
@filters ||= filter_fields.select(&:any?)
|
87
89
|
end
|