Sha256: fe738e5ccb5edc87143cdb570f72ecab2c57b2fb2c0f318989d0f1bdc4012124

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    class Form < ::Playbook::KitBase
      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 :validate, type: Playbook::Props::Boolean, default: false

      def form_system_options
        form_options = prop(:form_system_options)
        if form_options.is_a?(::Array)
          model, options = *form_options
          (options || {}).merge(model: model)
        else
          form_options
        end
      end

      def render_in(view_context, &_block)
        super(view_context, &nil)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
playbook_ui-8.0.0 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_form/form.rb
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_form/form.rb