Sha256: e32b72e6c96f1959efae88333ed77763813dccc8f8890cc6f3bdde3e705333bc

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    module FormBuilder
      module DatePickerField
        # def date_field(name, props: {})
        #   # props[:name] = name

        #   input = super(name)
        #   puts name
        #   puts input

        #   @template.pb_rails("date_picker", props: props) do
        #     input
        #   end
        # end
        # def date_picker(name, props: {})
        #   predicate = name.to_s.split("_")[0]
        #   html_name = "#{predicate}[#{name}]"
        #   id = predicate + "_" + name.to_s

        #   props[:name] = html_name
        #   props[:picker_id] = id

        #   @template.pb_rails("date_picker", props: props)
        # end
        def date_picker(name, props: {})
          prefix = @object_name
          html_attribute_name = "#{prefix}[#{name}]"
          html_id = "#{prefix}_#{name}"

          props[:name] = html_attribute_name
          props[:picker_id] = html_id

          @template.pb_rails("date_picker", props: props)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_form/form_builder/date_picker_field.rb