Sha256: 33cbef2473be9fb6a42cc68f6cbdcaaed6dbb2c97429f301d6b60937ab31c668

Contents?: true

Size: 993 Bytes

Versions: 5

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbForm
    class Form
      class SimpleFormForm
        def initialize(form)
          self.form = form
        end

        def to_partial_path
          "pb_form/form_simple_form"
        end

        def merged_form_system_options
          [
            Array(form_system_options)[0],
            Hash(Array(form_system_options)[1]).merge(
              data: { "pb-form-validation": validate },
              html: merged_html,
              builder: form_builder
            ),
          ]
        end

      private

        attr_accessor :form

        delegate_missing_to :form

        def merged_html
          html_options = Hash(Array(form_system_options)[1])[:html] || {}
          html_class = html_options[:class]
          html_options[:class] = "pb-form #{html_class}".strip

          html_options
        end

        def form_builder
          FormBuilder::SimpleFormBuilder
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
playbook_ui-4.1.2 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-4.1.1 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-4.1.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-4.0.1 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-4.0.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb