Class: Blacklight::Hierarchy::QfacetValueComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Blacklight::Hierarchy::QfacetValueComponent
- Defined in:
- app/components/blacklight/hierarchy/qfacet_value_component.rb
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#suppress_link ⇒ Object
readonly
Returns the value of attribute suppress_link.
Instance Method Summary collapse
-
#initialize(field_name:, item:, id: nil, suppress_link: false) ⇒ QfacetValueComponent
constructor
A new instance of QfacetValueComponent.
- #path_for_facet ⇒ Object
- #render_facet_count ⇒ Object
Constructor Details
#initialize(field_name:, item:, id: nil, suppress_link: false) ⇒ QfacetValueComponent
Returns a new instance of QfacetValueComponent.
6 7 8 9 10 11 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 6 def initialize(field_name:, item:, id: nil, suppress_link: false) @field_name = field_name @item = item @id = id @suppress_link = suppress_link end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
13 14 15 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 13 def field_name @field_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 13 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
13 14 15 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 13 def item @item end |
#suppress_link ⇒ Object (readonly)
Returns the value of attribute suppress_link.
13 14 15 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 13 def suppress_link @suppress_link end |
Instance Method Details
#path_for_facet ⇒ Object
15 16 17 18 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 15 def path_for_facet facet_config = helpers.facet_configuration_for_field(field_name) Blacklight::FacetItemPresenter.new(item.qvalue, facet_config, helpers, field_name).href end |
#render_facet_count ⇒ Object
20 21 22 23 |
# File 'app/components/blacklight/hierarchy/qfacet_value_component.rb', line 20 def render_facet_count classes = "facet-count" content_tag("span", t('blacklight.search.facets.count', number: number_with_delimiter(item.hits)), class: classes) end |