Sha256: 9096191a10b4c21774fa1c1c60d386cd710eded821fd2e6535b62c14af733ace
Contents?: true
Size: 1.01 KB
Versions: 26
Compression:
Stored size: 1.01 KB
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) form_kit.render_in(view_context, &block) end private def form_kit @form_system ||= begin ::Playbook::KitResolver.resolve("form/#{form_system}") .new(options: form_system_options, validate: validate, children: children) end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems