Sha256: da221d4c42f27ee34de1f4123e3dd07673dedaa7563104a09a2dd5bbfd221edb

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module BootstrapForm
  module Inputs
    module Base
      extend ActiveSupport::Concern

      class_methods do
        def bootstrap_field(field_name)
          define_method "#{field_name}_with_bootstrap" do |name, options={}|
            form_group_builder(name, options) do
              prepend_and_append_input(name, options) do
                send("#{field_name}_without_bootstrap".to_sym, name, options)
              end
            end
          end

          bootstrap_alias field_name
        end

        def bootstrap_select_group(field_name)
          with_field_name = "#{field_name}_with_bootstrap"
          without_field_name = "#{field_name}_without_bootstrap"
          define_method(with_field_name) do |name, options={}, html_options={}|
            form_group_builder(name, options, html_options) do
              form_group_content_tag(name, field_name, without_field_name, options, html_options)
            end
          end

          bootstrap_alias field_name
        end

        def bootstrap_alias(field_name)
          alias_method "#{field_name}_without_bootstrap".to_sym, field_name
          alias_method field_name, "#{field_name}_with_bootstrap".to_sym
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/bootstrap_form-4.5.0/lib/bootstrap_form/inputs/base.rb
bootstrap_form-4.5.0 lib/bootstrap_form/inputs/base.rb
bootstrap_form-4.4.0 lib/bootstrap_form/inputs/base.rb
bootstrap_form-4.3.0 lib/bootstrap_form/inputs/base.rb
bootstrap_form-4.2.0 lib/bootstrap_form/inputs/base.rb