Sha256: ca190f9e3cae4496d3a81c9125f90cef9fd2717b78bc78fe3248ad70caf2ae36

Contents?: true

Size: 945 Bytes

Versions: 1016

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module Forms
    class Builder
      def check_box(name, props: {}, **options)
        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

        checked_value = options[:checked_value]
        unchecked_value = options[:unchecked_value]
        options.delete(:checked_value)
        options.delete(:unchecked_value)

        input = super(name, options, checked_value, unchecked_value)

        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

Version data entries

1,016 entries across 1,016 versions & 1 rubygems

Version Path
playbook_ui-14.8.0.pre.alpha.PLAY1649rolloutheightglobalprops4635 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.8 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.7 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.6 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.5 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.pbntr661createstickyleftprop4612 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.4 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.3 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.2 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.1 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.PLAY16254545 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 lib/playbook/forms/builder/checkbox_field.rb
playbook_ui-14.9.0.pre.rc.0 lib/playbook/forms/builder/checkbox_field.rb