Sha256: e59dcca7b6b02a79cef3e99b665c4ed22a255e17ce17f0e068c6025c004c840c
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
# -*- encoding: utf-8 -*- # -*- frozen_string_literal: true -*- # -*- warn_indent: true -*- module RailsBootstrapForm module Inputs module CheckBox extend ActiveSupport::Concern included do def check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0", &block) bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap_form)) options[:class] = check_box_classes(attribute, options) check_box_field = super(attribute, options, checked_value, unchecked_value) check_box_help_text = help_text(attribute, bootstrap_options) check_box_label = check_box_label(attribute, checked_value, options, bootstrap_options, &block) check_box_html = tag.div(**check_box_wrapper_options(bootstrap_options)) do concat(check_box_field) concat(check_box_label) concat(check_box_help_text) unless bootstrap_options.inline? concat(generate_error(attribute)) if (is_invalid?(attribute) && !bootstrap_options.inline?) end if bootstrap_options.inline? check_box_html else if bootstrap_options.layout_horizontal? tag.div(class: field_wrapper_classes(bootstrap_options)) do tag.div(class: check_box_container_classes(bootstrap_options)) do check_box_html end end elsif bootstrap_options.layout_inline? tag.div(class: "col-12") { check_box_html } else check_box_html end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems