class TwitterBootstrap::ButtonGroupWithTabsBuilder

Public Class Methods

new(view_context) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 44
def initialize(view_context)
  super(:radio, view_context)
  @tabs = ""
end

Public Instance Methods

build(block) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 49
def build(block)
  block.call(self)

  buttons = @view_context.content_tag(:div, @buttons.html_safe, class: 'btn-group', data: {toggle: 'buttons-radio'})
  tabs = @view_context.content_tag(:div, @tabs.html_safe, class: 'tab-content')

  @view_context.content_tag(:div, buttons << tabs, class: 'tabbable')
end
button(label, target, options = {}, &block) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 58
def button(label, target, options = {}, &block)
  super(label, options.merge!(target: target))

  tab_class = ['tab-pane']
  tab_class << 'active' if options[:active]

  tab_class = tab_class.join(' ')

  @tabs << @view_context.content_tag(:div, @view_context.capture(&block), id: target, class: tab_class)

  ""
end