Sha256: 2389a6612cc71c2c2d87ab23cb475064b0cad62ea844e01cafd7b395ae78b1e2
Contents?: true
Size: 1.39 KB
Versions: 8
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true if defined?(SimpleForm) module Playbook module PbForm class SimpleForm < Playbook::KitBase class FormBuilder < ::SimpleForm::FormBuilder include ::Playbook::PbForm::FormBuilder def input(attribute_name, options = {}, &block) super( attribute_name, options.deep_merge(label: false, input_html: { props: { label: true, }, }), &block ) end end prop :options, type: Playbook::Props::Hash, default: {} prop :validate, type: Playbook::Props::Boolean, default: false def options { builder: Playbook::PbForm::SimpleForm::FormBuilder, html: html_options, data: data, url: "", }.merge(prop(:options)) end def model prop(:options).fetch(:model, nil) end def data prop(:data).merge("pb-form-validation" => validate) end def classname [generate_classname("pb-form"), html[:class]].join(" ") end def html prop(:options).fetch(:html, {}) end def render_in(view_context, &_block) super(view_context, &nil) end private def html_options html.merge(class: classname) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems