Sha256: 4a6a8e31c9cfab000560769dec712ea1a19bdf82d90c78755c081950209cfb43

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    module FormBuilder
      module CheckboxField
        def check_box(name, data: {}, props: {})
          value = props[:value] ||= 1
          input = super(name, { required: props[:required], data: data }, value)
          label_text = name.to_s.gsub("_", " ")

          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

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_form/form_builder/checkbox_field.rb