effective_form_inputs 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a81746bc9395965c6fd68a747c41eed035cf7ee2
4
- data.tar.gz: af630121102f257527f6ef49f4dad99ad95aa60d
3
+ metadata.gz: 0ca7634f956f6ce0578dc9d87cc0f7459365fc1c
4
+ data.tar.gz: ed1f6645534ebcceaabab45387af836ce84d2dd0
5
5
  SHA512:
6
- metadata.gz: e673872c76cac66b486da99f9779848e7642489499abdc85dd6104e03899cf5e0794de881ccab0c14399ef93287800161105b92abf351f54b33239dd4a37f0f2
7
- data.tar.gz: e7d4feefa48756d8dc40399f9ca3793b4f4522f995953a32f65524b7949bd953bcc9fa066cdfcfee902bd030b7cfb17186ec41ac66b166835fba75f56f223f77
6
+ metadata.gz: 346b5a3b58cd8865f772c606028859f4227a669f6adaa0d37f956bce1131116e640db9bfc9cc9beb8c9d92bb63ab437cd993e9091c2015f4f1a118b94fe4d435
7
+ data.tar.gz: ffa5846151696539d48359d82c1e4187d05f311500a5441c64d4d356de48635c946b553b5026daca2e980db3fdabcdd0d24e2ae45abf7ceb2c8b8f143ca89d25
@@ -18,20 +18,21 @@ $(document).on 'keydown', "input[type='text'].effective_price", (event) ->
18
18
  if event.key && event.key.length == 1 && event.metaKey == false && allowed.indexOf(event.key) == -1
19
19
  event.preventDefault()
20
20
 
21
+ # Assign the hidden input a value of 100x value
22
+ $(document).on 'change keyup', "input[type='text'].effective_price", (event) ->
23
+ value = parseFloat($(event.target).val().replace(/,/g, '') || 0.00) * 100.00
24
+ $(event.target).siblings("input[type='hidden']").first().val(value.toFixed(0))
21
25
 
22
26
  # Format the value for display as currency (USD)
23
27
  $(document).on 'change', "input[type='text'].effective_price", (event) ->
24
- value = parseFloat($(event.target).val().replace(',', ''))
28
+ value = parseInt($(event.target).siblings("input[type='hidden']").first().val() || 0)
25
29
 
26
30
  if isNaN(value) == false
31
+ value = (value / 100.0) if value != 0
32
+
27
33
  value = value.toFixed(2).toString()
28
34
  value = value.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2') while (/(\d+)(\d{3})/.test(value))
29
35
  else
30
36
  value = ''
31
37
 
32
38
  $(event.target).val(value)
33
-
34
- # Assign the hidden input a value of 100x value
35
- $(document).on 'change keyup', "input[type='text'].effective_price", (event) ->
36
- value = (parseFloat($(event.target).val().replace(',', '')) || 0.00) * 100.00
37
- $(event.target).siblings("input[type='hidden']").first().val(value.toFixed(0))
@@ -1,3 +1,3 @@
1
1
  module EffectiveFormInputs
2
- VERSION = '0.8.3'.freeze
2
+ VERSION = '0.8.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_form_inputs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails