Sha256: b8dbd69c629312e4b0ce2da280a86421df1a28d52586cdfc5cf79ca9522864bb
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module Formtastic module Inputs module Base module Numeric def input_html_options defaults = super # override rails default size - does not apply to numeric inputs #@todo document/spec defaults[:size] = nil if in_option defaults[:min] = in_option.to_a.min defaults[:max] = in_option.to_a.max else defaults[:min] ||= min_option defaults[:max] ||= max_option end defaults[:step] ||= step_option defaults end def step_option return options[:step] if options.key?(:step) validation_step end def min_option return options[:min] if options.key?(:min) validation_min end def max_option return options[:max] if options.key?(:max) validation_max end def in_option options[:in] end def wrapper_html_options new_class = [super[:class], "numeric", "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/numeric.rb |