class BootstrapHelpers::TabsBuilder

Tabs =

Attributes

pane_contents[R]
pane_handles[R]
parent[R]

Public Class Methods

new(parent) click to toggle source
# File lib/bootstrap-helpers.rb, line 233
def initialize parent
  @first = true
  @parent = parent
  @pane_handles = []
  @pane_contents = []
end

Public Instance Methods

pane(title, pane_id = nil, &block) click to toggle source
# File lib/bootstrap-helpers.rb, line 240
def pane(title, pane_id = nil, &block)
  pane_id ||= "#{title.parameterize}_tab"
  css_class, @first = 'active', false if @first
  link = content_tag(:a, title, :'data-toggle' => 'tab', :href => "##{pane_id}")
  @pane_handles << content_tag(:li, link, :class => css_class)
  @pane_contents << (content_tag :div, :class => "tab-pane #{css_class}", :id => "#{pane_id}" do
    capture(&block)
  end)
  nil
end