Class: FoxTail::Dropdown::InputItemComponent

Inherits:
BaseComponent
  • Object
show all
Includes:
Concerns::Formable
Defined in:
app/components/fox_tail/dropdown/input_item_component.rb

Instance Method Summary collapse

Instance Method Details

#before_renderObject



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

#callObject



29
30
31
32
33
34
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 29

def call
   :div, html_attributes do
    concat (:div, input_content, class: input_container_classes)
    concat (:div, label_content, class: label_container_classes)
  end
end

#idObject



10
11
12
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 10

def id
  options[:id] ||= tag_id
end

#input_classesObject



44
45
46
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 44

def input_classes
  theme.apply :input, self
end

#input_container_classesObject



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_contentObject

Raises:

  • (NotImplementedError)


52
53
54
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 52

def input_content
  raise NotImplementedError
end

#label_classesObject



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_classesObject



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_contentObject



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

#nameObject



14
15
16
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 14

def name
  options[:name] ||= tag_name
end

#valueObject



18
19
20
# File 'app/components/fox_tail/dropdown/input_item_component.rb', line 18

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