Sha256: f2e6088373f8394ead5a388f59b07998b7b475c6465f87d0065b1bcaeb041eba
Contents?: true
Size: 1.04 KB
Versions: 1016
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Playbook module Forms class Builder 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.key?(:skip_default_ids) options[:required] = true if props[:required] options[:placeholder] = props[:placeholder] || "" if props.key?(:validation) validation = props[:validation] options[:pattern] = validation[:pattern] if validation[:pattern].present? options[:data] = { message: validation[:message] } if validation[:message].present? end input = super(name, **options, &block) @template.pb_rails(kit_name, props: props) do input end end end end end end end
Version data entries
1,016 entries across 1,016 versions & 1 rubygems