Sha256: 2dd103970e390efa834169d8c34db5213684fa6849836fb02919be4ca93689fe

Contents?: true

Size: 1.3 KB

Versions: 333

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module Playbook
  module Forms
    class Builder < ::ActionView::Helpers::FormBuilder
      require_relative "builder/action_area"
      require_relative "builder/checkbox_field"
      require_relative "builder/collection_select_field"
      require_relative "builder/date_picker_field"
      require_relative "builder/form_field_builder"
      require_relative "builder/select_field"
      require_relative "builder/typeahead_field"

      prepend(FormFieldBuilder.new(:email_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:number_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:search_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:telephone_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:text_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:password_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:url_field, kit_name: "text_input"))
      prepend(FormFieldBuilder.new(:text_area, kit_name: "textarea"))

      def actions
        context = @template.respond_to?(:view_context) ? @template.view_context : @template
        context.content_tag :ol, class: "pb-form-actions" do
          yield ActionArea.new(@template, submit_default_value)
        end
      end
    end
  end
end

Version data entries

333 entries across 333 versions & 1 rubygems

Version Path
playbook_ui-10.0.1 lib/playbook/forms/builder.rb
playbook_ui-10.0.0 lib/playbook/forms/builder.rb
playbook_ui-9.19.0.pre.alpha.pre.fonts2 lib/playbook/forms/builder.rb
playbook_ui-9.19.0 lib/playbook/forms/builder.rb
playbook_ui-9.19.0.pre.alphafonts lib/playbook/forms/builder.rb
playbook_ui-9.18.0.flow.bin.alpha lib/playbook/forms/builder.rb
playbook_ui-9.18.0 lib/playbook/forms/builder.rb
playbook_ui-9.17.0 lib/playbook/forms/builder.rb
playbook_ui-9.17.0.pre.decouple.website2 lib/playbook/forms/builder.rb
playbook_ui-9.16.0 lib/playbook/forms/builder.rb
playbook_ui-9.15.0 lib/playbook/forms/builder.rb
playbook_ui-9.15.0.pre.decouple.website1 lib/playbook/forms/builder.rb
playbook_ui-9.14.1.alpha.radio.alignment lib/playbook/forms/builder.rb
playbook_ui-9.14.1.alpha.highcharts9 lib/playbook/forms/builder.rb
playbook_ui-9.14.1 lib/playbook/forms/builder.rb
playbook_ui-9.13.0 lib/playbook/forms/builder.rb
playbook_ui-9.12.0 lib/playbook/forms/builder.rb
playbook_ui-9.12.0.pre.text.addon lib/playbook/forms/builder.rb
playbook_ui-9.11.0 lib/playbook/forms/builder.rb
playbook_ui-9.10.0 lib/playbook/forms/builder.rb