class Bootstrap::ViewHelpers::Components::Button::Checkbox

Attributes

checked[R]
input_options[R]

Public Instance Methods

to_html() click to toggle source
# File lib/bootstrap/view_helpers/components/button/checkbox.rb, line 6
def to_html
  input_options = input_html_options
  content_tag(:label, html_options) do
    content_tag(:input, label, input_options)
  end
end

Protected Instance Methods

html_options() click to toggle source
# File lib/bootstrap/view_helpers/components/button/checkbox.rb, line 22
def html_options
  @checked ||= options.delete(:checked)
  options
end
inject_class_name_to_options() click to toggle source
# File lib/bootstrap/view_helpers/components/button/checkbox.rb, line 17
def inject_class_name_to_options
  super
  options[:class] << ' disabled' if options[:disabled]
end
input_html_options() click to toggle source
# File lib/bootstrap/view_helpers/components/button/checkbox.rb, line 27
def input_html_options
  input_options = options.slice!(:id, :name)
  @options, input_options = input_options, options
  @input_options ||= { id: SecureRandom.hex, checked: checked,
                     type: 'checkbox', autocomplete: 'off' }
                     .merge(input_options)
end