Sha256: 26d0d33dd76f8a9673d46ebfd0baf333c504454c7a9a75ae59d29ba57a6daec7

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

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

module RailsBootstrapForm
  module Inputs
    module Base
      extend ActiveSupport::Concern

      class_methods do
        def bootstrap_field(field_name)
          define_method(field_name) do |attribute, options = {}|
            field_wrapper_builder(attribute, options) do
              super(attribute, options)
            end
          end
        end

        def bootstrap_select_group(field_name)
          define_method(field_name) do |attribute, options = {}, html_options = {}|
            options = {bootstrap_form: {field_class: "form-select"}}.deep_merge!(options)

            field_wrapper_builder(attribute, options, html_options) do
              tag.fieldset(class: control_specific_class(field_name)) do
                super(attribute, options, html_options)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.8.3 lib/rails_bootstrap_form/inputs/base.rb
rails_bootstrap_form-0.8.2 lib/rails_bootstrap_form/inputs/base.rb
rails_bootstrap_form-0.8.1 lib/rails_bootstrap_form/inputs/base.rb