Class: Blacklight::FacetFieldFilterComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/facet_field_filter_component.rb

Constant Summary

Constants inherited from Component

Component::EXCLUDE_VARIABLES

Instance Method Summary collapse

Methods inherited from Component

compiler, config, #inspect

Constructor Details

#initialize(facet_field:) ⇒ FacetFieldFilterComponent

Returns a new instance of FacetFieldFilterComponent.



5
6
7
# File 'app/components/blacklight/facet_field_filter_component.rb', line 5

def initialize(facet_field:)
  @facet_field = facet_field
end

Instance Method Details

#clear_facet_prefix_urlObject



17
18
19
# File 'app/components/blacklight/facet_field_filter_component.rb', line 17

def clear_facet_prefix_url
  @facet_field.paginator.params_for_resort_url('index', @facet_field.search_state.to_h.except(@facet_field.paginator.request_keys[:prefix]))
end

#facet_prefix_url(letter) ⇒ Object



21
22
23
# File 'app/components/blacklight/facet_field_filter_component.rb', line 21

def facet_prefix_url(letter)
  @facet_field.paginator.params_for_resort_url('index', @facet_field.search_state.to_h.merge(@facet_field.paginator.request_keys[:prefix] => letter))
end

#prefixObject



13
14
15
# File 'app/components/blacklight/facet_field_filter_component.rb', line 13

def prefix
  @facet_field.paginator.prefix
end

#render?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/components/blacklight/facet_field_filter_component.rb', line 9

def render?
  @facet_field.facet_field.index_range.any?
end