padrino-validation-html5 0.1 → 0.2
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.
- data/LICENSE.txt +20 -0
- data/README.md +73 -0
- data/lib/padrino/validation/html5/version.rb +1 -1
- metadata +15 -13
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 aereal
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Padrino::Validator::HTML5
|
2
|
+
|
3
|
+
padrino-validator-html5.gem supports HTML5 (client-side) form validations.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### from RubyGems
|
8
|
+
|
9
|
+
add the following to your project's Gemfile:
|
10
|
+
|
11
|
+
# Gemfile
|
12
|
+
gem 'padrino-validator-html5'
|
13
|
+
|
14
|
+
or, do you like living on the edge?
|
15
|
+
|
16
|
+
# Gemfile
|
17
|
+
gem 'padrino-validator-html5',
|
18
|
+
:git => 'git://github.com/aereal/padrino-validator-html5.git'
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Padrino::Validationo::HTML5 uses Padrino extension, and so you have to write some code to start to use this.
|
23
|
+
|
24
|
+
# app/app.rb
|
25
|
+
register Padrino::Validationo::HTML5
|
26
|
+
|
27
|
+
And then, add some validations to your model which based ActiveModel:
|
28
|
+
|
29
|
+
# models/post.rb
|
30
|
+
class Post < ActiveRecord::Base
|
31
|
+
validate_presence_of :title
|
32
|
+
end
|
33
|
+
|
34
|
+
You also have to use FormBuilder helpers:
|
35
|
+
|
36
|
+
# app/views/example.haml
|
37
|
+
- form_for @post, '/post' do |f|
|
38
|
+
%p
|
39
|
+
= f.text_field :title
|
40
|
+
%p
|
41
|
+
= f.text_area :body
|
42
|
+
%p
|
43
|
+
= f.submit "Submit"
|
44
|
+
|
45
|
+
You may get such HTML as the following:
|
46
|
+
|
47
|
+
# rendered app/views/example.haml
|
48
|
+
<form method="post" ...>
|
49
|
+
<input type="text" name="post[title]" ... required="required" />
|
50
|
+
...
|
51
|
+
</form>
|
52
|
+
|
53
|
+
## Features
|
54
|
+
|
55
|
+
Padrino::Validationo::HTML5 currently supports the following validators:
|
56
|
+
|
57
|
+
* ActiveModel::Validations::InclusionValidator
|
58
|
+
* ActiveModel::Validations::LengthValidator
|
59
|
+
* ActiveModel::Validations::PresenceValidator
|
60
|
+
|
61
|
+
## AUTHOR
|
62
|
+
|
63
|
+
aereal <aereal@kerare.org>
|
64
|
+
|
65
|
+
## SEE ALSO
|
66
|
+
|
67
|
+
* [Padrino](http://padrinorb.com/)
|
68
|
+
* [HTML-ValidationRules](https://github.com/kentaro/HTML-ValidationRules)
|
69
|
+
|
70
|
+
## LICENSE
|
71
|
+
|
72
|
+
See LICENSE.txt
|
73
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-validation-html5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-10 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: padrino-helpers
|
16
|
-
requirement: &
|
16
|
+
requirement: &70249505020340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70249505020340
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70249505018900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70249505018900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70249505018100 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70249505018100
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activemodel
|
49
|
-
requirement: &
|
49
|
+
requirement: &70249505016900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70249505016900
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &70249505016000 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70249505016000
|
69
69
|
description: automatically add client-side validations
|
70
70
|
email:
|
71
71
|
- aereal@kerare.org
|
@@ -77,6 +77,8 @@ files:
|
|
77
77
|
- .rspec
|
78
78
|
- Gemfile
|
79
79
|
- Guardfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
80
82
|
- Rakefile
|
81
83
|
- lib/padrino-validation-html5.rb
|
82
84
|
- lib/padrino/validation/html5.rb
|
@@ -101,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
103
|
version: '0'
|
102
104
|
segments:
|
103
105
|
- 0
|
104
|
-
hash:
|
106
|
+
hash: -3636646177078313247
|
105
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
108
|
none: false
|
107
109
|
requirements:
|
@@ -110,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
112
|
version: '0'
|
111
113
|
segments:
|
112
114
|
- 0
|
113
|
-
hash:
|
115
|
+
hash: -3636646177078313247
|
114
116
|
requirements: []
|
115
117
|
rubyforge_project:
|
116
118
|
rubygems_version: 1.8.11
|