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-9.3.1.pre.alpha1 lib/playbook/forms/builder.rb
playbook_ui-9.3.0.alpha.inline3 lib/playbook/forms/builder.rb
playbook_ui-9.3.0.pre.alpha.password.strength.2 lib/playbook/forms/builder.rb
playbook_ui-9.3.0.alpha.inline2 lib/playbook/forms/builder.rb
playbook_ui-9.3.0.alpha.inline1 lib/playbook/forms/builder.rb
playbook_ui-9.3.0.pre.alpha.password.strength.1 lib/playbook/forms/builder.rb
playbook_ui-9.3.0 lib/playbook/forms/builder.rb
playbook_ui-9.2.2.pre.alpha.margin lib/playbook/forms/builder.rb
playbook_ui-9.2.2 lib/playbook/forms/builder.rb
playbook_ui-9.2.1 lib/playbook/forms/builder.rb
playbook_ui-9.2.0 lib/playbook/forms/builder.rb
playbook_ui-9.1.0 lib/playbook/forms/builder.rb
playbook_ui-9.0.0 lib/playbook/forms/builder.rb