Sha256: 2431af0414c4ceda155e99ff2dd03f61fd7f947ce09161954803765fc2abb30e

Contents?: true

Size: 662 Bytes

Versions: 5

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    module FormBuilder
      class FormFieldBuilder < Module
        def initialize(method_name, kit_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(kit_name, props: props) do
              input
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-3.5.0 app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb
playbook_ui-3.4.0 app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb
playbook_ui-3.3.0 app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb
playbook_ui-3.2.0 app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb
playbook_ui-3.1.0 app/pb_kits/playbook/pb_form/form_builder/form_field_builder.rb