Class: FoxTail::RangeComponent

Inherits:
BaseComponent show all
Includes:
Concerns::Formable
Defined in:
app/components/fox_tail/range_component.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Instance Method Summary collapse

Methods inherited from BaseComponent

classname_merger, #initialize, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

This class inherits a constructor from FoxTail::BaseComponent

Instance Method Details

#before_renderObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/components/fox_tail/range_component.rb', line 11

def before_render
  super

  add_default_name_and_id
  html_attributes[:type] = :range
  html_attributes[:value] ||= value_before_type_cast
  html_attributes[:disabled] = disabled?
  html_attributes[:class] = classnames theme.apply(:root, self), html_class

  range = self.range || within_range
  html_attributes.update("min" => range.min, "max" => range.max) if range
end

#callObject



24
25
26
# File 'app/components/fox_tail/range_component.rb', line 24

def call
  tag.input(html_attributes)
end