Sha256: 4175cb0eb843e7d2ea95e61f765645a8bf38e1e678b7a2f5295a811b01c65ac7

Contents?: true

Size: 484 Bytes

Versions: 26

Compression:

Stored size: 484 Bytes

Contents

class MoneyInput < SimpleForm::Inputs::Base
  enable :placeholder, :min_max

  def input
    add_size!
    input_html_classes.unshift("numeric")
    if html5?
      input_html_options[:type] ||= "number"
      input_html_options[:step] ||= integer? ? 1 : "any"
    end
    @builder.text_field(attribute_name, input_html_options)
  end

  private

  # Rails adds the size attr by default, if the :size key does not exist.
  def add_size!
    input_html_options[:size] ||= nil
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
mongoid_money_field-5.0.3 lib/mongoid_money_field/simple_form/money_input.rb
mongoid_money_field-5.0.2 lib/mongoid_money_field/simple_form/money_input.rb
mongoid_money_field-5.0.1 lib/mongoid_money_field/simple_form/money_input.rb
mongoid_money_field-5.0.0 lib/mongoid_money_field/simple_form/money_input.rb
mongoid_money_field-4.0.1 lib/mongoid_money_field/simple_form/money_input.rb
mongoid_money_field-4.0.0 lib/mongoid_money_field/simple_form/money_input.rb