class TwitterBootstrap::ButtonGroupBuilder

Public Class Methods

new(id,view_context) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 8
def initialize(id,view_context)
  @id = id
  @view_context = view_context
  @buttons = ""
end

Public Instance Methods

build(block) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 14
def build(block)
  block.call(self)
  @view_context.content_tag(:div, @buttons.html_safe, class: 'btn-group',id: @id);
end
button(label, options = {}) click to toggle source
# File lib/twitter_bootstrap_helpers/button_group_builder.rb, line 19
def button(label, options = {})
  button_class = ['btn']

  button_class << options[:class] if options[:class]
  button_class << 'active' if options[:active]

  button_class = button_class.join(' ')

  data = {toggle: 'button'}
  data[:target] = "##{options[:target]}" if options[:target]

  @buttons << @view_context.content_tag(:button, label, class: button_class, data: data)

  ""
end
dropdown_button(item_title,dropdown_menu) click to toggle source