Sha256: 6d8fb1fc9e7268e88b995a843ecffd484118601d1b24a9fe50c20a8ebdb3dbf9

Contents?: true

Size: 569 Bytes

Versions: 23

Compression:

Stored size: 569 Bytes

Contents

# la classe FenchDecimalInput permet d'utiliser les
# possibilités de html 5 (text pattern) mais pas numeric car Chrome
# rentre les points décimaux d'un clavier comme des points
# ce qui n'est pas accepté et tronque les décimales.
#
class FrenchDecimalInput < SimpleForm::Inputs::Base

 def input(wrapper_options)
   input_html_options['type'] = 'text' # probablement inutile
   input_html_options['pattern'] = '\-?\d+(\.\d{0,2})?'
   input_html_classes.unshift('numeric decimal form-control')
   @builder.text_field(attribute_name, input_html_options)
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
adherent-0.3.13 config/initializers/french_decimal_input.rb
adherent-0.3.12 config/initializers/french_decimal_input.rb
adherent-0.3.11 config/initializers/french_decimal_input.rb
adherent-0.3.10 config/initializers/french_decimal_input.rb
adherent-0.3.9 config/initializers/french_decimal_input.rb
adherent-0.3.7 config/initializers/french_decimal_input.rb
adherent-0.3.6 config/initializers/french_decimal_input.rb
adherent-0.3.5 config/initializers/french_decimal_input.rb
adherent-0.3.4 config/initializers/french_decimal_input.rb
adherent-0.3.3 config/initializers/french_decimal_input.rb
adherent-0.3.2 config/initializers/french_decimal_input.rb
adherent-0.3.1 config/initializers/french_decimal_input.rb
adherent-0.3.0 config/initializers/french_decimal_input.rb
adherent-0.2.9 config/initializers/french_decimal_input.rb
adherent-0.2.8 config/initializers/french_decimal_input.rb
adherent-0.2.7 config/initializers/french_decimal_input.rb
adherent-0.2.6 config/initializers/french_decimal_input.rb
adherent-0.2.5 config/initializers/french_decimal_input.rb
adherent-0.2.4 config/initializers/french_decimal_input.rb
adherent-0.2.3 config/initializers/french_decimal_input.rb