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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca7634f956f6ce0578dc9d87cc0f7459365fc1c
|
4
|
+
data.tar.gz: ed1f6645534ebcceaabab45387af836ce84d2dd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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))
|
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.
|
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-
|
11
|
+
date: 2015-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|