Class: FoxTail::InputComponent
Instance Attribute Summary
#html_attributes
Instance Method Summary
collapse
#initialize
classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
fox_tail_config
Instance Method Details
#before_render ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/components/fox_tail/input_component.rb', line 41
def before_render
super
html_attributes[:type] ||= :text
html_attributes[:class] = classnames theme.apply(:root, self), html_class
html_attributes[:value] ||= value_before_type_cast
if html_attributes[:type] == :number
format_range!
elsif html_attributes[:type] == :submit
format_submit!
end
end
|
#call ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/components/fox_tail/input_component.rb', line 55
def call
if visual?
content_tag :div, class: theme.apply(:container, self) do
concat render_visual :left, left_visual if left_visual?
concat input_content
concat render_visual :right, right_visual if right_visual?
end
else
input_content
end
end
|
#visual? ⇒ Boolean
37
38
39
|
# File 'app/components/fox_tail/input_component.rb', line 37
def visual?
left_visual? || right_visual?
end
|