Class: FoxTail::InputComponent
- Inherits:
-
InputBaseComponent
- Object
- ViewComponent::Base
- Base
- BaseComponent
- InputBaseComponent
- FoxTail::InputComponent
- Defined in:
- app/components/fox_tail/input_component.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseComponent
Instance Method Summary collapse
Methods inherited from InputBaseComponent
stimulus_controller_name, #stimulus_controller_options, #use_stimulus?
Methods inherited from BaseComponent
classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class
Methods inherited from Base
Constructor Details
This class inherits a constructor from FoxTail::BaseComponent
Instance Method Details
#before_render ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/components/fox_tail/input_component.rb', line 45 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
59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/components/fox_tail/input_component.rb', line 59 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
41 42 43 |
# File 'app/components/fox_tail/input_component.rb', line 41 def visual? left_visual? || right_visual? end |