Sha256: 6c973001a4a9f0b1abf426eaffae8cb8efb2001ec4d018243756f5362ebdb201

Contents?: true

Size: 956 Bytes

Versions: 6

Compression:

Stored size: 956 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::InputGroupBuilder
    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

6 entries across 6 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.6.0 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.5.3 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.5.2 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.5.1 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.3.1 lib/rails_bootstrap_form/bootstrap_form_builder.rb
rails_bootstrap_form-0.3.0 lib/rails_bootstrap_form/bootstrap_form_builder.rb