Sha256: 00eb1b63dc5ed882364d821f731d9ba3aa82849f9b82328e315167e8e586ff70

Contents?: true

Size: 937 Bytes

Versions: 7

Compression:

Stored size: 937 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(
              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

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-3.5.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.4.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.3.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.2.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.1.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.0.1 app/pb_kits/playbook/pb_form/form/simple_form_form.rb
playbook_ui-3.0.0 app/pb_kits/playbook/pb_form/form/simple_form_form.rb