Sha256: 393cef2ca34c1dd0e02b0a8e898a0077e43d50e99ec16b218b76037a990a23e9

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 Bytes

Contents

module SimpleForm
  module Inputs
    # Uses MapType to handle basic input types.
    class MappingInput < Base
      extend MapType

      map_type :text,     :to => :text_area
      map_type :file,     :to => :file_field

      def input
        @builder.send(input_method, attribute_name, input_html_options)
      end

    private

      def has_placeholder?
        (text? || password?) && placeholder_present?
      end

      def password?
        input_type == :password
      end

      def text?
        input_type == :text
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form-1.4.2 lib/simple_form/inputs/mapping_input.rb
simple_form-1.4.1 lib/simple_form/inputs/mapping_input.rb
simple_form-1.4.0 lib/simple_form/inputs/mapping_input.rb