Class: Blacklight::Hierarchy::SelectedQfacetValueComponent
- Inherits:
-
QfacetValueComponent
- Object
- ViewComponent::Base
- QfacetValueComponent
- Blacklight::Hierarchy::SelectedQfacetValueComponent
- Defined in:
- app/components/blacklight/hierarchy/selected_qfacet_value_component.rb
Overview
Standard display of a SELECTED facet value, no link, special span with class, and ‘remove’ button. This is similar to Blacklight::Facet::SelectedValueComponent
Instance Attribute Summary collapse
-
#field_name ⇒ Object
readonly
Returns the value of attribute field_name.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
Attributes inherited from QfacetValueComponent
Instance Method Summary collapse
-
#initialize(field_name:, item:) ⇒ SelectedQfacetValueComponent
constructor
A new instance of SelectedQfacetValueComponent.
- #remove_href ⇒ Object
- #remove_link ⇒ Object
Methods inherited from QfacetValueComponent
#facet_config, #facet_item_presenter_class, #field_name_prefix, #hierarchy_config, #label_value, #path_for_facet, #render_facet_count
Constructor Details
#initialize(field_name:, item:) ⇒ SelectedQfacetValueComponent
Returns a new instance of SelectedQfacetValueComponent.
8 9 10 11 |
# File 'app/components/blacklight/hierarchy/selected_qfacet_value_component.rb', line 8 def initialize(field_name:, item:) @field_name = field_name @item = item end |
Instance Attribute Details
#field_name ⇒ Object (readonly)
Returns the value of attribute field_name.
13 14 15 |
# File 'app/components/blacklight/hierarchy/selected_qfacet_value_component.rb', line 13 def field_name @field_name end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
13 14 15 |
# File 'app/components/blacklight/hierarchy/selected_qfacet_value_component.rb', line 13 def item @item end |
Instance Method Details
#remove_href ⇒ Object
15 16 17 |
# File 'app/components/blacklight/hierarchy/selected_qfacet_value_component.rb', line 15 def remove_href helpers.search_action_path(helpers.search_state.filter(field_name).remove(item.qvalue).params) end |
#remove_link ⇒ Object
19 20 21 22 23 24 |
# File 'app/components/blacklight/hierarchy/selected_qfacet_value_component.rb', line 19 def remove_link link_to(remove_href, class: "remove ps-2", rel: "nofollow") do render(Blacklight::Icons::RemoveComponent.new(aria_hidden: true)) + tag.span(t(:'blacklight.search.facets.selected.remove'), class: 'visually-hidden') end end |