Sha256: 519918dd6b02aef7195208b081cdc7d3ad55e9157bff096b7538977b9bf7146c
Contents?: true
Size: 1.1 KB
Versions: 8
Compression:
Stored size: 1.1 KB
Contents
require 'bh/helpers/form/base_helper' module Bh module Form module CheckBoxHelper include BaseHelper 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 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 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 end end end
Version data entries
8 entries across 8 versions & 1 rubygems