Sha256: 046507f29ed324feb72a166d1721f68ca4948fea7ddabf2e92307e2d86dcdaab
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'railsstrap/core_ext/rails/form/base_helper' module Railsstrap 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
railsstrap-4.0.0.beta3 | lib/railsstrap/core_ext/rails/form/check_box_helper.rb |
railsstrap-4.0.0.beta2 | lib/railsstrap/core_ext/rails/form/check_box_helper.rb |