Sha256: 2c8290780d461794fa861f121dd8d7e135f7635adb126f24cc7bcbdafabf969f
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true module Formtastic module Inputs module Base module Stringish # @abstract Override this method in your input class to describe how the input should render itself. def to_html input_wrapping do label_html << builder.text_field(method, input_html_options) end end # Overrides standard `input_html_options` to provide a `maxlength` and `size` attribute. def input_html_options { :maxlength => maxlength, :size => size }.merge(super) end def size builder.default_text_field_size end def maxlength options[:input_html].try(:[], :maxlength) || limit end def wrapper_html_options new_class = [super[:class], "stringish"].compact.join(" ") super.merge(:class => new_class) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
formtastic-5.0.0 | lib/formtastic/inputs/base/stringish.rb |