Sha256: c65564e555cf97a9fd35cb2a0f595419601bab0a7ee895357970a568079e8472

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

module SimpleForm
  module Inputs
    class StringInput < Base
      enable :placeholder

      def input
        input_html_options[:type] ||= input_type if SimpleForm.html5 && !string?
        add_maxlength!
        add_pattern!
        add_size!
        @builder.text_field(attribute_name, input_html_options)
      end

      def input_html_classes
        string? ? super : super.unshift("string")
      end

      private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form-1.5.2 lib/simple_form/inputs/string_input.rb
simple_form-1.5.1 lib/simple_form/inputs/string_input.rb
simple_form-1.5.0 lib/simple_form/inputs/string_input.rb