Class: Anchor::SelectComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Anchor::SelectComponent
show all
- Defined in:
- app/components/anchor/select_component.rb
Constant Summary
Constants included
from ViewHelper
ViewHelper::ANCHOR_HELPERS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Component
generate_id
Methods included from ViewHelper
#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes
#fetch_or_fallback
Constructor Details
#initialize(form_builder:, attribute:, choices:, show_marker: true, **kwargs) ⇒ SelectComponent
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/components/anchor/select_component.rb', line 5
def initialize(
form_builder:,
attribute:,
choices:,
show_marker: true,
**kwargs
)
@form_builder = form_builder
@attribute = attribute
@choices = choices
@show_marker = show_marker
super(**kwargs)
end
|
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
3
4
5
|
# File 'app/components/anchor/select_component.rb', line 3
def attribute
@attribute
end
|
Instance Method Details
#html_options ⇒ Object
24
25
26
27
28
29
|
# File 'app/components/anchor/select_component.rb', line 24
def html_options
{
class: InputComponent::INPUT_CLASSES,
data: { testid: "select-#{attribute.to_s.dasherize}" },
}
end
|
#icon_classes ⇒ Object
20
21
22
|
# File 'app/components/anchor/select_component.rb', line 20
def icon_classes
class_names(InputComponent::ICON_CLASSES, "right-4")
end
|
#show_marker? ⇒ Boolean
31
32
33
|
# File 'app/components/anchor/select_component.rb', line 31
def show_marker?
@show_marker
end
|