html5_validators 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -25,21 +25,24 @@ html5_validators is a gem/plugin for Rails 3 that enables client-side validation
|
|
25
25
|
<input id="user_name" name="user[name]" required="required" type="text" />
|
26
26
|
|
27
27
|
SPEC:
|
28
|
-
http://dev.w3.org/html5/spec/Overview.html#attr-input-
|
28
|
+
http://dev.w3.org/html5/spec/Overview.html#attr-input-required
|
29
|
+
|
30
|
+
SCREENSHOT:
|
31
|
+
http://img.skitch.com/20110516-1kmy7fcuwkq84xihki2udkgh3a.jpg
|
29
32
|
|
30
33
|
* LengthValidator => maxlength
|
31
34
|
|
32
35
|
Model:
|
33
36
|
class User
|
34
37
|
include ActiveModel::Validations
|
35
|
-
validates_length_of :name, :maximum =>
|
38
|
+
validates_length_of :name, :maximum => 10
|
36
39
|
end
|
37
40
|
|
38
41
|
View:
|
39
42
|
<%= f.text_field :name %>
|
40
43
|
|
41
44
|
HTML:
|
42
|
-
<input id="user_name" maxlength="
|
45
|
+
<input id="user_name" maxlength="10" name="user[name]" size="10" type="text" />
|
43
46
|
|
44
47
|
SPEC:
|
45
48
|
http://dev.w3.org/html5/spec/Overview.html#attr-input-maxlength
|
@@ -62,6 +65,9 @@ html5_validators is a gem/plugin for Rails 3 that enables client-side validation
|
|
62
65
|
http://dev.w3.org/html5/spec/Overview.html#attr-input-max
|
63
66
|
http://dev.w3.org/html5/spec/Overview.html#attr-input-min
|
64
67
|
|
68
|
+
SCREENSHOT:
|
69
|
+
http://img.skitch.com/20110516-n3jhu5m4gan8iy1j8er1qb7yfa.jpg
|
70
|
+
|
65
71
|
|
66
72
|
* And more (coming soon...?)
|
67
73
|
|
@@ -86,7 +92,7 @@ Then bundle:
|
|
86
92
|
|
87
93
|
== Notes
|
88
94
|
|
89
|
-
When accessed by an HTML5 incompatible lagacy
|
95
|
+
When accessed by an HTML5 incompatible lagacy browser, these extra attributes will just be ignored.
|
90
96
|
|
91
97
|
|
92
98
|
== Todo
|
data/lib/html5_validators.rb
CHANGED
@@ -5,8 +5,9 @@ module Html5Validators
|
|
5
5
|
initializer 'html5_validators' do |app|
|
6
6
|
ActiveSupport.on_load(:active_record) do
|
7
7
|
require File.join(File.dirname(__FILE__), 'html5_validators/active_model/helper_methods')
|
8
|
-
|
9
|
-
|
8
|
+
if (Rails.version < '3.1.0.beta2') && (Rails.version != '3.1.0')
|
9
|
+
require File.join(File.dirname(__FILE__), 'html5_validators/active_model/initializer_monkey_patches')
|
10
|
+
end
|
10
11
|
end
|
11
12
|
ActiveSupport.on_load(:action_view) do
|
12
13
|
require File.join(File.dirname(__FILE__), 'html5_validators/action_view/form_helpers')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html5_validators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akira Matsuda
|