client_side_validations 2.6.3 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1,5 +1,5 @@
1
1
  # Client Side Validations
2
- Now you can easily drop in client side validations in any Rails app. It will use validations defined in a given ActiveRecord (or ActiveModel) class for use with a Javascript form validator. (currently only [jquery.validate](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) is supported)
2
+ Now you can easily drop in client side validations in any Rails app. It will use validations defined in a given ActiveRecord (or ActiveModel) class for use with [jquery-validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/)
3
3
 
4
4
  For Rails 2 and Rails 3 example apps please see [client_side_validations_example](http://github.com/dnclabs/client_side_validations_examples)
5
5
 
@@ -19,7 +19,7 @@ Currently the following validations are supported:
19
19
  * validates_size_of
20
20
  * validates_uniqueness_of
21
21
  * validates_confirmation_of
22
- * validatse_acceptance_of
22
+ * validates_acceptance_of
23
23
  * validates_inclusion_of
24
24
  * validates_exclusion_of
25
25
 
@@ -36,7 +36,7 @@ Then run the generator:
36
36
 
37
37
  This will copy client_side_validations.js to "public/javascripts"
38
38
 
39
- **This version of ClientSideValidations will also copy a patched version of jquery.validate.js to "public/javascript"**
39
+ **This version of ClientSideValidations will also copy a patched version of jquery-validation.js to "public/javascript"**
40
40
 
41
41
  ### Rails 3
42
42
  Add "gem 'client_side_validations'" to the Gemfile
@@ -46,11 +46,11 @@ Then run the generator:
46
46
 
47
47
  This will copy client_side_validations.js to "public/javascripts"
48
48
 
49
- **This version of ClientSideValidations will also copy a patched version of jquery.validate.js to "public/javascript"**
49
+ **This version of ClientSideValidations will also copy a patched version of jquery-validation.js to "public/javascript"**
50
50
 
51
51
  ## Configuration
52
- #### *NOTE* This version of ClientSideValidations has a patched version of jquery.validate that will install automatically with the generator. *Do not* download the version listed below.
53
- Currently only [jquery.validate](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) is supported so you will need to download [jQuery](http://docs.jquery.com/Downloading_jQuery) and the jQuery Validate plugin to "public/javascripts"
52
+ #### *NOTE* This version of ClientSideValidations has a patched version of jquery-validation that will install automatically with the generator. *Do not* download the version listed below.
53
+ Download [jQuery](http://docs.jquery.com/Downloading_jQuery) and [jQuery Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) plugin to "public/javascripts"
54
54
 
55
55
  ### Rack
56
56
  If you want to validate_uniqueness_of a call to the server must be made. You can do this with the ClidenSideValidations::Uniqueness middleware.
@@ -80,7 +80,7 @@ Validate your models as you normally would
80
80
  You currently need both jQuery and the jQuery Validate plugin loaded before you load Client Side Validations
81
81
 
82
82
  ...
83
- <%= javascript_include_tag 'jquery', 'jquery.validate', 'client_side_validations' %>
83
+ <%= javascript_include_tag 'jquery', 'jquery-validation', 'client_side_validations' %>
84
84
  ...
85
85
 
86
86
  ### View
@@ -101,19 +101,17 @@ That should be it!
101
101
  ## Advanced Options
102
102
 
103
103
  ### Initialization
104
- [jquery.validate can be customized by setting various options](http://docs.jquery.com/Plugins/Validation/validate#toptions)
104
+ [jquery-validation can be customized by setting various options](http://docs.jquery.com/Plugins/Validation/validate#toptions)
105
105
 
106
106
  Create config/initializers/client_side_validations.rb
107
107
 
108
108
  An example set of default options can look like:
109
109
 
110
110
  ClientSideValidations.default_options = {
111
- :onkeyup => "false",
112
- :errorClass => %{"validation_errors"}
111
+ :onkeyup => false,
112
+ :errorClass => "validation_errors"
113
113
  }
114
114
 
115
- You'll notice that for :errorClass a string is being set inside of a string. This is necessary so everything gets translated to Javascript properly. (hopefully I can come up with something nicer soon)
116
-
117
115
  ### Model
118
116
  If you want to define only specific fields for client side validations just override the validation_fields method on each model
119
117
 
@@ -132,11 +130,9 @@ If you want to define only specific fields for client side validations just over
132
130
  ### View
133
131
  You can override the default options set in the initializer for each form:
134
132
 
135
- <% form_for @book, :validations => { :options => { :errorClass => %{"bad-field"} } } do |b| %>
133
+ <% form_for @book, :validations => { :options => { :errorClass => "bad-field" } } do |b| %>
136
134
  ...
137
135
 
138
- Same rules apply of a string inside a string for proper conversion to Javascript.
139
-
140
136
  If you are not using an instance variable for form_for or for some reason want to use the validations from another class that can be done in two ways:
141
137
 
142
138
  <% form_for :book, :validations => Book %>
@@ -10,7 +10,7 @@ class ClientSideValidationsGenerator < Rails::Generator::Base
10
10
  record do |c|
11
11
  c.directory('public/javascripts')
12
12
  c.file('client_side_validations.js', 'public/javascripts/client_side_validations.js')
13
- c.file('jquery.validate.js', 'public/javascripts/jquery.validate.js')
13
+ c.file('jquery-validation.js', 'public/javascripts/jquery-validation.js')
14
14
  end
15
15
  end
16
16
 
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Copyright (c) 2006 - 2008 Jörn Zaefferer
8
8
  *
9
- * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
9
+ * $Id: jquery-validation.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
10
10
  *
11
11
  * Dual licensed under the MIT and GPL licenses:
12
12
  * http://www.opensource.org/licenses/mit-license.php
@@ -9,7 +9,7 @@ class ClientSideValidationsGenerator < Rails::Generators::Base
9
9
  def install_client_side_validations
10
10
  copy_file('../../javascript/lib/client_side_validations.js',
11
11
  'public/javascripts/client_side_validations.js')
12
- copy_file('../../javascript/lib/jquery.validate.js',
13
- 'public/javascripts/jquery.validate.js')
12
+ copy_file('../../javascript/lib/jquery-validation.js',
13
+ 'public/javascripts/jquery-validation.js')
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_side_validations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 6
9
- - 3
10
- version: 2.6.3
8
+ - 8
9
+ - 0
10
+ version: 2.8.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Cardarella
@@ -64,7 +64,7 @@ files:
64
64
  - README.markdown
65
65
  - generators/client_side_validations/client_side_validations_generator.rb
66
66
  - javascript/lib/client_side_validations.js
67
- - javascript/lib/jquery.validate.js
67
+ - javascript/lib/jquery-validation.js
68
68
  - lib/client_side_validations.rb
69
69
  - lib/client_side_validations/adapters/action_view.rb
70
70
  - lib/client_side_validations/adapters/active_model.rb