# -*- 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 def control_specific_class(field_tag_name) "rails-bootstrap-forms-#{field_tag_name.to_s.tr("_", "-")}" end private :apply_default_form_options, :control_specific_class end end