heartcombo--simple_form/lib/simple_form/inputs/string_input.rb

26 lines
596 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
module SimpleForm
module Inputs
class StringInput < Base
enable :placeholder, :maxlength, :minlength, :pattern
def input(wrapper_options = nil)
2011-12-04 14:56:05 +00:00
unless string?
input_html_classes.unshift("string")
2011-12-04 15:15:27 +00:00
input_html_options[:type] ||= input_type if html5?
2011-12-04 14:56:05 +00:00
end
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
@builder.text_field(attribute_name, merged_input_options)
end
private
2010-11-21 15:50:36 +00:00
def string?
input_type == :string
end
end
end
end