Sha256: 4042d1e691dff7d33b08849ad701227261c5b24e607b1d3eb723e49a091d0f96
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
require 'bh/core_ext/rails/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
7 entries across 7 versions & 1 rubygems