Class: FoxTail::SelectComponent

Inherits:
InputBaseComponent show all
Defined in:
app/components/fox_tail/select_component.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#html_attributes

Instance Method Summary collapse

Methods inherited from InputBaseComponent

#initialize

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::InputBaseComponent

Instance Method Details

#before_renderObject



33
34
35
36
37
38
# File 'app/components/fox_tail/select_component.rb', line 33

def before_render
  super

  html_attributes[:class] = classnames theme.apply(:root, self), html_class
  html_attributes[:multiple] = :multiple if html_attributes[:multiple]
end

#callObject



40
41
42
43
44
45
# File 'app/components/fox_tail/select_component.rb', line 40

def call
  capture do
    concat render_hidden if html_attributes[:multiple].present? && include_hidden?
    concat render_select
  end
end

#valueObject



29
30
31
# File 'app/components/fox_tail/select_component.rb', line 29

def value
  options[:value] ||= value_before_type_cast
end