realtime-validations 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -1,63 +1,75 @@
|
|
1
|
-
|
1
|
+
== Introduction
|
2
2
|
|
3
|
-
|
3
|
+
RealtimeValidations is a Rails 3.1 gem that allows you to easily validate your forms. It is very
|
4
|
+
easy to use, clean and yet powerful.
|
4
5
|
|
5
6
|
== Why
|
6
7
|
|
7
|
-
It is smart in the sense that is able to fulfill any kind of validation.
|
8
|
-
configured properly, it can run even validations that are :scoped by some other model.
|
8
|
+
It is smart in the sense that is able to fulfill any kind of validation.
|
9
9
|
|
10
10
|
Also, it allows to add some information based on the current session, user, client... so the model
|
11
|
-
|
11
|
+
has all the required information to perform a complete validation test.
|
12
12
|
|
13
13
|
It is very generic and is not tied to any specific case of use.
|
14
14
|
|
15
|
-
==
|
15
|
+
== Remember
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
gem 'realtime-validations'
|
17
|
+
This gem is simple. Very simple. It is developed with some things in mind:
|
20
18
|
|
21
|
-
|
19
|
+
* Forget about validations at client side.
|
20
|
+
* All this logic is placed at the model, and is how it should be.
|
21
|
+
* Do not replicate logic in javascript.
|
22
|
+
* Never, ever replicate logic.
|
23
|
+
* Someone updates some validation on some model, and javascript is forgotten to be updated.
|
24
|
+
* You need to replicate the same logic in two different languages with their implementation
|
25
|
+
differences.
|
26
|
+
* Highly configurable.
|
27
|
+
* There are three hooks to configure the behaviour as you want.
|
28
|
+
1. Server: when the Controller module is included into the ValidationsController class.
|
29
|
+
* Here you can remove or add filters.
|
30
|
+
2. Server: before asking for the model validity.
|
31
|
+
* You can add extra information to the model here based on the knowledge of the current
|
32
|
+
situation of the ApplicationController, such as the current client id or user id.
|
33
|
+
3. Client: before sending the request to the ValidationsController.
|
34
|
+
* Here you are able to add more information to the request, for instance retrieving it
|
35
|
+
from a meta tag on the page or wherever you want, is up to you.
|
22
36
|
|
23
|
-
|
37
|
+
== Dependencies
|
24
38
|
|
25
|
-
|
39
|
+
RealtimeValidations gem does not have too many dependencies:
|
26
40
|
|
27
|
-
|
28
|
-
|
29
|
-
=== Assets pipeline
|
41
|
+
* Rails 3.1.
|
42
|
+
* jquery-rails.
|
30
43
|
|
31
|
-
|
44
|
+
== Installation
|
32
45
|
|
33
|
-
|
34
|
-
//= require realtime_validations
|
46
|
+
Installation is very easy on your own project:
|
35
47
|
|
36
|
-
|
37
|
-
*= require realtime_validations
|
38
|
-
|
39
|
-
==== Views
|
48
|
+
=== Gemfile
|
40
49
|
|
41
|
-
|
50
|
+
gem 'realtime-validations'
|
42
51
|
|
43
|
-
|
52
|
+
=== Running generators
|
44
53
|
|
45
|
-
|
54
|
+
rails g realtime_validations:install
|
46
55
|
|
47
|
-
|
56
|
+
=== Assets pipeline
|
48
57
|
|
49
|
-
|
58
|
+
Include the core javascript of the application:
|
50
59
|
|
51
|
-
|
60
|
+
# app/assets/javascripts/application.js
|
61
|
+
//= require realtime_validations
|
52
62
|
|
53
|
-
|
63
|
+
For now it is necessary to include the stylesheet too, but it will be optional in next versions:
|
54
64
|
|
55
|
-
|
65
|
+
# app/assets/stylesheets/application.css
|
66
|
+
*= require realtime_validations
|
56
67
|
|
57
|
-
|
68
|
+
== Usage
|
58
69
|
|
59
|
-
|
70
|
+
Usage is very transparent from your project:
|
60
71
|
|
61
|
-
===
|
72
|
+
=== Views
|
62
73
|
|
63
|
-
|
74
|
+
You should use +form_validated_for+ instead of +form_for+ on your forms in order for them to
|
75
|
+
automatically validate.
|
@@ -2,9 +2,9 @@ require 'rails/generators'
|
|
2
2
|
|
3
3
|
module RealtimeValidations
|
4
4
|
|
5
|
-
module Generators
|
5
|
+
module Generators #:nodoc:
|
6
6
|
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
7
|
+
class InstallGenerator < Rails::Generators::Base #:nodoc:
|
8
8
|
|
9
9
|
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
10
|
|
data/lib/realtime-validations.rb
CHANGED
@@ -1,6 +1,81 @@
|
|
1
|
+
# == Introduction
|
2
|
+
#
|
3
|
+
# RealtimeValidations is a Rails 3.1 gem that allows you to easily validate your forms. It is very
|
4
|
+
# easy to use, clean and yet powerful.
|
5
|
+
#
|
6
|
+
# == Why
|
7
|
+
#
|
8
|
+
# It is smart in the sense that is able to fulfill any kind of validation.
|
9
|
+
#
|
10
|
+
# Also, it allows to add some information based on the current session, user, client... so the model
|
11
|
+
# has all the required information to perform a complete validation test.
|
12
|
+
#
|
13
|
+
# It is very generic and is not tied to any specific case of use.
|
14
|
+
#
|
15
|
+
# == Remember
|
16
|
+
#
|
17
|
+
# This gem is simple. Very simple. It is developed with some things in mind:
|
18
|
+
#
|
19
|
+
# * Forget about validations at client side.
|
20
|
+
# * All this logic is placed at the model, and is how it should be.
|
21
|
+
# * Do not replicate logic in javascript.
|
22
|
+
# * Never, ever replicate logic.
|
23
|
+
# * Someone updates some validation on some model, and javascript is forgotten to be updated.
|
24
|
+
# * You need to replicate the same logic in two different languages with their implementation
|
25
|
+
# differences.
|
26
|
+
# * Highly configurable.
|
27
|
+
# * There are three hooks to configure the behaviour as you want.
|
28
|
+
# 1. Server: when the Controller module is included into the ValidationsController class.
|
29
|
+
# * Here you can remove or add filters.
|
30
|
+
# 2. Server: before asking for the model validity.
|
31
|
+
# * You can add extra information to the model here based on the knowledge of the current
|
32
|
+
# situation of the ApplicationController, such as the current client id or user id.
|
33
|
+
# 3. Client: before sending the request to the ValidationsController.
|
34
|
+
# * Here you are able to add more information to the request, for instance retrieving it
|
35
|
+
# from a meta tag on the page or wherever you want, is up to you.
|
36
|
+
#
|
37
|
+
# == Dependencies
|
38
|
+
#
|
39
|
+
# RealtimeValidations gem does not have too many dependencies:
|
40
|
+
#
|
41
|
+
# * Rails 3.1.
|
42
|
+
# * jquery-rails.
|
43
|
+
#
|
44
|
+
# == Installation
|
45
|
+
#
|
46
|
+
# Installation is very easy on your own project:
|
47
|
+
#
|
48
|
+
# === Gemfile
|
49
|
+
#
|
50
|
+
# gem 'realtime-validations'
|
51
|
+
#
|
52
|
+
# === Running generators
|
53
|
+
#
|
54
|
+
# rails g realtime_validations:install
|
55
|
+
#
|
56
|
+
# === Assets pipeline
|
57
|
+
#
|
58
|
+
# Include the core javascript of the application:
|
59
|
+
#
|
60
|
+
# # app/assets/javascripts/application.js
|
61
|
+
# //= require realtime_validations
|
62
|
+
#
|
63
|
+
# For now it is necessary to include the stylesheet too, but it will be optional in next versions:
|
64
|
+
#
|
65
|
+
# # app/assets/stylesheets/application.css
|
66
|
+
# *= require realtime_validations
|
67
|
+
#
|
68
|
+
# == Usage
|
69
|
+
#
|
70
|
+
# Usage is very transparent from your project:
|
71
|
+
#
|
72
|
+
# === Views
|
73
|
+
#
|
74
|
+
# You should use +form_validated_for+ instead of +form_for+ on your forms in order for them to
|
75
|
+
# automatically validate.
|
1
76
|
module RealtimeValidations
|
2
77
|
|
3
|
-
class RealtimeValidations < Rails::Engine
|
78
|
+
class RealtimeValidations < Rails::Engine #:nodoc:
|
4
79
|
end
|
5
80
|
|
6
81
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: realtime-validations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &19370620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19370620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &19370200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *19370200
|
36
36
|
description: Form real time validations for free on Rails applications
|
37
37
|
email:
|
38
38
|
- ereslibre@gmail.com
|
@@ -41,49 +41,49 @@ extensions: []
|
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
43
|
- app/controllers/realtime_validations/validations_controller.rb
|
44
|
-
- config/initializers/form_validated_for.rb
|
45
44
|
- config/routes.rb
|
45
|
+
- config/initializers/form_validated_for.rb
|
46
|
+
- lib/realtime-validations.rb
|
47
|
+
- lib/realtime-validations/version.rb
|
48
|
+
- lib/generators/realtime_validations/install_generator.rb
|
46
49
|
- lib/generators/realtime_validations/templates/initializer.rb
|
47
50
|
- lib/generators/realtime_validations/templates/realtime_validations.custom.js
|
48
|
-
- lib/generators/realtime_validations/install_generator.rb
|
49
|
-
- lib/realtime-validations/version.rb
|
50
51
|
- lib/tasks/realtime-validations_tasks.rake
|
51
|
-
- lib/realtime-validations.rb
|
52
|
-
- vendor/assets/javascripts/realtime_validations.js
|
53
52
|
- vendor/assets/stylesheets/realtime_validations.css
|
53
|
+
- vendor/assets/javascripts/realtime_validations.js
|
54
54
|
- MIT-LICENSE
|
55
55
|
- Rakefile
|
56
56
|
- README.rdoc
|
57
|
-
- test/
|
57
|
+
- test/test_helper.rb
|
58
58
|
- test/dummy/public/404.html
|
59
|
-
- test/dummy/public/500.html
|
60
59
|
- test/dummy/public/favicon.ico
|
61
|
-
- test/dummy/
|
62
|
-
- test/dummy/
|
63
|
-
- test/dummy/config/
|
64
|
-
- test/dummy/config/
|
60
|
+
- test/dummy/public/422.html
|
61
|
+
- test/dummy/public/500.html
|
62
|
+
- test/dummy/config/application.rb
|
63
|
+
- test/dummy/config/database.yml
|
64
|
+
- test/dummy/config/environment.rb
|
65
|
+
- test/dummy/config/routes.rb
|
65
66
|
- test/dummy/config/environments/production.rb
|
67
|
+
- test/dummy/config/environments/development.rb
|
68
|
+
- test/dummy/config/environments/test.rb
|
66
69
|
- test/dummy/config/locales/en.yml
|
67
|
-
- test/dummy/config/
|
68
|
-
- test/dummy/config/initializers/session_store.rb
|
69
|
-
- test/dummy/config/initializers/inflections.rb
|
70
|
+
- test/dummy/config/boot.rb
|
70
71
|
- test/dummy/config/initializers/mime_types.rb
|
71
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
72
72
|
- test/dummy/config/initializers/wrap_parameters.rb
|
73
|
+
- test/dummy/config/initializers/session_store.rb
|
74
|
+
- test/dummy/config/initializers/inflections.rb
|
73
75
|
- test/dummy/config/initializers/secret_token.rb
|
74
|
-
- test/dummy/config/
|
75
|
-
- test/dummy/
|
76
|
-
- test/dummy/config
|
77
|
-
- test/dummy/
|
78
|
-
- test/dummy/
|
76
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
77
|
+
- test/dummy/script/rails
|
78
|
+
- test/dummy/config.ru
|
79
|
+
- test/dummy/README.rdoc
|
80
|
+
- test/dummy/app/assets/stylesheets/application.css
|
81
|
+
- test/dummy/app/assets/javascripts/application.js
|
79
82
|
- test/dummy/app/controllers/application_controller.rb
|
80
83
|
- test/dummy/app/views/layouts/application.html.erb
|
81
84
|
- test/dummy/app/helpers/application_helper.rb
|
82
|
-
- test/dummy/
|
83
|
-
- test/dummy/app/assets/stylesheets/application.css
|
84
|
-
- test/dummy/README.rdoc
|
85
|
+
- test/dummy/Rakefile
|
85
86
|
- test/realtime-validations_test.rb
|
86
|
-
- test/test_helper.rb
|
87
87
|
homepage: http://www.ereslibre.es/
|
88
88
|
licenses: []
|
89
89
|
post_install_message:
|
@@ -104,38 +104,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.11
|
108
108
|
signing_key:
|
109
109
|
specification_version: 3
|
110
110
|
summary: Provides real time validations for free
|
111
111
|
test_files:
|
112
|
-
- test/
|
112
|
+
- test/test_helper.rb
|
113
113
|
- test/dummy/public/404.html
|
114
|
-
- test/dummy/public/500.html
|
115
114
|
- test/dummy/public/favicon.ico
|
116
|
-
- test/dummy/
|
117
|
-
- test/dummy/
|
118
|
-
- test/dummy/config/
|
119
|
-
- test/dummy/config/
|
115
|
+
- test/dummy/public/422.html
|
116
|
+
- test/dummy/public/500.html
|
117
|
+
- test/dummy/config/application.rb
|
118
|
+
- test/dummy/config/database.yml
|
119
|
+
- test/dummy/config/environment.rb
|
120
|
+
- test/dummy/config/routes.rb
|
120
121
|
- test/dummy/config/environments/production.rb
|
122
|
+
- test/dummy/config/environments/development.rb
|
123
|
+
- test/dummy/config/environments/test.rb
|
121
124
|
- test/dummy/config/locales/en.yml
|
122
|
-
- test/dummy/config/
|
123
|
-
- test/dummy/config/initializers/session_store.rb
|
124
|
-
- test/dummy/config/initializers/inflections.rb
|
125
|
+
- test/dummy/config/boot.rb
|
125
126
|
- test/dummy/config/initializers/mime_types.rb
|
126
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
127
127
|
- test/dummy/config/initializers/wrap_parameters.rb
|
128
|
+
- test/dummy/config/initializers/session_store.rb
|
129
|
+
- test/dummy/config/initializers/inflections.rb
|
128
130
|
- test/dummy/config/initializers/secret_token.rb
|
129
|
-
- test/dummy/config/
|
130
|
-
- test/dummy/
|
131
|
-
- test/dummy/config
|
132
|
-
- test/dummy/
|
133
|
-
- test/dummy/
|
131
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
132
|
+
- test/dummy/script/rails
|
133
|
+
- test/dummy/config.ru
|
134
|
+
- test/dummy/README.rdoc
|
135
|
+
- test/dummy/app/assets/stylesheets/application.css
|
136
|
+
- test/dummy/app/assets/javascripts/application.js
|
134
137
|
- test/dummy/app/controllers/application_controller.rb
|
135
138
|
- test/dummy/app/views/layouts/application.html.erb
|
136
139
|
- test/dummy/app/helpers/application_helper.rb
|
137
|
-
- test/dummy/
|
138
|
-
- test/dummy/app/assets/stylesheets/application.css
|
139
|
-
- test/dummy/README.rdoc
|
140
|
+
- test/dummy/Rakefile
|
140
141
|
- test/realtime-validations_test.rb
|
141
|
-
- test/test_helper.rb
|