Method: Bootstrap4Helper::Accordion#body

Defined in:
lib/bootstrap4_helper/accordion.rb

#body(opts = {}, &block) ⇒ String

Note:

The ‘@parent` gets used to set the parent element for the accordion. This gets used primarily in the `AccordionGroup`.

Builds the body component for the accordion, which is actually the body of a Card.

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (String)


64
65
66
67
68
69
70
71
72
# File 'lib/bootstrap4_helper/accordion.rb', line 64

def body(opts = {}, &block)
  data  = { parent: "##{@parent}" } if @parent.present?
  klass = 'collapse'
  klass += ' show' if @expanded

   :div, id: @target, class: klass, data: data do
    @card.body(opts, &block)
  end
end