Class: FoxTail::Dropdown::InputItemComponent
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- FoxTail::Dropdown::InputItemComponent
show all
- Includes:
- Concerns::Formable
- Defined in:
- app/components/fox_tail/dropdown/input_item_component.rb
Instance Method Summary
collapse
Instance Method Details
#before_render ⇒ Object
22
23
24
25
26
27
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 22
def before_render
super
html_attributes[:id] = "#{id}_menu_item" if id.present?
html_attributes[:class] = classnames theme.apply(:root, self), html_class
end
|
#call ⇒ Object
29
30
31
32
33
34
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 29
def call
content_tag :div, html_attributes do
concat content_tag(:div, input_content, class: input_container_classes)
concat content_tag(:div, label_content, class: label_container_classes)
end
end
|
#id ⇒ Object
10
11
12
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 10
def id
options[:id] ||= tag_id
end
|
44
45
46
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 44
def input_classes
theme.apply :input, self
end
|
36
37
38
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 36
def input_container_classes
theme.apply :input_container, self
end
|
#input_content ⇒ Object
52
53
54
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 52
def input_content
raise NotImplementedError
end
|
#label_classes ⇒ Object
48
49
50
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 48
def label_classes
theme.apply :label, self
end
|
#label_container_classes ⇒ Object
40
41
42
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 40
def label_container_classes
theme.apply :label_container, self
end
|
#label_content ⇒ Object
56
57
58
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 56
def label_content
label_tag id, content, class: label_classes
end
|
#name ⇒ Object
14
15
16
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 14
def name
options[:name] ||= tag_name
end
|
#value ⇒ Object
18
19
20
|
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 18
def value
options[:value] ||= value_from_object
end
|