Sha256: 7c2da5cc257bd7f845b257eb24daece48c388e517dde888e6654ffc415433fb7

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

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

module RailsBootstrapForm
  module Inputs

    FIELD_HELPERS = %i[
      text_field
      url_field
      search_field
      telephone_field
      number_field
      email_field
      file_field
      phone_field
      password_field
      text_area
      date_field
      time_field
      datetime_field
      datetime_local_field
      month_field
      week_field
    ].freeze

    FIELD_HELPERS.each do |field_tag_name|
      define_method(field_tag_name) do |attribute, options = {}|
        field_wrapper_builder(attribute, options) do
          super(attribute, options)
        end
      end
    end

    def select(attribute, choices = nil, options = {}, html_options = {}, &block)
      options = options.reverse_merge(bootstrap_form: {field_class: "form-select"})

      field_wrapper_builder(attribute, options, html_options) do
        super(attribute, choices, options, html_options, &block)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.3.1 lib/rails_bootstrap_form/inputs.rb
rails_bootstrap_form-0.3.0 lib/rails_bootstrap_form/inputs.rb
rails_bootstrap_form-0.2.3 lib/rails_bootstrap_form/inputs.rb
rails_bootstrap_form-0.2.2 lib/rails_bootstrap_form/inputs.rb
rails_bootstrap_form-0.2.1 lib/rails_bootstrap_form/inputs.rb