Class: Blacklight::ConstraintLayoutComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::ConstraintLayoutComponent
- Defined in:
- app/components/blacklight/constraint_layout_component.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Component
Blacklight::Component::EXCLUDE_VARIABLES
Instance Method Summary collapse
-
#initialize(value:, label: nil, remove_path: nil, classes: nil, search_state: nil) ⇒ ConstraintLayoutComponent
constructor
A new instance of ConstraintLayoutComponent.
- #remove_aria_label ⇒ Object
- #render? ⇒ Boolean
Methods inherited from Component
Constructor Details
#initialize(value:, label: nil, remove_path: nil, classes: nil, search_state: nil) ⇒ ConstraintLayoutComponent
Returns a new instance of ConstraintLayoutComponent.
5 6 7 8 9 10 11 |
# File 'app/components/blacklight/constraint_layout_component.rb', line 5 def initialize(value:, label: nil, remove_path: nil, classes: nil, search_state: nil) @value = value @label = label @remove_path = remove_path @classes = Array(classes).join(' ') @search_state = search_state end |
Instance Method Details
#remove_aria_label ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/components/blacklight/constraint_layout_component.rb', line 13 def remove_aria_label if @label.blank? t('blacklight.search.filters.remove.value', value: @value) else t('blacklight.search.filters.remove.label_value', label: @label, value: @value) end end |
#render? ⇒ Boolean
21 22 23 |
# File 'app/components/blacklight/constraint_layout_component.rb', line 21 def render? @value.present? end |