Class: FoxTail::Accordion::ItemComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/fox_tail/accordion/item_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, title, html_attributes = {}) ⇒ ItemComponent

Returns a new instance of ItemComponent.



64
65
66
67
68
# File 'app/components/fox_tail/accordion/item_component.rb', line 64

def initialize(id, title, html_attributes = {})
  @id = id
  @title = title
  super(html_attributes)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'app/components/fox_tail/accordion/item_component.rb', line 4

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'app/components/fox_tail/accordion/item_component.rb', line 4

def title
  @title
end

Instance Method Details

#before_renderObject



78
79
80
81
82
# File 'app/components/fox_tail/accordion/item_component.rb', line 78

def before_render
  super

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

#body_idObject



70
71
72
# File 'app/components/fox_tail/accordion/item_component.rb', line 70

def body_id
  :"#{id}_body"
end

#callObject



84
85
86
87
88
89
# File 'app/components/fox_tail/accordion/item_component.rb', line 84

def call
   :div, html_attributes do
    concat render_header
    concat render_body
  end
end

#trigger_idObject



74
75
76
# File 'app/components/fox_tail/accordion/item_component.rb', line 74

def trigger_id
  :"#{id}_trigger"
end