autonumeric-rails 1.9.22 → 1.9.22.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # 1.9.22.1
2
+
3
+ - Merge PR #4 "Sanitize hidden input on blur event" - Thanks to @tiagoamaro
4
+
1
5
  # 1.9.22
2
6
 
3
7
  - Update autoNumeric v 1.9.22
data/README.md CHANGED
@@ -12,36 +12,42 @@ autoNumeric.js home page and settings generator [http://www.decorplanit.com/plug
12
12
 
13
13
  The autonumeric-rails simply wrap up autoNumeric.js and in addition provides ujs flavor to autoNumeric.js
14
14
 
15
+ - [Installation](#installation)
16
+ - [Usage](#usage)
17
+ - [AJAX](#ajax)
18
+ - [Internal](#internal)
19
+ - [Changes](#changes)
20
+
15
21
  ## Installation
16
22
 
17
23
  Add this line to your application's Gemfile:
18
-
19
- gem 'autonumeric-rails'
20
-
24
+ ``` ruby
25
+ gem 'autonumeric-rails'
26
+ ```
21
27
  And then execute:
22
-
23
- $ bundle
24
-
28
+ ``` bash
29
+ bundle
30
+ ```
25
31
  Then add in your `javascript.js` manifest:
26
-
27
- //= require jquery
28
- //= require autonumeric
29
-
32
+ ```
33
+ //= require jquery
34
+ //= require autonumeric
35
+ ```
30
36
  ## Usage
31
37
 
32
38
  Simply add `data-autonumeric` attribute to your HTML tag to initialize autoNumeric
33
39
  with its default values:
34
-
35
- <%= form_for @model do |f| %>
36
- <%= f.text_field :field, data: {autonumeric: true} %>
37
- <% end %>
38
-
40
+ ``` erb
41
+ <%= form_for @model do |f| %>
42
+ <%= f.text_field :field, data: {autonumeric: true} %>
43
+ <% end %>
44
+ ```
39
45
  You can also pass autoNumeric configuration parameters directly with a Hash in your HTML tag:
40
-
41
- <%= form_for @model do |f| %>
42
- <%= f.text_field :field, data: {autonumeric: {aSign: 'USD ', mDec: 0}} %>
43
- <% end %>
44
-
46
+ ``` erb
47
+ <%= form_for @model do |f| %>
48
+ <%= f.text_field :field, data: {autonumeric: {aSign: 'USD ', mDec: 0}} %>
49
+ <% end %>
50
+ ```
45
51
  See autoNumeric pages (links above) for all details on configuration and options
46
52
 
47
53
  ## AJAX
@@ -55,14 +61,28 @@ When a Javascript function generate and add to the DOM new fields with autonumer
55
61
  you must manually refresh in order to initialize those new fields.
56
62
 
57
63
  To do so you must trigger the `refresh_autonumeric` event on `document` after you modified the DOM:
58
-
59
- $(document).trigger('refresh_autonumeric');
60
-
64
+ ``` javascript
65
+ $(document).trigger('refresh_autonumeric');
66
+ ```
61
67
  ## Internal
62
68
 
63
69
  Autonumeric-rails creates in the DOM an hidden input with the same name as the text field.
64
70
  On each modification of the text field value (through the `keyup` event), the hidden input is updated with the sanitized value.
65
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
+
73
+ ## Changes
74
+
75
+ For a full list of change, see the [CHANGELOG.md](https://github.com/randoum/autonumeric-rails/blob/master/CHANGELOG.md) file
76
+
77
+ ### 1.9.22
78
+ Bind on `ajaxComplete` event, so each jQuery ajax event automatically refresh autonumeric fields. Manually triggering `refresh_autonumeric` is not necessary for rails-ujs (i.e `data-remote`) anymore
79
+
80
+ ### 1.9.18.1
81
+ Implement `refresh_autonumeric` event on `document` for manual update after the DOM has been modified
82
+
83
+ ### 1.9.18.0
84
+ First attempt to implement automatic refresh of autonumeric fields using `DOMNodeInserted`.
85
+ This was not cross-browser compatible and was quickly reverted
66
86
 
67
87
  ## Contributing
68
88
 
@@ -1,5 +1,5 @@
1
1
  module Autonumeric
2
2
  module Rails
3
- VERSION = '1.9.22'
3
+ VERSION = '1.9.22.1'
4
4
  end
5
5
  end
@@ -48,7 +48,7 @@ window.AutonumericRails = AutonumericRails = (function() {
48
48
  this.create_hidden_field();
49
49
  this.init_autonumeric();
50
50
  this.sanitize_value();
51
- this.field.on('keyup', $.proxy(function() {
51
+ this.field.on('keyup blur', $.proxy(function() {
52
52
  this.sanitize_value();
53
53
  }, this));
54
54
  }
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: 1.9.22
4
+ version: 1.9.22.1
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: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails