Sha256: b0f85c25fb43700a8267ea6b3025c7ef9b01d97d8d3e2cd26c46cb0ef2b9f20e

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module SimpleForm
  module Inputs
    class StringInput < Base
      enable :placeholder, :maxlength, :minlength, :pattern

      def input(wrapper_options = nil)
        unless string?
          input_html_classes.unshift("string")
          input_html_options[:type] ||= input_type if html5?
        end

        merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

        @builder.text_field(attribute_name, merged_input_options)
      end

      private

      def string?
        input_type == :string
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
simple_form-3.5.0 lib/simple_form/inputs/string_input.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/simple_form-3.4.0/lib/simple_form/inputs/string_input.rb
simple_form-3.4.0 lib/simple_form/inputs/string_input.rb