Sha256: 66b3e799fc53adf4e3a16e58691013d352adcb1ecfb19bda6e88ddf54731eb2d

Contents?: true

Size: 827 Bytes

Versions: 36

Compression:

Stored size: 827 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    module FormBuilder
      module CheckboxField
        def check_box(name, props: {}, **options, &block)
          label_text = @template.label(@object_name, name) if props[:label] == true
          options[:required] = true if props[:required]
          props[:margin_bottom] = "sm"
          props[:form_spacing] = true

          input = super(name, **options, &block)

          if props[:label]
            @template.pb_rails("caption", props: { text: label_text, margin_bottom: "xs" }) +
              @template.pb_rails("checkbox", props: props) do
                input
              end
          else
            @template.pb_rails("checkbox", props: props) do
              input
            end
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
playbook_ui-7.3.0.pre.alpha2 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.8.2.pre.alpha1 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha14 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.8.0 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.7.0 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.6.1 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.6.0 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.5.2 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.5.1 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.5.0 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb