blacklight 7.14.0 → 7.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_header.scss +0 -5
- data/app/assets/stylesheets/blacklight/_icons.scss +5 -1
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +5 -1
- data/app/components/blacklight/advanced_search_form_component.html.erb +46 -0
- data/app/components/blacklight/advanced_search_form_component.rb +75 -0
- data/app/components/blacklight/constraint_component.html.erb +1 -1
- data/app/components/blacklight/constraint_layout_component.html.erb +1 -1
- data/app/components/blacklight/constraints_component.rb +36 -17
- data/app/components/blacklight/document/action_component.html.erb +1 -1
- data/app/components/blacklight/document/action_component.rb +2 -1
- data/app/components/blacklight/document/actions_component.html.erb +1 -1
- data/app/components/blacklight/document/actions_component.rb +2 -1
- data/app/components/blacklight/document/thumbnail_component.html.erb +1 -1
- data/app/components/blacklight/document/thumbnail_component.rb +4 -1
- data/app/components/blacklight/document_component.rb +7 -2
- data/app/components/blacklight/document_metadata_component.rb +1 -1
- data/app/components/blacklight/facet_field_checkboxes_component.html.erb +23 -0
- data/app/components/blacklight/facet_field_checkboxes_component.rb +24 -0
- data/app/components/blacklight/facet_field_inclusive_constraint_component.html.erb +6 -0
- data/app/components/blacklight/facet_field_inclusive_constraint_component.rb +29 -0
- data/app/components/blacklight/facet_field_list_component.html.erb +1 -0
- data/app/components/blacklight/facet_field_pagination_component.rb +1 -1
- data/app/components/blacklight/facet_item_component.rb +4 -2
- data/app/components/blacklight/search_bar_component.html.erb +4 -0
- data/app/components/blacklight/search_bar_component.rb +9 -3
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +7 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +3 -4
- data/app/helpers/blacklight/component_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/configuration_helper_behavior.rb +4 -4
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
- data/app/models/concerns/blacklight/suggest/response.rb +1 -1
- data/app/presenters/blacklight/clause_presenter.rb +37 -0
- data/app/presenters/blacklight/document_presenter.rb +13 -5
- data/app/presenters/blacklight/facet_field_presenter.rb +4 -0
- data/app/presenters/blacklight/facet_grouped_item_presenter.rb +45 -0
- data/app/presenters/blacklight/facet_item_presenter.rb +32 -20
- data/app/presenters/blacklight/field_presenter.rb +1 -1
- data/app/presenters/blacklight/inclusive_facet_item_presenter.rb +16 -0
- data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
- data/app/presenters/blacklight/search_bar_presenter.rb +4 -0
- data/app/services/blacklight/search_service.rb +1 -1
- data/app/views/bookmarks/_tools.html.erb +1 -1
- data/app/views/catalog/_advanced_search_form.html.erb +7 -0
- data/app/views/catalog/_advanced_search_help.html.erb +24 -0
- data/app/views/catalog/_search_form.html.erb +1 -0
- data/app/views/catalog/_show_main_content.html.erb +2 -2
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/advanced_search.html.erb +17 -0
- data/blacklight.gemspec +1 -1
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/blacklight.en.yml +17 -0
- data/lib/blacklight/configuration.rb +52 -6
- data/lib/blacklight/configuration/field.rb +1 -1
- data/lib/blacklight/configuration/sort_field.rb +1 -1
- data/lib/blacklight/configuration/view_config.rb +16 -5
- data/lib/blacklight/open_struct_with_hash_access.rb +22 -1
- data/lib/blacklight/routes/searchable.rb +1 -0
- data/lib/blacklight/search_builder.rb +2 -0
- data/lib/blacklight/search_state.rb +7 -3
- data/lib/blacklight/search_state/filter_field.rb +17 -7
- data/lib/blacklight/solr/repository.rb +11 -2
- data/lib/blacklight/solr/search_builder_behavior.rb +98 -24
- data/spec/components/blacklight/advanced_search_form_component_spec.rb +51 -0
- data/spec/components/blacklight/document_component_spec.rb +15 -0
- data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +55 -0
- data/spec/components/blacklight/facet_field_list_component_spec.rb +39 -4
- data/spec/controllers/catalog_controller_spec.rb +9 -0
- data/spec/features/advanced_search_spec.rb +67 -0
- data/spec/features/bookmarks_spec.rb +1 -9
- data/spec/lib/blacklight/configuration/view_config_spec.rb +1 -1
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +20 -0
- data/spec/lib/blacklight/search_state/filter_field_spec.rb +65 -0
- data/spec/models/blacklight/configuration_spec.rb +64 -0
- data/spec/models/blacklight/solr/repository_spec.rb +12 -0
- data/spec/models/blacklight/solr/search_builder_spec.rb +60 -0
- data/spec/presenters/blacklight/clause_presenter_spec.rb +34 -0
- data/spec/presenters/blacklight/document_presenter_spec.rb +13 -0
- data/spec/presenters/blacklight/facet_grouped_item_presenter_spec.rb +41 -0
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
- metadata +29 -7
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
class FacetFieldInclusiveConstraintComponent < ::ViewComponent::Base
|
5
|
+
with_collection_parameter :facet_field
|
6
|
+
|
7
|
+
def initialize(facet_field:, values: nil)
|
8
|
+
@facet_field = facet_field
|
9
|
+
@values = values
|
10
|
+
end
|
11
|
+
|
12
|
+
def values
|
13
|
+
@values ||= @facet_field.values.find { |v| v.is_a? Array }
|
14
|
+
@values || []
|
15
|
+
end
|
16
|
+
|
17
|
+
def render?
|
18
|
+
values.present?
|
19
|
+
end
|
20
|
+
|
21
|
+
def presenters
|
22
|
+
return to_enum(:presenters) unless block_given?
|
23
|
+
|
24
|
+
values.each do |item|
|
25
|
+
yield Blacklight::FacetGroupedItemPresenter.new(values, item, @facet_field.facet_field, @view_context, @facet_field.key, @facet_field.search_state)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<%= @facet_field.label %>
|
4
4
|
<% end %>
|
5
5
|
<% component.with(:body) do %>
|
6
|
+
<%= @view_context.render(Blacklight::FacetFieldInclusiveConstraintComponent.new(facet_field: @facet_field)) %>
|
6
7
|
<ul class="facet-values list-unstyled">
|
7
8
|
<%= render_facet_limit_list @facet_field.paginator, @facet_field.key %>
|
8
9
|
</ul>
|
@@ -86,8 +86,8 @@ module Blacklight
|
|
86
86
|
tag.span(@label, class: "selected") +
|
87
87
|
# remove link
|
88
88
|
link_to(@href, class: "remove") do
|
89
|
-
tag.span('✖', class: "remove-icon") +
|
90
|
-
tag.span('
|
89
|
+
tag.span('✖', class: "remove-icon", aria: { hidden: true }) +
|
90
|
+
tag.span(@view_context.t(:'blacklight.search.facets.selected.remove'), class: 'sr-only')
|
91
91
|
end
|
92
92
|
end + render_facet_count(classes: ["selected"])
|
93
93
|
end
|
@@ -103,6 +103,8 @@ module Blacklight
|
|
103
103
|
def render_facet_count(options = {})
|
104
104
|
return @view_context.render_facet_count(@hits, options) unless @view_context.method(:render_facet_count).owner == Blacklight::FacetsHelperBehavior || explicit_component_configuration?
|
105
105
|
|
106
|
+
return '' if @hits.blank?
|
107
|
+
|
106
108
|
classes = (options[:classes] || []) << "facet-count"
|
107
109
|
tag.span(t('blacklight.search.facets.count', number: number_with_delimiter(@hits)), class: classes)
|
108
110
|
end
|
@@ -6,12 +6,14 @@ module Blacklight
|
|
6
6
|
|
7
7
|
# rubocop:disable Metrics/ParameterLists
|
8
8
|
def initialize(
|
9
|
-
url:,
|
10
|
-
|
9
|
+
url:, advanced_search_url: nil, params:,
|
10
|
+
classes: ['search-query-form'], presenter: nil, prefix: '',
|
11
|
+
method: 'GET', q: nil, query_param: :q,
|
11
12
|
search_field: nil, search_fields: [], autocomplete_path: nil,
|
12
13
|
autofocus: nil, i18n: { scope: 'blacklight.search.form' }
|
13
14
|
)
|
14
15
|
@url = url
|
16
|
+
@advanced_search_url = advanced_search_url
|
15
17
|
@q = q || params[:q]
|
16
18
|
@query_param = query_param
|
17
19
|
@search_field = search_field || params[:search_field]
|
@@ -44,7 +46,11 @@ module Blacklight
|
|
44
46
|
private
|
45
47
|
|
46
48
|
def presenter
|
47
|
-
@presenter ||=
|
49
|
+
@presenter ||= presenter_class.new(controller, blacklight_config)
|
50
|
+
end
|
51
|
+
|
52
|
+
def presenter_class
|
53
|
+
blacklight_config.view_config(action_name: :index).search_bar_presenter_class
|
48
54
|
end
|
49
55
|
|
50
56
|
def blacklight_config
|
@@ -25,7 +25,7 @@ module Blacklight::Bookmarks
|
|
25
25
|
def action_documents
|
26
26
|
bookmarks = token_or_current_or_guest_user.bookmarks
|
27
27
|
bookmark_ids = bookmarks.collect { |b| b.document_id.to_s }
|
28
|
-
search_service.fetch(bookmark_ids)
|
28
|
+
search_service.fetch(bookmark_ids, rows: bookmark_ids.count)
|
29
29
|
end
|
30
30
|
|
31
31
|
def action_success_redirect_path
|
@@ -56,6 +56,12 @@ module Blacklight::Catalog
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def advanced_search
|
60
|
+
empty_service = search_service_class.new(config: blacklight_config, user_params: {}, **search_service_context)
|
61
|
+
|
62
|
+
(@response, _deprecated_document_list) = empty_service.search_results
|
63
|
+
end
|
64
|
+
|
59
65
|
# get a single document from the index
|
60
66
|
def raw
|
61
67
|
raise(ActionController::RoutingError, 'Not Found') unless blacklight_config.raw_endpoint.enabled
|
@@ -192,7 +198,7 @@ module Blacklight::Catalog
|
|
192
198
|
# @example
|
193
199
|
# config.index.respond_to.txt = Proc.new { render plain: "A list of docs." }
|
194
200
|
def additional_response_formats(format)
|
195
|
-
blacklight_config.index.respond_to.each do |key, config|
|
201
|
+
blacklight_config.view_config(action_name: :index).respond_to.each do |key, config|
|
196
202
|
format.send key do
|
197
203
|
case config
|
198
204
|
when false
|
@@ -380,7 +380,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
380
380
|
def show_presenter_class(_document)
|
381
381
|
Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#show_presenter_class is deprecated; use #document_presenter_class instead')
|
382
382
|
|
383
|
-
blacklight_config.show.document_presenter_class
|
383
|
+
blacklight_config.view_config(:show, action_name: action_name).document_presenter_class
|
384
384
|
end
|
385
385
|
|
386
386
|
# @deprecated
|
@@ -388,13 +388,12 @@ module Blacklight::BlacklightHelperBehavior
|
|
388
388
|
def index_presenter_class(_document)
|
389
389
|
Deprecation.warn(Blacklight::BlacklightHelperBehavior, '#index_presenter_class is deprecated; use #document_presenter_class instead')
|
390
390
|
|
391
|
-
|
392
|
-
blacklight_config.index.document_presenter_class
|
391
|
+
blacklight_config.view_config(document_index_view_type, action_name: action_name).document_presenter_class
|
393
392
|
end
|
394
393
|
|
395
394
|
# @return [Class]
|
396
395
|
def search_bar_presenter_class
|
397
|
-
blacklight_config.index.search_bar_presenter_class
|
396
|
+
blacklight_config.view_config(action_name: :index).search_bar_presenter_class
|
398
397
|
end
|
399
398
|
|
400
399
|
# @!group Layout helpers
|
@@ -94,11 +94,11 @@ module Blacklight
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def show_doc_actions?(document = @document, options = {})
|
97
|
-
filter_partials(blacklight_config.show.document_actions, { document: document }.merge(options)).any?
|
97
|
+
filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge(options)).any?
|
98
98
|
end
|
99
99
|
|
100
100
|
def document_actions(document, options: {})
|
101
|
-
filter_partials(blacklight_config.show.document_actions, { document: document }.merge(options)).map { |_k, v| v }
|
101
|
+
filter_partials(blacklight_config.view_config(:show).document_actions, { document: document }.merge(options)).map { |_k, v| v }
|
102
102
|
end
|
103
103
|
|
104
104
|
private
|
@@ -101,9 +101,9 @@ module Blacklight::ConfigurationHelperBehavior
|
|
101
101
|
|
102
102
|
# Return the label for a search view
|
103
103
|
# @return [String]
|
104
|
-
def view_label
|
104
|
+
def view_label(view)
|
105
105
|
view_config = blacklight_config.view[view]
|
106
|
-
view_config.display_label
|
106
|
+
view_config.display_label
|
107
107
|
end
|
108
108
|
deprecation_deprecate view_label: 'Moving to ViewConfig#display_label and Blacklight::Response::ViewTypeComponent'
|
109
109
|
|
@@ -189,7 +189,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
189
189
|
|
190
190
|
field = fields.first if document.nil?
|
191
191
|
field ||= fields.find { |f| document.has? f }
|
192
|
-
field &&= field
|
192
|
+
field &&= field&.to_sym
|
193
193
|
|
194
194
|
field
|
195
195
|
end
|
@@ -198,7 +198,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
198
198
|
##
|
199
199
|
# Default sort field
|
200
200
|
def default_sort_field
|
201
|
-
(active_sort_fields.find { |_k, config| config.respond_to?(:default) && config.default } || active_sort_fields.first)
|
201
|
+
(active_sort_fields.find { |_k, config| config.respond_to?(:default) && config.default } || active_sort_fields.first)&.last
|
202
202
|
end
|
203
203
|
|
204
204
|
##
|
@@ -180,7 +180,7 @@ module Blacklight::FacetsHelperBehavior
|
|
180
180
|
# @return [String]
|
181
181
|
def facet_partial_name(display_facet = nil)
|
182
182
|
config = facet_configuration_for_field(display_facet.name)
|
183
|
-
name = config.
|
183
|
+
name = config.partial
|
184
184
|
name ||= "facet_pivot" if config.pivot
|
185
185
|
name || "facet_limit"
|
186
186
|
end
|
@@ -88,8 +88,8 @@ module Blacklight::RenderConstraintsHelperBehavior
|
|
88
88
|
return "".html_safe if search_state.filter_params.blank?
|
89
89
|
|
90
90
|
Deprecation.silence(Blacklight::RenderConstraintsHelperBehavior) do
|
91
|
-
safe_join(search_state.
|
92
|
-
render_filter_element(
|
91
|
+
safe_join(search_state.filters.map do |field|
|
92
|
+
render_filter_element(field.key, field.values, search_state)
|
93
93
|
end, "\n")
|
94
94
|
end
|
95
95
|
end
|
@@ -22,7 +22,7 @@ module Blacklight
|
|
22
22
|
# present
|
23
23
|
# @return [Array]
|
24
24
|
def suggestions
|
25
|
-
(response.
|
25
|
+
(response.dig(suggest_path, suggester_name, request_params[:q], 'suggestions') || []).uniq
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
class ClausePresenter
|
5
|
+
attr_reader :key, :user_parameters, :field_config, :view_context, :search_state
|
6
|
+
|
7
|
+
def initialize(key, user_parameters, field_config, view_context, search_state = view_context.search_state)
|
8
|
+
@key = key
|
9
|
+
@user_parameters = user_parameters
|
10
|
+
@field_config = field_config
|
11
|
+
@view_context = view_context
|
12
|
+
@search_state = search_state
|
13
|
+
end
|
14
|
+
|
15
|
+
def field_label
|
16
|
+
field_config.display_label('search')
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Get the displayable version of a facet's value
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
def label
|
24
|
+
user_parameters[:query]
|
25
|
+
end
|
26
|
+
|
27
|
+
def remove_href(path = search_state)
|
28
|
+
view_context.search_action_path(path.reset_search(clause: path.clause_params.except(key)))
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def facet_field_presenter
|
34
|
+
@facet_field_presenter ||= view_context.facet_field_presenter(facet_config, {})
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -72,9 +72,9 @@ module Blacklight
|
|
72
72
|
fields += Array.wrap(view_config[:"#{base_name}_display_type_field"]) if base_name && view_config.key?(:"#{base_name}_display_type_field")
|
73
73
|
fields += Array.wrap(view_config.display_type_field)
|
74
74
|
|
75
|
-
if fields.empty?
|
76
|
-
fields += Array.wrap(
|
77
|
-
fields += Array.wrap(
|
75
|
+
if fields.empty? && show_view_config != view_config
|
76
|
+
fields += Array.wrap(show_view_config[:"#{base_name}_display_type_field"]) if base_name && show_view_config.key?(:"#{base_name}_display_type_field")
|
77
|
+
fields += Array.wrap(show_view_config.display_type_field)
|
78
78
|
end
|
79
79
|
|
80
80
|
fields += ['format'] if fields.empty? # backwards compatibility with the old default value for display_type_field
|
@@ -97,8 +97,12 @@ module Blacklight
|
|
97
97
|
field_presenter(field_config, options).render
|
98
98
|
end
|
99
99
|
|
100
|
+
def thumbnail_presenter_class
|
101
|
+
view_config.thumbnail_presenter || thumbnail_presenter
|
102
|
+
end
|
103
|
+
|
100
104
|
def thumbnail
|
101
|
-
@thumbnail ||=
|
105
|
+
@thumbnail ||= thumbnail_presenter_class.new(document, view_context, view_config)
|
102
106
|
end
|
103
107
|
|
104
108
|
##
|
@@ -114,7 +118,11 @@ module Blacklight
|
|
114
118
|
end
|
115
119
|
|
116
120
|
def view_config
|
117
|
-
@view_config ||=
|
121
|
+
@view_config ||= show_view_config
|
122
|
+
end
|
123
|
+
|
124
|
+
def show_view_config
|
125
|
+
configuration.view_config(:show)
|
118
126
|
end
|
119
127
|
|
120
128
|
private
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
class FacetGroupedItemPresenter < Blacklight::FacetItemPresenter
|
5
|
+
attr_reader :group
|
6
|
+
|
7
|
+
delegate :key, to: :facet_config
|
8
|
+
|
9
|
+
def initialize(group, facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
|
10
|
+
@group = group
|
11
|
+
@facet_item = facet_item
|
12
|
+
@facet_config = facet_config
|
13
|
+
@view_context = view_context
|
14
|
+
@facet_field = facet_field
|
15
|
+
@search_state = search_state
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Check if the query parameters have the given facet field with the
|
20
|
+
# given value.
|
21
|
+
def selected?
|
22
|
+
group.include?(facet_item)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @private
|
26
|
+
def remove_href(path = search_state)
|
27
|
+
new_state = path.filter(facet_config).remove(group)
|
28
|
+
new_state = new_state.filter(facet_config).add(group - [facet_item])
|
29
|
+
|
30
|
+
view_context.search_action_path(new_state)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @private
|
34
|
+
def add_href(_path_options = {})
|
35
|
+
if facet_config.url_method
|
36
|
+
return view_context.public_send(facet_config.url_method, facet_config.key, facet_item)
|
37
|
+
end
|
38
|
+
|
39
|
+
new_state = search_state.filter(facet_config).remove(@group)
|
40
|
+
new_state = new_state.filter(facet_config).add(@group + [facet_item])
|
41
|
+
|
42
|
+
view_context.search_action_path(new_state)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -4,7 +4,7 @@ module Blacklight
|
|
4
4
|
class FacetItemPresenter
|
5
5
|
attr_reader :facet_item, :facet_config, :view_context, :search_state, :facet_field
|
6
6
|
|
7
|
-
delegate :
|
7
|
+
delegate :key, to: :facet_config
|
8
8
|
|
9
9
|
def initialize(facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
|
10
10
|
@facet_item = facet_item
|
@@ -14,12 +14,24 @@ module Blacklight
|
|
14
14
|
@search_state = search_state
|
15
15
|
end
|
16
16
|
|
17
|
+
def hits
|
18
|
+
return unless @facet_item.respond_to? :hits
|
19
|
+
|
20
|
+
@facet_item.hits
|
21
|
+
end
|
22
|
+
|
23
|
+
def items
|
24
|
+
return unless @facet_item.respond_to? :items
|
25
|
+
|
26
|
+
@facet_item.items
|
27
|
+
end
|
28
|
+
|
17
29
|
##
|
18
30
|
# Check if the query parameters have the given facet field with the
|
19
31
|
# given value.
|
20
32
|
def selected?
|
21
33
|
Deprecation.silence(Blacklight::SearchState) do
|
22
|
-
search_state.has_facet? facet_config, value:
|
34
|
+
search_state.has_facet? facet_config, value: value
|
23
35
|
end
|
24
36
|
end
|
25
37
|
|
@@ -34,21 +46,29 @@ module Blacklight
|
|
34
46
|
def label
|
35
47
|
return @view_context.facet_display_value(@facet_field, @facet_item) unless @view_context.method(:facet_display_value).owner == Blacklight::FacetsHelperBehavior
|
36
48
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
49
|
+
label_value = if facet_item.respond_to? :label
|
50
|
+
facet_item.label
|
51
|
+
else
|
52
|
+
value
|
53
|
+
end
|
42
54
|
|
43
55
|
if facet_config.helper_method
|
44
|
-
view_context.public_send(facet_config.helper_method,
|
45
|
-
elsif facet_config.query && facet_config.query[
|
46
|
-
facet_config.query[
|
56
|
+
view_context.public_send(facet_config.helper_method, label_value)
|
57
|
+
elsif facet_config.query && facet_config.query[label_value]
|
58
|
+
facet_config.query[label_value][:label]
|
47
59
|
elsif facet_config.date
|
48
60
|
localization_options = facet_config.date == true ? {} : facet_config.date
|
49
|
-
I18n.l(Time.zone.parse(
|
61
|
+
I18n.l(Time.zone.parse(label_value), **localization_options)
|
62
|
+
else
|
63
|
+
label_value
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def value
|
68
|
+
if facet_item.respond_to? :value
|
69
|
+
facet_item.value
|
50
70
|
else
|
51
|
-
|
71
|
+
facet_item
|
52
72
|
end
|
53
73
|
end
|
54
74
|
|
@@ -78,14 +98,6 @@ module Blacklight
|
|
78
98
|
|
79
99
|
private
|
80
100
|
|
81
|
-
def facet_value
|
82
|
-
if facet_item.respond_to? :value
|
83
|
-
facet_item.value
|
84
|
-
else
|
85
|
-
facet_item
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
101
|
def facet_field_presenter
|
90
102
|
@facet_field_presenter ||= view_context.facet_field_presenter(facet_config, {})
|
91
103
|
end
|