dependent-fields-rails 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2bae5d6eeb6d28e4c494c5f2fa38d92537734bc
4
- data.tar.gz: 2c3023eca6b6233669e8fb2817b7c05d2441295c
3
+ metadata.gz: ab3f55661ee8c185975c3d926b63adde03bb5835
4
+ data.tar.gz: ee4ca92551ac387ec91d510407cd8d34a2732ce7
5
5
  SHA512:
6
- metadata.gz: 67016db054e1d49e1c487d19d9fd332c5d1293e4af96fb4c304155eb10fa16ad949730bb5a75b2e5b484648ceeaf3598e6931744f147d331244e4bc88ed8d35b
7
- data.tar.gz: 25e361d990ac61aed66b67b34dbdcf3f3d33b8966b6af0aae553abbf8fe44bc724e6fe34854f96da932da238baee742549bc64345503032343d16da86d2b4f21
6
+ metadata.gz: fcfc56503c58a69071abbff285130705610a3ffd6eda2edab836aeae12f31557d4b38efa0a0acea8a79cbbde98738a8479d48a61edb21c3c23f830151c348793
7
+ data.tar.gz: b2530b71e72fe0951306f504c5fbe5b609772949cd7363ddb342e4eb3974491bd687a0515de426700da2cddcb5b6a8eee8af886a3866b08bb6d590ec99648eb4
data/README.md CHANGED
@@ -12,12 +12,19 @@ Installation
12
12
  1. Add `//= require dependent-fields` to your Javascript manifest file (usually found at `app/assets/javascripts/application.js`).
13
13
  1. Bind events, for example with jquery:
14
14
 
15
- $ ->
15
+ $(document).ready(function() {
16
16
  DependentFields.bind()
17
+ }
17
18
 
18
19
  1. Restart your server and everything should be set up. See Usage below on how to declare your dependent fields in views.
19
20
 
20
21
 
22
+ Dependencies
23
+ ------------
24
+
25
+ Be sure to include underscorejs and jquery in your page.
26
+
27
+
21
28
  Usage
22
29
  -------
23
30
 
@@ -69,7 +76,7 @@ Note the data attributes on the js-dependent-fields div.
69
76
 
70
77
  The language selector will only be shown if the user selects 'habm' in the registration office.
71
78
 
72
- You can also specify multiple option values by seperating them with `|`. For example: `data-option-value='habm|dpma'`
79
+ You can also specify multiple option values by seperating them with `|`. For example: `data-radio-value='habm|dpma'`
73
80
 
74
81
 
75
82
  ### Disabling instead of hiding fields
@@ -78,3 +85,7 @@ Add `data-method='disable'` to the js-dependent-fields div.
78
85
 
79
86
 
80
87
 
88
+ Minimal Demo
89
+ ------------
90
+
91
+ http://jsfiddle.net/mwhSt/
@@ -49,12 +49,12 @@ showOrHideDependentFieldsRadio = (duration = 'fast') ->
49
49
  showOrHideFields = ->
50
50
  $this = $(this)
51
51
  # use checked radio input of this radio input group
52
- $checkedRadio = $("input:checked[name=#{$radio.attr('name').replace('[', '\\[').replace(']', '\\]')}]")
52
+ $checkedRadio = $("input:checked[name=#{$radio.attr('name').replace(/\[/g, '\\[').replace(/]/g, '\\]')}]")
53
53
  # use attr here instead of data because we do not want jquery to cast the string into js types
54
54
  showOrHide = _.contains($this.attr('data-radio-value').split('|'), $checkedRadio.val())
55
55
  toggle($this, showOrHide, $this.data('method'), duration)
56
56
 
57
- $(".js-dependent-fields[data-radio-name=#{$radio.attr('name').replace('[', '\\[').replace(']', '\\]')}]").each showOrHideFields
57
+ $(".js-dependent-fields[data-radio-name=#{$radio.attr('name').replace(/\[/g, '\\[').replace(/]/g, '\\]')}]").each showOrHideFields
58
58
 
59
59
 
60
60
  bind = ->
@@ -79,4 +79,4 @@ bind = ->
79
79
 
80
80
  @DependentFields = {
81
81
  bind
82
- }
82
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependent-fields-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lion Vollnhals
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-12 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.0.3
84
+ rubygems_version: 2.0.6
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: DependentFields makes it easy to hide or show dependent fields in forms based