Class: Blacklight::Facets::FiltersComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

reset_compiler!, sidecar_files, upstream_sidecar_files

Constructor Details

#initialize(presenter:, classes: 'facet-filters mt-1 mb-3', suggestions_component: Blacklight::Facets::SuggestComponent, index_navigation_component: Blacklight::Facets::IndexNavigationComponent) ⇒ FiltersComponent



6
7
8
9
10
11
12
13
# File 'app/components/blacklight/facets/filters_component.rb', line 6

def initialize(presenter:, classes: 'facet-filters mt-1 mb-3',
               suggestions_component: Blacklight::Facets::SuggestComponent,
               index_navigation_component: Blacklight::Facets::IndexNavigationComponent)
  @presenter = presenter
  @classes = classes
  @suggestions_component = suggestions_component
  @index_navigation_component = index_navigation_component
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



19
20
21
# File 'app/components/blacklight/facets/filters_component.rb', line 19

def classes
  @classes
end

#index_navigation_componentObject (readonly)

Returns the value of attribute index_navigation_component.



19
20
21
# File 'app/components/blacklight/facets/filters_component.rb', line 19

def index_navigation_component
  @index_navigation_component
end

#presenterObject (readonly)

Returns the value of attribute presenter.



19
20
21
# File 'app/components/blacklight/facets/filters_component.rb', line 19

def presenter
  @presenter
end

#suggestions_componentObject (readonly)

Returns the value of attribute suggestions_component.



19
20
21
# File 'app/components/blacklight/facets/filters_component.rb', line 19

def suggestions_component
  @suggestions_component
end

Instance Method Details

#facetObject



15
16
17
# File 'app/components/blacklight/facets/filters_component.rb', line 15

def facet
  @presenter.facet_field
end

#index_navigationObject



35
36
37
# File 'app/components/blacklight/facets/filters_component.rb', line 35

def index_navigation
  render index_navigation_component.new(presenter: presenter)
end

#render?Boolean



23
24
25
# File 'app/components/blacklight/facets/filters_component.rb', line 23

def render?
  presenter.suggest? || render_index_navigation?
end

#render_index_navigation?Boolean



27
28
29
# File 'app/components/blacklight/facets/filters_component.rb', line 27

def render_index_navigation?
  facet.index_range && display_facet.index?
end

#suggestionsObject



31
32
33
# File 'app/components/blacklight/facets/filters_component.rb', line 31

def suggestions
  render suggestions_component.new(presenter: presenter)
end