Sha256: 78edf89f2902baca0f86adb62bc4adbafe7912712d3731cef3e85385a1971265

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    module FormBuilder
      class TextInputBuilder < Module
        def initialize(method_name)
          define_method method_name do |name, props: {}, **options, &block|
            props[:label] = @template.label(@object_name, name) if props[:label] == true
            options = Hash(options)
            options[:skip_default_ids] = false unless options.has_key?(:skip_default_ids)
            input = super(name, **options, &block)

            @template.pb_rails("text_input", 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-3.0.1 app/pb_kits/playbook/pb_form/form_builder/text_input_builder.rb
playbook_ui-3.0.0 app/pb_kits/playbook/pb_form/form_builder/text_input_builder.rb