Module: BootstrapComponentsHelpers::TabsHelper

Defined in:
lib/bootstrap-components-helpers/tabs_helper.rb

Defined Under Namespace

Classes: TabsBuilder

Instance Method Summary collapse

Instance Method Details

#tabs(opts = {}) {|builder| ... } ⇒ Object

Yields:

  • (builder)


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bootstrap-components-helpers/tabs_helper.rb', line 3

def tabs opts = {}
  opts[:style] ||= 'tabs'
  builder = TabsBuilder.new self
  yield builder
  pane_handles_html = builder.pane_handles_html
  return unless pane_handles_html
  tabs = (:ul, builder.pane_handles_html, class: "nav nav-#{opts[:style]}")
  contents = (:div, builder.pane_contents_html, class: 'tab-content')
   :div do
    tabs + contents
  end
end