Sha256: 60748aa2f820a4774d4a6440cb60d7ad650982f22dbed303e70874ee30c2f90e

Contents?: true

Size: 858 Bytes

Versions: 197

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

# require_dependency "app/pb_kits/playbook/pb_form/form_builder"

module Playbook
  module PbForm
    class Form
      include Playbook::Props

      clear_props
      prop :form_system, type: Playbook::Props::Enum,
                         values: %w[form_with simple_form],
                         default: "form_with"
      prop :form_system_options, type: Playbook::Props::Base
      prop :children, type: Playbook::Props::Proc
      prop :validate, type: Playbook::Props::Boolean, default: false

      delegate :to_partial_path, to: :specific_form
      delegate :merged_form_system_options, to: :specific_form
      delegate :form_builder, to: :specific_form

    private

      def specific_form
        @specific_form ||= "#{self.class}::#{form_system.classify}Form".constantize.new(self)
      end
    end
  end
end

Version data entries

197 entries across 197 versions & 1 rubygems

Version Path
playbook_ui-4.7.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.7.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.6.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.6.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.5.2 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.5.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.5.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.4.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.4.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.3.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.3.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.2.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.1.2 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.1.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.1.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.0.1 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-4.0.0 app/pb_kits/playbook/pb_form/form.rb