Sha256: 329a2eceaffe742efe0f83250c8819c98e84a1621fca6781b93609833b5b5b10

Contents?: true

Size: 906 Bytes

Versions: 3

Compression:

Stored size: 906 Bytes

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module RailsBootstrapForm
  class BootstrapFormBuilder < ActionView::Helpers::FormBuilder

    include RailsBootstrapForm::FieldWrapperBuilder
    include RailsBootstrapForm::Components
    include RailsBootstrapForm::Inputs

    delegate :capture, :concat, :tag, to: :@template

    attr_accessor :bootstrap_form_options

    def initialize(object_name, object, template, options)
      @bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options.delete(:bootstrap_form))
      apply_default_form_options(options)
      super(object_name, object, template, options)
    end

    def apply_default_form_options(options)
      options[:html] ||= {}
      options[:html].reverse_merge!(RailsBootstrapForm.config.default_form_attributes)
    end

    private :apply_default_form_options
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.2.3 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.2.2 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.2.1 lib/rails_bootstrap_form/bootstrap_form_builder.rb