autonumeric-rails 1.9.25.0 → 1.9.27
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/autonumeric-rails.gemspec +1 -1
- data/lib/autonumeric/rails/version.rb +1 -1
- data/spec/autonumeric-rails_spec.rb +0 -91
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/support/shared_examples.rb +88 -0
- data/vendor/assets/javascripts/{autoNumeric-1.9.25.js → autoNumeric-1.9.27.js} +119 -111
- data/vendor/assets/javascripts/autonumeric.js +1 -1
- data/vendor/assets/javascripts/autonumeric_ujs.js +1 -1
- metadata +33 -8
- checksums.yaml +0 -15
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -67,7 +67,7 @@ $(document).trigger('refresh_autonumeric');
|
|
67
67
|
## Internal
|
68
68
|
|
69
69
|
Autonumeric-rails creates in the DOM an hidden input with the same name as the text field.
|
70
|
-
On each modification of the text field value (
|
70
|
+
On each modification of the text field value (on `keyup` and `blue` events), the hidden input is updated with the sanitized value.
|
71
71
|
When validating the form, the hidden field value is sent to the server as it is located after the text field in the DOM.
|
72
72
|
|
73
73
|
## Changes
|
data/autonumeric-rails.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
23
|
spec.add_development_dependency 'rake'
|
24
|
-
spec.add_development_dependency 'rails', '~> 4.0
|
24
|
+
spec.add_development_dependency 'rails', '~> 4.2.0'
|
25
25
|
spec.add_development_dependency 'sqlite3'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'rspec-rails'
|
@@ -1,96 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
shared_examples 'all autonumeric-rails tests' do
|
4
|
-
context 'Without DB' do
|
5
|
-
let(:record_id) { '' }
|
6
|
-
|
7
|
-
it 'Input tag' do
|
8
|
-
assert_selector("input#record_field1[name='record[field1]'][data-autonumeric='true']")
|
9
|
-
assert_selector("input#record_field2[name='record[field2]'][data-autonumeric='#{params}']")
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'Hidden tags' do
|
13
|
-
assert_selector("input#record_field1_val[name='record[field1]'][type='hidden']")
|
14
|
-
assert_selector("input#record_field2_val[name='record[field2]'][type='hidden']")
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'Hidden tag is located after Input tag' do
|
18
|
-
find(:xpath, ".//*[@id='record_field1']/following-sibling::*[1]")['id'].should eq('record_field1_val')
|
19
|
-
find(:xpath, ".//*[@id='record_field2']/following-sibling::*[1]")['id'].should eq('record_field2_val')
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'Set empty default values' do
|
23
|
-
find('#record_field1').value.should eq('')
|
24
|
-
find('#record_field1_val').value.should eq('')
|
25
|
-
|
26
|
-
find('#record_field2').value.should eq('')
|
27
|
-
find('#record_field2_val').value.should eq('')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'Typing value updates hidden field value' do
|
31
|
-
find('#record_field1').set '12345'
|
32
|
-
find('#record_field2').set '54321.987'
|
33
|
-
|
34
|
-
find('#record_field1').value.should eq('12,345.00')
|
35
|
-
find('#record_field1_val').value.should eq('12345')
|
36
|
-
|
37
|
-
find('#record_field2').value.should eq('USD 54,321.9')
|
38
|
-
find('#record_field2_val').value.should eq('54321.9')
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'Creates record without values' do
|
42
|
-
click_button 'Go'
|
43
|
-
|
44
|
-
from_db = Record.last
|
45
|
-
from_db.field1.should eq(nil)
|
46
|
-
from_db.field2.should eq(nil)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'Creates record with values' do
|
50
|
-
find('#record_field1').set '122333'
|
51
|
-
find('#record_field2').set '4444.5'
|
52
|
-
click_button 'Go'
|
53
|
-
|
54
|
-
from_db = Record.last
|
55
|
-
from_db.field1.should eq(122333)
|
56
|
-
from_db.field2.should eq(4444.5)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'With DB record' do
|
61
|
-
let(:record) { Record.create field1: 112233, field2: 445566.7 }
|
62
|
-
let(:record_id) { "/#{record.id}" }
|
63
|
-
|
64
|
-
it 'Loads record and set values' do
|
65
|
-
find('#record_field1').value.should eq('112,233.00')
|
66
|
-
find('#record_field1_val').value.should eq('112233')
|
67
|
-
|
68
|
-
find('#record_field2').value.should eq('USD 445,566.7')
|
69
|
-
find('#record_field2_val').value.should eq('445566.7')
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'Without modifying values' do
|
73
|
-
click_button 'Go'
|
74
|
-
|
75
|
-
from_db = Record.find record.id
|
76
|
-
from_db.field1.should eq(112233)
|
77
|
-
from_db.field2.should eq(445566.7)
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'Updates record' do
|
81
|
-
find('#record_field1').set '332211'
|
82
|
-
find('#record_field2').set '776655.4'
|
83
|
-
click_button 'Go'
|
84
|
-
|
85
|
-
from_db = Record.find record.id
|
86
|
-
from_db.field1.should eq(332211)
|
87
|
-
from_db.field2.should eq(776655.4)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
3
|
describe 'Autonumeric-rails', type: :feature, js: true do
|
95
4
|
|
96
5
|
subject { page }
|
@@ -20,7 +20,7 @@ Dummy::Application.configure do
|
|
20
20
|
# config.action_dispatch.rack_cache = true
|
21
21
|
|
22
22
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.
|
23
|
+
config.serve_static_files = false
|
24
24
|
|
25
25
|
# Compress JavaScripts and CSS.
|
26
26
|
config.assets.js_compressor = :uglifier
|
@@ -13,7 +13,7 @@ Dummy::Application.configure do
|
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
config.
|
16
|
+
config.serve_static_files = true
|
17
17
|
config.static_cache_control = "public, max-age=3600"
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
@@ -0,0 +1,88 @@
|
|
1
|
+
shared_examples 'all autonumeric-rails tests' do
|
2
|
+
context 'Without DB' do
|
3
|
+
let(:record_id) { '' }
|
4
|
+
|
5
|
+
it 'Input tag' do
|
6
|
+
assert_selector("input#record_field1[name='record[field1]'][data-autonumeric='true']")
|
7
|
+
assert_selector("input#record_field2[name='record[field2]'][data-autonumeric='#{params}']")
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'Hidden tags' do
|
11
|
+
assert_selector("input#record_field1_val[name='record[field1]'][type='hidden']")
|
12
|
+
assert_selector("input#record_field2_val[name='record[field2]'][type='hidden']")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'Hidden tag is located after Input tag' do
|
16
|
+
expect(find(:xpath, ".//*[@id='record_field1']/following-sibling::*[1]")['id']).to eq('record_field1_val')
|
17
|
+
expect(find(:xpath, ".//*[@id='record_field2']/following-sibling::*[1]")['id']).to eq('record_field2_val')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'Set empty default values' do
|
21
|
+
expect(find('#record_field1').value).to eq('')
|
22
|
+
expect(find('#record_field1_val').value).to eq('')
|
23
|
+
|
24
|
+
expect(find('#record_field2').value).to eq('')
|
25
|
+
expect(find('#record_field2_val').value).to eq('')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'Typing value updates hidden field value' do
|
29
|
+
find('#record_field1').set '12345'
|
30
|
+
find('#record_field2').set '54321.987'
|
31
|
+
|
32
|
+
expect(find('#record_field1').value).to eq('12,345.00')
|
33
|
+
expect(find('#record_field1_val').value).to eq('12345')
|
34
|
+
|
35
|
+
expect(find('#record_field2').value).to eq('USD 54,321.9')
|
36
|
+
expect(find('#record_field2_val').value).to eq('54321.9')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'Creates record without values' do
|
40
|
+
click_button 'Go'
|
41
|
+
|
42
|
+
from_db = Record.last
|
43
|
+
expect(from_db.field1).to eq(nil)
|
44
|
+
expect(from_db.field2).to eq(nil)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'Creates record with values' do
|
48
|
+
find('#record_field1').set '122333'
|
49
|
+
find('#record_field2').set '4444.5'
|
50
|
+
click_button 'Go'
|
51
|
+
|
52
|
+
from_db = Record.last
|
53
|
+
expect(from_db.field1).to eq(122333)
|
54
|
+
expect(from_db.field2).to eq(4444.5)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'With DB record' do
|
59
|
+
let(:record) { Record.create field1: 112233, field2: 445566.7 }
|
60
|
+
let(:record_id) { "/#{record.id}" }
|
61
|
+
|
62
|
+
it 'Loads record and set values' do
|
63
|
+
expect(find('#record_field1').value).to eq('112,233.00')
|
64
|
+
expect(find('#record_field1_val').value).to eq('112233')
|
65
|
+
|
66
|
+
expect(find('#record_field2').value).to eq('USD 445,566.7')
|
67
|
+
expect(find('#record_field2_val').value).to eq('445566.7')
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'Without modifying values' do
|
71
|
+
click_button 'Go'
|
72
|
+
|
73
|
+
from_db = Record.find record.id
|
74
|
+
expect(from_db.field1).to eq(112233)
|
75
|
+
expect(from_db.field2).to eq(445566.7)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'Updates record' do
|
79
|
+
find('#record_field1').set '332211'
|
80
|
+
find('#record_field2').set '776655.4'
|
81
|
+
click_button 'Go'
|
82
|
+
|
83
|
+
from_db = Record.find record.id
|
84
|
+
expect(from_db.field1).to eq(332211)
|
85
|
+
expect(from_db.field2).to eq(776655.4)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* autoNumeric.js
|
3
3
|
* @author: Bob Knothe
|
4
4
|
* @author: Sokolov Yura
|
5
|
-
* @version: 1.9.
|
5
|
+
* @version: 1.9.27 - 2014-12-07 GMT 5:30 PM
|
6
6
|
*
|
7
7
|
* Created by Robert J. Knothe on 2010-10-25. Please report any bugs to https://github.com/BobKnothe/autoNumeric
|
8
8
|
* Created by Sokolov Yura on 2010-11-07
|
@@ -850,105 +850,7 @@
|
|
850
850
|
settings = $this.data('autoNumeric'), /** attempt to grab 'autoNumeric' settings, if they don't exist returns "undefined". */
|
851
851
|
tagData = $this.data(); /** attempt to grab HTML5 data, if they don't exist we'll get "undefined".*/
|
852
852
|
if (typeof settings !== 'object') { /** If we couldn't grab settings, create them from defaults and passed options. */
|
853
|
-
|
854
|
-
/** allowed numeric values
|
855
|
-
* please do not modify
|
856
|
-
*/
|
857
|
-
aNum: '0123456789',
|
858
|
-
/** allowed thousand separator characters
|
859
|
-
* comma = ','
|
860
|
-
* period "full stop" = '.'
|
861
|
-
* apostrophe is escaped = '\''
|
862
|
-
* space = ' '
|
863
|
-
* none = ''
|
864
|
-
* NOTE: do not use numeric characters
|
865
|
-
*/
|
866
|
-
aSep: ',',
|
867
|
-
/** digital grouping for the thousand separator used in Format
|
868
|
-
* dGroup: '2', results in 99,99,99,999 common in India for values less than 1 billion and greater than -1 billion
|
869
|
-
* dGroup: '3', results in 999,999,999 default
|
870
|
-
* dGroup: '4', results in 9999,9999,9999 used in some Asian countries
|
871
|
-
*/
|
872
|
-
dGroup: '3',
|
873
|
-
/** allowed decimal separator characters
|
874
|
-
* period "full stop" = '.'
|
875
|
-
* comma = ','
|
876
|
-
*/
|
877
|
-
aDec: '.',
|
878
|
-
/** allow to declare alternative decimal separator which is automatically replaced by aDec
|
879
|
-
* developed for countries the use a comma ',' as the decimal character
|
880
|
-
* and have keyboards\numeric pads that have a period 'full stop' as the decimal characters (Spain is an example)
|
881
|
-
*/
|
882
|
-
altDec: null,
|
883
|
-
/** allowed currency symbol
|
884
|
-
* Must be in quotes aSign: '$', a space is allowed aSign: '$ '
|
885
|
-
*/
|
886
|
-
aSign: '',
|
887
|
-
/** placement of currency sign
|
888
|
-
* for prefix pSign: 'p',
|
889
|
-
* for suffix pSign: 's',
|
890
|
-
*/
|
891
|
-
pSign: 'p',
|
892
|
-
/** maximum possible value
|
893
|
-
* value must be enclosed in quotes and use the period for the decimal point
|
894
|
-
* value must be larger than vMin
|
895
|
-
*/
|
896
|
-
vMax: '9999999999999.99',
|
897
|
-
/** minimum possible value
|
898
|
-
* value must be enclosed in quotes and use the period for the decimal point
|
899
|
-
* value must be smaller than vMax
|
900
|
-
*/
|
901
|
-
vMin: '0.00',
|
902
|
-
/** max number of decimal places = used to override decimal places set by the vMin & vMax values
|
903
|
-
* value must be enclosed in quotes example mDec: '3',
|
904
|
-
* This can also set the value via a call back function mDec: 'css:#
|
905
|
-
*/
|
906
|
-
mDec: null,
|
907
|
-
/** method used for rounding
|
908
|
-
* mRound: 'S', Round-Half-Up Symmetric (default)
|
909
|
-
* mRound: 'A', Round-Half-Up Asymmetric
|
910
|
-
* mRound: 's', Round-Half-Down Symmetric (lower case s)
|
911
|
-
* mRound: 'a', Round-Half-Down Asymmetric (lower case a)
|
912
|
-
* mRound: 'B', Round-Half-Even "Bankers Rounding"
|
913
|
-
* mRound: 'U', Round Up "Round-Away-From-Zero"
|
914
|
-
* mRound: 'D', Round Down "Round-Toward-Zero" - same as truncate
|
915
|
-
* mRound: 'C', Round to Ceiling "Toward Positive Infinity"
|
916
|
-
* mRound: 'F', Round to Floor "Toward Negative Infinity"
|
917
|
-
*/
|
918
|
-
mRound: 'S',
|
919
|
-
/** controls decimal padding
|
920
|
-
* aPad: true - always Pad decimals with zeros
|
921
|
-
* aPad: false - does not pad with zeros.
|
922
|
-
* aPad: `some number` - pad decimals with zero to number different from mDec
|
923
|
-
* thanks to Jonas Johansson for the suggestion
|
924
|
-
*/
|
925
|
-
aPad: true,
|
926
|
-
/** places brackets on negative value -$ 999.99 to (999.99)
|
927
|
-
* visible only when the field does NOT have focus the left and right symbols should be enclosed in quotes and seperated by a comma
|
928
|
-
* nBracket: null, nBracket: '(,)', nBracket: '[,]', nBracket: '<,>' or nBracket: '{,}'
|
929
|
-
*/
|
930
|
-
nBracket: null,
|
931
|
-
/** Displayed on empty string
|
932
|
-
* wEmpty: 'empty', - input can be blank
|
933
|
-
* wEmpty: 'zero', - displays zero
|
934
|
-
* wEmpty: 'sign', - displays the currency sign
|
935
|
-
*/
|
936
|
-
wEmpty: 'empty',
|
937
|
-
/** controls leading zero behavior
|
938
|
-
* lZero: 'allow', - allows leading zeros to be entered. Zeros will be truncated when entering additional digits. On focusout zeros will be deleted.
|
939
|
-
* lZero: 'deny', - allows only one leading zero on values less than one
|
940
|
-
* lZero: 'keep', - allows leading zeros to be entered. on fousout zeros will be retained.
|
941
|
-
*/
|
942
|
-
lZero: 'allow',
|
943
|
-
/** determine if the default value will be formatted on page ready.
|
944
|
-
* true = automatically formats the default value on page ready
|
945
|
-
* false = will not format the default value
|
946
|
-
*/
|
947
|
-
aForm: true,
|
948
|
-
/** future use */
|
949
|
-
onSomeEvent: function () {}
|
950
|
-
};
|
951
|
-
settings = $.extend({}, defaults, tagData, options); /** Merge defaults, tagData and options */
|
853
|
+
settings = $.extend({}, $.fn.autoNumeric.defaults, tagData, options); /** Merge defaults, tagData and options */
|
952
854
|
if (settings.aDec === settings.aSep) {
|
953
855
|
$.error("autoNumeric will not function properly when the decimal character aDec: '" + settings.aDec + "' and thousand separator aSep: '" + settings.aSep + "' are the same character");
|
954
856
|
return this;
|
@@ -974,7 +876,7 @@
|
|
974
876
|
$this[0].value = settings.aSign;
|
975
877
|
setValue = false;
|
976
878
|
}
|
977
|
-
if (setValue) {
|
879
|
+
if (setValue && $this[0].value.indexOf(settings.aSep) === -1) {
|
978
880
|
$this.autoNumeric('set', $this.val());
|
979
881
|
}
|
980
882
|
}
|
@@ -1238,13 +1140,15 @@
|
|
1238
1140
|
$this = autoGet($(this)),
|
1239
1141
|
str = $this.serialize(),
|
1240
1142
|
parts = str.split('&'),
|
1143
|
+
formIndex = $('form').index($this),
|
1241
1144
|
i = 0;
|
1242
1145
|
for (i; i < parts.length; i += 1) {
|
1243
|
-
var miniParts = parts[i].split('=')
|
1244
|
-
|
1146
|
+
var miniParts = parts[i].split('='),
|
1147
|
+
$field = $('form:eq(' + formIndex + ') input[name="' + decodeURIComponent(miniParts[0]) + '"]'),
|
1148
|
+
settings = $field.data('autoNumeric');
|
1245
1149
|
if (typeof settings === 'object') {
|
1246
|
-
if (miniParts[1] !== null
|
1247
|
-
miniParts[1] = $
|
1150
|
+
if (miniParts[1] !== null) {
|
1151
|
+
miniParts[1] = $field.autoNumeric('get');
|
1248
1152
|
parts[i] = miniParts.join('=');
|
1249
1153
|
isAutoNumeric = true;
|
1250
1154
|
}
|
@@ -1259,20 +1163,23 @@
|
|
1259
1163
|
getArray: function () {
|
1260
1164
|
var isAutoNumeric = false,
|
1261
1165
|
$this = autoGet($(this)),
|
1262
|
-
formFields = $this.serializeArray()
|
1166
|
+
formFields = $this.serializeArray(),
|
1167
|
+
formIndex = $('form').index($this);
|
1168
|
+
/*jslint unparam: true*/
|
1263
1169
|
$.each(formFields, function (i, field) {
|
1264
|
-
var
|
1170
|
+
var $field = $('form:eq(' + formIndex + ') input[name="' + decodeURIComponent(field.name) + '"]'),
|
1171
|
+
settings = $field.data('autoNumeric');
|
1265
1172
|
if (typeof settings === 'object') {
|
1266
|
-
if (field.value !== ''
|
1267
|
-
field.value = $
|
1173
|
+
if (field.value !== '') {
|
1174
|
+
field.value = $field.autoNumeric('get').toString();
|
1268
1175
|
}
|
1269
1176
|
isAutoNumeric = true;
|
1270
1177
|
}
|
1271
1178
|
});
|
1179
|
+
/*jslint unparam: false*/
|
1272
1180
|
if (isAutoNumeric === true) {
|
1273
1181
|
return formFields;
|
1274
1182
|
}
|
1275
|
-
$.error("You must initialize autoNumeric('init', {options}) prior to calling the 'getArray' method");
|
1276
1183
|
return this;
|
1277
1184
|
},
|
1278
1185
|
/** returns the settings object for those who need to look under the hood */
|
@@ -1290,4 +1197,105 @@
|
|
1290
1197
|
}
|
1291
1198
|
$.error('Method "' + method + '" is not supported by autoNumeric()');
|
1292
1199
|
};
|
1293
|
-
|
1200
|
+
|
1201
|
+
/* Make defaults public */
|
1202
|
+
$.fn.autoNumeric.defaults = {
|
1203
|
+
/** allowed numeric values
|
1204
|
+
* please do not modify
|
1205
|
+
*/
|
1206
|
+
aNum: '0123456789',
|
1207
|
+
/** allowed thousand separator characters
|
1208
|
+
* comma = ','
|
1209
|
+
* period "full stop" = '.'
|
1210
|
+
* apostrophe is escaped = '\''
|
1211
|
+
* space = ' '
|
1212
|
+
* none = ''
|
1213
|
+
* NOTE: do not use numeric characters
|
1214
|
+
*/
|
1215
|
+
aSep: ',',
|
1216
|
+
/** digital grouping for the thousand separator used in Format
|
1217
|
+
* dGroup: '2', results in 99,99,99,999 common in India for values less than 1 billion and greater than -1 billion
|
1218
|
+
* dGroup: '3', results in 999,999,999 default
|
1219
|
+
* dGroup: '4', results in 9999,9999,9999 used in some Asian countries
|
1220
|
+
*/
|
1221
|
+
dGroup: '3',
|
1222
|
+
/** allowed decimal separator characters
|
1223
|
+
* period "full stop" = '.'
|
1224
|
+
* comma = ','
|
1225
|
+
*/
|
1226
|
+
aDec: '.',
|
1227
|
+
/** allow to declare alternative decimal separator which is automatically replaced by aDec
|
1228
|
+
* developed for countries the use a comma ',' as the decimal character
|
1229
|
+
* and have keyboards\numeric pads that have a period 'full stop' as the decimal characters (Spain is an example)
|
1230
|
+
*/
|
1231
|
+
altDec: null,
|
1232
|
+
/** allowed currency symbol
|
1233
|
+
* Must be in quotes aSign: '$', a space is allowed aSign: '$ '
|
1234
|
+
*/
|
1235
|
+
aSign: '',
|
1236
|
+
/** placement of currency sign
|
1237
|
+
* for prefix pSign: 'p',
|
1238
|
+
* for suffix pSign: 's',
|
1239
|
+
*/
|
1240
|
+
pSign: 'p',
|
1241
|
+
/** maximum possible value
|
1242
|
+
* value must be enclosed in quotes and use the period for the decimal point
|
1243
|
+
* value must be larger than vMin
|
1244
|
+
*/
|
1245
|
+
vMax: '9999999999999.99',
|
1246
|
+
/** minimum possible value
|
1247
|
+
* value must be enclosed in quotes and use the period for the decimal point
|
1248
|
+
* value must be smaller than vMax
|
1249
|
+
*/
|
1250
|
+
vMin: '0.00',
|
1251
|
+
/** max number of decimal places = used to override decimal places set by the vMin & vMax values
|
1252
|
+
* value must be enclosed in quotes example mDec: '3',
|
1253
|
+
* This can also set the value via a call back function mDec: 'css:#
|
1254
|
+
*/
|
1255
|
+
mDec: null,
|
1256
|
+
/** method used for rounding
|
1257
|
+
* mRound: 'S', Round-Half-Up Symmetric (default)
|
1258
|
+
* mRound: 'A', Round-Half-Up Asymmetric
|
1259
|
+
* mRound: 's', Round-Half-Down Symmetric (lower case s)
|
1260
|
+
* mRound: 'a', Round-Half-Down Asymmetric (lower case a)
|
1261
|
+
* mRound: 'B', Round-Half-Even "Bankers Rounding"
|
1262
|
+
* mRound: 'U', Round Up "Round-Away-From-Zero"
|
1263
|
+
* mRound: 'D', Round Down "Round-Toward-Zero" - same as truncate
|
1264
|
+
* mRound: 'C', Round to Ceiling "Toward Positive Infinity"
|
1265
|
+
* mRound: 'F', Round to Floor "Toward Negative Infinity"
|
1266
|
+
*/
|
1267
|
+
mRound: 'S',
|
1268
|
+
/** controls decimal padding
|
1269
|
+
* aPad: true - always Pad decimals with zeros
|
1270
|
+
* aPad: false - does not pad with zeros.
|
1271
|
+
* aPad: `some number` - pad decimals with zero to number different from mDec
|
1272
|
+
* thanks to Jonas Johansson for the suggestion
|
1273
|
+
*/
|
1274
|
+
aPad: true,
|
1275
|
+
/** places brackets on negative value -$ 999.99 to (999.99)
|
1276
|
+
* visible only when the field does NOT have focus the left and right symbols should be enclosed in quotes and seperated by a comma
|
1277
|
+
* nBracket: null, nBracket: '(,)', nBracket: '[,]', nBracket: '<,>' or nBracket: '{,}'
|
1278
|
+
*/
|
1279
|
+
nBracket: null,
|
1280
|
+
/** Displayed on empty string
|
1281
|
+
* wEmpty: 'empty', - input can be blank
|
1282
|
+
* wEmpty: 'zero', - displays zero
|
1283
|
+
* wEmpty: 'sign', - displays the currency sign
|
1284
|
+
*/
|
1285
|
+
wEmpty: 'empty',
|
1286
|
+
/** controls leading zero behavior
|
1287
|
+
* lZero: 'allow', - allows leading zeros to be entered. Zeros will be truncated when entering additional digits. On focusout zeros will be deleted.
|
1288
|
+
* lZero: 'deny', - allows only one leading zero on values less than one
|
1289
|
+
* lZero: 'keep', - allows leading zeros to be entered. on fousout zeros will be retained.
|
1290
|
+
*/
|
1291
|
+
lZero: 'allow',
|
1292
|
+
/** determine if the default value will be formatted on page ready.
|
1293
|
+
* true = automatically formats the default value on page ready
|
1294
|
+
* false = will not format the default value
|
1295
|
+
*/
|
1296
|
+
aForm: true,
|
1297
|
+
/** future use */
|
1298
|
+
onSomeEvent: function () { }
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
}(jQuery));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//= require autoNumeric-1.9.
|
1
|
+
//= require autoNumeric-1.9.27.js
|
2
2
|
//= require autonumeric_ujs.js
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autonumeric-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.27
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- randoum
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: jquery-rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: bundler
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rake
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ! '>='
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ! '>='
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,20 +62,23 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: rails
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.0
|
69
|
+
version: 4.2.0
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.0
|
77
|
+
version: 4.2.0
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: sqlite3
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ! '>='
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ! '>='
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: rspec-rails
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -97,6 +110,7 @@ dependencies:
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: rspec-html-matchers
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
115
|
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
@@ -104,6 +118,7 @@ dependencies:
|
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
@@ -111,6 +126,7 @@ dependencies:
|
|
111
126
|
- !ruby/object:Gem::Dependency
|
112
127
|
name: database_cleaner
|
113
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
114
130
|
requirements:
|
115
131
|
- - ! '>='
|
116
132
|
- !ruby/object:Gem::Version
|
@@ -118,6 +134,7 @@ dependencies:
|
|
118
134
|
type: :development
|
119
135
|
prerelease: false
|
120
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
121
138
|
requirements:
|
122
139
|
- - ! '>='
|
123
140
|
- !ruby/object:Gem::Version
|
@@ -125,6 +142,7 @@ dependencies:
|
|
125
142
|
- !ruby/object:Gem::Dependency
|
126
143
|
name: capybara
|
127
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
128
146
|
requirements:
|
129
147
|
- - ! '>='
|
130
148
|
- !ruby/object:Gem::Version
|
@@ -132,6 +150,7 @@ dependencies:
|
|
132
150
|
type: :development
|
133
151
|
prerelease: false
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
135
154
|
requirements:
|
136
155
|
- - ! '>='
|
137
156
|
- !ruby/object:Gem::Version
|
@@ -139,6 +158,7 @@ dependencies:
|
|
139
158
|
- !ruby/object:Gem::Dependency
|
140
159
|
name: selenium-webdriver
|
141
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
142
162
|
requirements:
|
143
163
|
- - ! '>='
|
144
164
|
- !ruby/object:Gem::Version
|
@@ -146,6 +166,7 @@ dependencies:
|
|
146
166
|
type: :development
|
147
167
|
prerelease: false
|
148
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
149
170
|
requirements:
|
150
171
|
- - ! '>='
|
151
172
|
- !ruby/object:Gem::Version
|
@@ -153,6 +174,7 @@ dependencies:
|
|
153
174
|
- !ruby/object:Gem::Dependency
|
154
175
|
name: headless
|
155
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
156
178
|
requirements:
|
157
179
|
- - ! '>='
|
158
180
|
- !ruby/object:Gem::Version
|
@@ -160,6 +182,7 @@ dependencies:
|
|
160
182
|
type: :development
|
161
183
|
prerelease: false
|
162
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
163
186
|
requirements:
|
164
187
|
- - ! '>='
|
165
188
|
- !ruby/object:Gem::Version
|
@@ -229,32 +252,34 @@ files:
|
|
229
252
|
- spec/dummy/public/500.html
|
230
253
|
- spec/dummy/public/favicon.ico
|
231
254
|
- spec/spec_helper.rb
|
255
|
+
- spec/support/shared_examples.rb
|
232
256
|
- spec/support/wait_for_jquery.rb
|
233
|
-
- vendor/assets/javascripts/autoNumeric-1.9.
|
257
|
+
- vendor/assets/javascripts/autoNumeric-1.9.27.js
|
234
258
|
- vendor/assets/javascripts/autonumeric.js
|
235
259
|
- vendor/assets/javascripts/autonumeric_ujs.js
|
236
260
|
homepage: https://github.com/randoum/autonumeric-rails
|
237
261
|
licenses:
|
238
262
|
- MIT
|
239
|
-
metadata: {}
|
240
263
|
post_install_message:
|
241
264
|
rdoc_options: []
|
242
265
|
require_paths:
|
243
266
|
- lib
|
244
267
|
required_ruby_version: !ruby/object:Gem::Requirement
|
268
|
+
none: false
|
245
269
|
requirements:
|
246
270
|
- - ! '>='
|
247
271
|
- !ruby/object:Gem::Version
|
248
272
|
version: '0'
|
249
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
|
+
none: false
|
250
275
|
requirements:
|
251
276
|
- - ! '>='
|
252
277
|
- !ruby/object:Gem::Version
|
253
278
|
version: '0'
|
254
279
|
requirements: []
|
255
280
|
rubyforge_project:
|
256
|
-
rubygems_version:
|
281
|
+
rubygems_version: 1.8.23.2
|
257
282
|
signing_key:
|
258
|
-
specification_version:
|
283
|
+
specification_version: 3
|
259
284
|
summary: Wrap autoNumeric.js library ready-to-use for rails
|
260
285
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
MWI4OTNmOTc4NWM1ZTM0MzQ2ZmZlYjBkN2I5MWFiY2JlZjlmMzA2OA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NmY5Zjc5Zjc5ODFiOWJhYmVlOGM1MTg4NmQyYWViYjViNTI5ZDEwZg==
|
7
|
-
SHA512:
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
YzZhYjUwOTgzZTMzNGM1NWU0NzE1ODVkYzAwOGZmNzhlMmRiNWU4MGU3YmNj
|
10
|
-
OTBhYTY4ZmJjMTUzNGQzYTMwMjJiYTcxMGE0NjFjZjRmMjExNDgwMDJmNGQ1
|
11
|
-
ZjFjOWUwMmMwNzZmNGEwOTAwMzNjNzhkYjA4ZGVmZGVkNGNmOTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
N2U5YmEwOWUzMWQ2MTljMmZhZTZlZjQ0ZTM4Yjg2OWNjZmZmM2E1NWUzNGZm
|
14
|
-
MmFlY2Y1MmIyOWFkYTM2YzhhODZkNDJiYmNmMDA5YTAwYmVjMjIwNzY1OTk3
|
15
|
-
YjIxYzMxYTQ0ZWVlMjJmZjJmZTIyOTIzMDBhZmY1ZGM3NTM3YzY=
|