Sha256: 860464138801d0689820e1946cb23deacf1ce7b652ece82362a75e34f6a6833c
Contents?: true
Size: 825 Bytes
Versions: 8
Compression:
Stored size: 825 Bytes
Contents
module UiBibzInputs class StringInput < SimpleForm::Inputs::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 def options super.merge({ value: @builder.object.send(attribute_name) || super[:value] }) end private def string? input_type == :string end protected def input_attribute_name "#{ @builder.object.class.to_s.parameterize.underscore }[#{ attribute_name }]" end end end
Version data entries
8 entries across 8 versions & 1 rubygems