module Bh::Form::CheckBoxHelper

Public Instance Methods

check_box(method, options = {}, checked_value = '1', unchecked_value = '0') click to toggle source
Calls superclass method
# File lib/bh/core_ext/rails/form/check_box_helper.rb, line 8
def check_box(method, options = {}, checked_value = '1', unchecked_value = '0')
  block = -> { super method, options, checked_value, unchecked_value }
  if options.delete(:inline_label) { true }
    check_box_with_inline_label method, options, &block
  else
    check_box_with_block_label method, options, &block
  end
end

Private Instance Methods

check_box_with_block_label(method, options = {}, &block) click to toggle source
# File lib/bh/core_ext/rails/form/check_box_helper.rb, line 19
def check_box_with_block_label(method, options = {}, &block)
  append_class! options, 'form-control' unless inline_form?
  append_class! options, 'checkbox' if horizontal_form?
  options[:label] ||= method.to_s.humanize
  base_field method, :checkbox, options, &block
end
check_box_with_inline_label(method, options = {}, &block) click to toggle source
# File lib/bh/core_ext/rails/form/check_box_helper.rb, line 26
def check_box_with_inline_label(method, options = {}, &block)
  options.merge! offset: true, use_label: false
  options[:label] ||= method.to_s.humanize
  base_field method, :checkbox, options do
    label_and_field 'checkbox', method, options, &block
  end
end