Sha256: b69c1600abece8024939473de7fe48f572479a2cee517eb46d929548e23cba80

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

module Eac
  module CommonFormHelper
    class FormBuilder
      module CommonTextFields
        %w[email password text].each do |t|
          class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
            def #{t}_field(field_name, options = {})  # def text_field(field_name, options = {})
              field(field_name, options) do           #   field(field_name, options) do
                input_options = options[:input_options] || {}
                input_options[:class] ||= 'form-control'
                @form.#{t}_field(field_name,          #     @form.text_field(field_name,
                  input_options)              #       class: 'form-control')
              end                                     #   end
            end                                       # end
          RUBY_EVAL
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eac_rails_utils-0.10.1 lib/eac/common_form_helper/form_builder/common_text_fields.rb
eac_rails_utils-0.10.0 lib/eac/common_form_helper/form_builder/common_text_fields.rb
eac_rails_utils-0.9.1 lib/eac/common_form_helper/form_builder/common_text_fields.rb
eac_rails_utils-0.9.0 lib/eac/common_form_helper/form_builder/common_text_fields.rb