Sha256: 722f0007959447886e3a7031edf27e875964b88a9fc71c432ab58b172853fdb1
Contents?: true
Size: 999 Bytes
Versions: 3
Compression:
Stored size: 999 Bytes
Contents
module SimpleForm module Inputs class StringInput < Base extend MapType map_type :string, :email, :search, :tel, :url, :to => :text_field map_type :password, :to => :password_field def input input_html_options[:size] ||= [limit, SimpleForm.default_input_size].compact.min input_html_options[:maxlength] ||= limit if limit && SimpleForm.html5 if password? || SimpleForm.html5 input_html_options[:type] ||= input_type unless string? end @builder.send(input_method, attribute_name, input_html_options) end def input_html_classes string? ? super : super.unshift("string") end protected def limit column && column.limit end def has_placeholder? placeholder_present? end def string? input_type == :string end def password? input_type == :password 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/string_input.rb |
simple_form-1.4.1 | lib/simple_form/inputs/string_input.rb |
simple_form-1.4.0 | lib/simple_form/inputs/string_input.rb |