autonumeric-rails 0.1.9.17 → 1.9.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +3 -1
  2. data/.rspec +2 -0
  3. data/CHANGELOG.md +15 -0
  4. data/README.md +12 -2
  5. data/Rakefile +9 -1
  6. data/autonumeric-rails.gemspec +10 -0
  7. data/lib/autonumeric/rails/version.rb +1 -1
  8. data/spec/autonumeric-rails_spec.rb +113 -0
  9. data/spec/dummy/.rspec +1 -0
  10. data/spec/dummy/README.rdoc +28 -0
  11. data/spec/dummy/Rakefile +6 -0
  12. data/spec/dummy/app/assets/images/.keep +0 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +14 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/spec/dummy/app/controllers/application_controller.rb +15 -0
  16. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  17. data/spec/dummy/app/controllers/forms_controller.rb +12 -0
  18. data/spec/dummy/app/controllers/records_controller.rb +17 -0
  19. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  20. data/spec/dummy/app/mailers/.keep +0 -0
  21. data/spec/dummy/app/models/.keep +0 -0
  22. data/spec/dummy/app/models/concerns/.keep +0 -0
  23. data/spec/dummy/app/models/record.rb +2 -0
  24. data/spec/dummy/app/views/forms/dynamic_field.html.erb +16 -0
  25. data/spec/dummy/app/views/forms/through_form_helper.html.erb +5 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +27 -0
  32. data/spec/dummy/config/boot.rb +5 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +29 -0
  36. data/spec/dummy/config/environments/production.rb +80 -0
  37. data/spec/dummy/config/environments/test.rb +36 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +9 -0
  47. data/spec/dummy/db/development.sqlite3 +0 -0
  48. data/spec/dummy/db/migrate/20131227002328_create_records.rb +8 -0
  49. data/spec/dummy/db/schema.rb +21 -0
  50. data/spec/dummy/db/test.sqlite3 +0 -0
  51. data/spec/dummy/lib/assets/.keep +0 -0
  52. data/spec/dummy/log/.keep +0 -0
  53. data/spec/dummy/public/404.html +58 -0
  54. data/spec/dummy/public/422.html +58 -0
  55. data/spec/dummy/public/500.html +57 -0
  56. data/spec/dummy/public/favicon.ico +0 -0
  57. data/spec/spec_helper.rb +50 -0
  58. data/spec/support/general.rb +8 -0
  59. data/vendor/assets/javascripts/{autoNumeric-1.9.17.js → autoNumeric-1.9.18.js} +3 -3
  60. data/vendor/assets/javascripts/autonumeric.js +1 -1
  61. data/vendor/assets/javascripts/autonumeric_ujs.js +40 -16
  62. metadata +186 -3
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,50 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ # Load environment
4
+ require File.expand_path('../dummy/config/environment', __FILE__)
5
+
6
+ require 'rspec/rails'
7
+ #require 'rspec/autorun'
8
+
9
+ # Requires support files
10
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
11
+
12
+ # Load database cleaner
13
+ require 'database_cleaner'
14
+
15
+ # Load capybara and its dependencies
16
+ require 'capybara/rspec'
17
+ require 'capybara/rails'
18
+ require 'headless'
19
+
20
+ # Capybara to consider hidden elements
21
+ Capybara.ignore_hidden_elements = false
22
+
23
+ RSpec.configure do |config|
24
+ # Use fixtures
25
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
26
+
27
+ # Let database cleaner do the DB cleaning job
28
+ config.use_transactional_fixtures = false
29
+
30
+ # Infer anonymous controllers
31
+ config.infer_base_class_for_anonymous_controllers = false
32
+
33
+ # Run specs in random order
34
+ config.order = 'random'
35
+
36
+ # Database cleaner config
37
+ config.before(:suite) {
38
+ DatabaseCleaner.strategy = :truncation
39
+ DatabaseCleaner.clean_with :truncation
40
+ }
41
+ config.before(:each) { DatabaseCleaner.start }
42
+ config.after(:each) { DatabaseCleaner.clean }
43
+
44
+ # Headless for selenium driver
45
+ config.before(:each, js: true) {
46
+ headless = Headless.new
47
+ headless.start
48
+ at_exit { headless.destroy }
49
+ }
50
+ end
@@ -0,0 +1,8 @@
1
+ def wait_for_jquery
2
+ counter = 0
3
+ while page.execute_script('return $.active').to_i > 0
4
+ counter += 1
5
+ sleep(0.1)
6
+ raise 'Interrupted: JQuery activity took longer than 5 seconds.' if counter >= 50
7
+ end
8
+ end
@@ -2,7 +2,7 @@
2
2
  * autoNumeric.js
3
3
  * @author: Bob Knothe
4
4
  * @author: Sokolov Yura aka funny_falcon
5
- * @version: 1.9.17 - 2013-09-28 GMT 9:00 AM
5
+ * @version: 1.9.18 - 2013-12-03 GMT 9:00 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
@@ -1117,11 +1117,11 @@
1117
1117
  return this;
1118
1118
  }
1119
1119
  /** allows locale decimal separator to be a comma */
1120
- if (testValue === $this.attr('value')) {
1120
+ if ((testValue === $this.attr('value') || testValue === $this.text()) && settings.runOnce === false) {
1121
1121
  value = value.replace(',', '.');
1122
1122
  }
1123
1123
  /** routine to handle page re-load from back button */
1124
- if (testValue !== $this.attr('value') && settings.runOnce === false) {
1124
+ if (testValue !== $this.attr('value') && $this.prop('tagName') === 'INPUT' && settings.runOnce === false) {
1125
1125
  value = autoStrip(value, settings);
1126
1126
  }
1127
1127
  /** returns a empty string if the value being 'set' contains non-numeric characters and or more than decimal point (full stop) and will not be formatted */
@@ -1,2 +1,2 @@
1
- //= require autoNumeric-1.9.17.js
1
+ //= require autoNumeric-1.9.18.js
2
2
  //= require autonumeric_ujs.js
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * autonumeric_ujs.js
3
3
  * @author: randoum
4
- * @version: 0.1.9.15 - 2013-08-17
4
+ * @version: 1.9.18 - 2013-12-13
5
5
  *
6
- * Created by Robert J. Knothe on 2010-10-25. Please report any bugs to https://github.com/randoum/autonumeric-rails
6
+ * Created by Randoum on 2013-08-15. Please report any bugs to https://github.com/randoum/autonumeric-rails
7
7
  *
8
8
  * Wrap-up autoNumeric.js library to be used with Rails in a UJS flavor
9
9
  * All credits for autoNumeric library goes to its original creators
@@ -33,21 +33,45 @@
33
33
  * OTHER DEALINGS IN THE SOFTWARE.
34
34
  */
35
35
 
36
- jQuery(function() {
37
- var auto_numeric_init, update_numeric_value;
38
- update_numeric_value = function(input) {
39
- input.next().val(input.autoNumeric('get'));
36
+ var AutonumericRails;
37
+
38
+ window.AutonumericRails = AutonumericRails = (function() {
39
+ function AutonumericRails(field) {
40
+ this.field = field;
41
+ this.create_hidden_field();
42
+ this.init_autonumeric();
43
+ this.sanitize_value();
44
+ this.field.on('keyup', $.proxy(function() {
45
+ this.sanitize_value();
46
+ }, this));
47
+ }
48
+
49
+ AutonumericRails.prototype.create_hidden_field = function() {
50
+ this.hidden = $('<input>').attr('type', 'hidden').attr('id', this.field.attr('id') + '_val').attr('name', this.field.attr('name'));
51
+ this.hidden.insertAfter(this.field);
40
52
  };
41
- auto_numeric_init = function(input) {
42
- var hidden;
43
- hidden = $('<input>').attr('type', 'hidden').attr('id', input.attr('id') + '_val').attr('name', input.attr('name'));
44
- hidden.insertAfter(input);
45
- input.autoNumeric('init', $.parseJSON(input.attr('data-autonumeric')));
46
- input.on('keyup', function() {
47
- update_numeric_value(input);
48
- });
53
+
54
+ AutonumericRails.prototype.init_autonumeric = function() {
55
+ this.field.autoNumeric('init', $.parseJSON(this.field.attr('data-autonumeric')));
56
+ };
57
+
58
+ AutonumericRails.prototype.sanitize_value = function() {
59
+ this.hidden.val(this.field.autoNumeric('get'));
49
60
  };
61
+
62
+ return AutonumericRails;
63
+
64
+ })();
65
+
66
+ jQuery(function() {
50
67
  $('input[data-autonumeric]').each(function() {
51
- auto_numeric_init($(this));
68
+ new window.AutonumericRails($(this));
69
+ });
70
+ $(document).on('DOMNodeInserted', function(e) {
71
+ var element;
72
+ element = $(e.target);
73
+ if (element.attr('data-autonumeric')) {
74
+ new window.AutonumericRails(element);
75
+ }
52
76
  });
53
- });
77
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autonumeric-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.17
4
+ version: 1.9.18.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-10 00:00:00.000000000 Z
12
+ date: 2013-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
@@ -59,6 +59,134 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 4.0.2
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 4.0.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: sqlite3
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec-rails
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec-html-matchers
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: database_cleaner
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: capybara
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: selenium-webdriver
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: headless
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
62
190
  description: Rails ready-to-use autoNumeric.js library that automatically formats
63
191
  currency and numbers. All credits goes to the library creator BobKnothe
64
192
  email:
@@ -68,6 +196,8 @@ extensions: []
68
196
  extra_rdoc_files: []
69
197
  files:
70
198
  - .gitignore
199
+ - .rspec
200
+ - CHANGELOG.md
71
201
  - Gemfile
72
202
  - LICENSE.txt
73
203
  - README.md
@@ -77,7 +207,60 @@ files:
77
207
  - lib/autonumeric/rails.rb
78
208
  - lib/autonumeric/rails/engine.rb
79
209
  - lib/autonumeric/rails/version.rb
80
- - vendor/assets/javascripts/autoNumeric-1.9.17.js
210
+ - spec/autonumeric-rails_spec.rb
211
+ - spec/dummy/.rspec
212
+ - spec/dummy/README.rdoc
213
+ - spec/dummy/Rakefile
214
+ - spec/dummy/app/assets/images/.keep
215
+ - spec/dummy/app/assets/javascripts/application.js
216
+ - spec/dummy/app/assets/stylesheets/application.css
217
+ - spec/dummy/app/controllers/application_controller.rb
218
+ - spec/dummy/app/controllers/concerns/.keep
219
+ - spec/dummy/app/controllers/forms_controller.rb
220
+ - spec/dummy/app/controllers/records_controller.rb
221
+ - spec/dummy/app/helpers/application_helper.rb
222
+ - spec/dummy/app/mailers/.keep
223
+ - spec/dummy/app/models/.keep
224
+ - spec/dummy/app/models/concerns/.keep
225
+ - spec/dummy/app/models/record.rb
226
+ - spec/dummy/app/views/forms/dynamic_field.html.erb
227
+ - spec/dummy/app/views/forms/through_form_helper.html.erb
228
+ - spec/dummy/app/views/layouts/application.html.erb
229
+ - spec/dummy/bin/bundle
230
+ - spec/dummy/bin/rails
231
+ - spec/dummy/bin/rake
232
+ - spec/dummy/config.ru
233
+ - spec/dummy/config/application.rb
234
+ - spec/dummy/config/boot.rb
235
+ - spec/dummy/config/database.yml
236
+ - spec/dummy/config/environment.rb
237
+ - spec/dummy/config/environments/development.rb
238
+ - spec/dummy/config/environments/production.rb
239
+ - spec/dummy/config/environments/test.rb
240
+ - spec/dummy/config/initializers/backtrace_silencers.rb
241
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
242
+ - spec/dummy/config/initializers/inflections.rb
243
+ - spec/dummy/config/initializers/mime_types.rb
244
+ - spec/dummy/config/initializers/secret_token.rb
245
+ - spec/dummy/config/initializers/session_store.rb
246
+ - spec/dummy/config/initializers/wrap_parameters.rb
247
+ - spec/dummy/config/locales/en.yml
248
+ - spec/dummy/config/routes.rb
249
+ - spec/dummy/db/development.sqlite3
250
+ - spec/dummy/db/migrate/20131227002328_create_records.rb
251
+ - spec/dummy/db/schema.rb
252
+ - spec/dummy/db/test.sqlite3
253
+ - spec/dummy/lib/assets/.keep
254
+ - spec/dummy/log/.keep
255
+ - spec/dummy/log/development.log
256
+ - spec/dummy/log/test.log
257
+ - spec/dummy/public/404.html
258
+ - spec/dummy/public/422.html
259
+ - spec/dummy/public/500.html
260
+ - spec/dummy/public/favicon.ico
261
+ - spec/spec_helper.rb
262
+ - spec/support/general.rb
263
+ - vendor/assets/javascripts/autoNumeric-1.9.18.js
81
264
  - vendor/assets/javascripts/autonumeric.js
82
265
  - vendor/assets/javascripts/autonumeric_ujs.js
83
266
  homepage: https://github.com/randoum/autonumeric-rails