Module: NdrUi::Bootstrap::AccordionHelper

Included in:
NdrUi::BootstrapHelper
Defined in:
app/helpers/ndr_ui/bootstrap/accordion_helper.rb

Overview

This provides bootstrap accordion helper methods

Instance Method Summary collapse

Instance Method Details

#bootstrap_accordion_tag(dom_id, options = {}, &_block) ⇒ Object

Creates an accordion wrapper and creates a new NdrUi::Bootstrap::Accordion instance Creates an plain or nested bootstrap accordion along with bootstrap_accordion_group method at NdrUi::Bootstrap::Accordion class.

Signatures

bootstrap_accordion_tag(dom_id) do |accordion|
  #content for accordion items
end

Examples

<%= bootstrap_accordion_group :fruit do |fruit_accordion| %>
<% end %>
# => <div id="fruit" class="accordion"></div>


20
21
22
23
24
25
26
27
28
29
# File 'app/helpers/ndr_ui/bootstrap/accordion_helper.rb', line 20

def bootstrap_accordion_tag(dom_id, options = {}, &_block)
  return unless block_given?

  options.stringify_keys!
  accordion = ::NdrUi::Bootstrap::Accordion.new(dom_id, self)
  seamless = options['seamless']
  (:div, id: accordion.dom_id.to_s, class: "accordion#{' accordion-flush' if seamless}") do
    yield(accordion)
  end
end