client_side_validations 0.8.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ if defined?(ActionView)
2
+ require 'client_side_validations/adapters/action_view'
3
+ end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+
3
+ class ClientSideValidationsGenerator < Rails::Generators::Base
4
+
5
+ def self.source_root
6
+ File.join(File.dirname(__FILE__), '../../javascript/lib')
7
+ end
8
+
9
+ def install_client_side_validations
10
+ copy_file('../../javascript/lib/client_side_validations.js',
11
+ 'public/javascripts/client_side_validations.js')
12
+ end
13
+ end
metadata CHANGED
@@ -3,10 +3,10 @@ name: client_side_validations
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
+ - 2
7
+ - 2
6
8
  - 0
7
- - 8
8
- - 0
9
- version: 0.8.0
9
+ version: 2.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Cardarella
@@ -14,35 +14,35 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 -04:00
17
+ date: 2010-07-07 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: rspec
21
+ name: validation_reflection
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
- - 1
29
- - 2
30
- - 9
31
- version: 1.2.9
32
- type: :development
28
+ - 0
29
+ - 3
30
+ - 6
31
+ version: 0.3.6
32
+ type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: validation_reflection
35
+ name: json
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "="
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
- - 0
42
+ - 1
43
+ - 4
43
44
  - 3
44
- - 6
45
- version: 0.3.6
45
+ version: 1.4.3
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  description: ORM and Framework agnostic Client Side Validations
@@ -53,37 +53,21 @@ extensions: []
53
53
 
54
54
  extra_rdoc_files:
55
55
  - LICENSE
56
- - README.rdoc
56
+ - README.markdown
57
57
  - TODO
58
58
  files:
59
- - .document
60
- - .gitignore
61
59
  - LICENSE
62
- - README.rdoc
63
- - Rakefile
64
- - TODO
65
- - VERSION
66
- - client_side_validations.gemspec
60
+ - README.markdown
67
61
  - generators/client_side_validations/client_side_validations_generator.rb
68
- - javascript/jspec/commands/example_command.rb
69
- - javascript/jspec/rhino.js
70
- - javascript/jspec/unit/jquery.validate.spec.js
71
- - javascript/jspec/unit/spec.helper.js
72
62
  - javascript/lib/client_side_validations.js
73
- - javascript/vendor/jspec.js
74
- - javascript/vendor/jspec.xhr.js
75
- - lib/adapters/action_view.rb
76
- - lib/adapters/active_model.rb
77
- - lib/adapters/active_record_2.rb
78
63
  - lib/client_side_validations.rb
79
- - spec/action_view_2_spec.rb
80
- - spec/action_view_3_spec.rb
81
- - spec/active_model_3_spec.rb
82
- - spec/active_record_2_spec.rb
83
- - spec/spec.opts
84
- - spec/spec_helper.rb
85
- - spec/support/required_gems.rb
86
- - tasks/spec.rake
64
+ - lib/client_side_validations/adapters/action_view.rb
65
+ - lib/client_side_validations/adapters/active_model.rb
66
+ - lib/client_side_validations/adapters/active_record_2.rb
67
+ - lib/client_side_validations/orm.rb
68
+ - lib/client_side_validations/template.rb
69
+ - lib/generators/client_side_validations_generator.rb
70
+ - TODO
87
71
  has_rdoc: true
88
72
  homepage: http://github.com/dnclabs/client_side_validations
89
73
  licenses: []
@@ -114,10 +98,5 @@ rubygems_version: 1.3.6
114
98
  signing_key:
115
99
  specification_version: 3
116
100
  summary: Client Side Validations
117
- test_files:
118
- - spec/action_view_2_spec.rb
119
- - spec/action_view_3_spec.rb
120
- - spec/active_model_3_spec.rb
121
- - spec/active_record_2_spec.rb
122
- - spec/spec_helper.rb
123
- - spec/support/required_gems.rb
101
+ test_files: []
102
+
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
22
- *.gem
data/README.rdoc DELETED
@@ -1,7 +0,0 @@
1
- = client_side_validations
2
-
3
- Client Side Validations
4
-
5
- == Copyright
6
-
7
- Copyright (c) 2010 Democratic National Committee. See LICENSE for details.
data/Rakefile DELETED
@@ -1,46 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "client_side_validations"
8
- gem.summary = %Q{Client Side Validations}
9
- gem.description = %Q{ORM and Framework agnostic Client Side Validations}
10
- gem.email = "cardarellab@dnc.org"
11
- gem.homepage = "http://github.com/dnclabs/client_side_validations"
12
- gem.authors = ["Brian Cardarella"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_dependency 'validation_reflection', '>= 0.3.6'
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
20
-
21
- require 'spec/rake/spectask'
22
- Spec::Rake::SpecTask.new(:spec) do |spec|
23
- spec.libs << 'lib' << 'spec'
24
- spec.spec_files = FileList['spec/**/*_spec.rb']
25
- end
26
-
27
- Spec::Rake::SpecTask.new(:rcov) do |spec|
28
- spec.libs << 'lib' << 'spec'
29
- spec.pattern = 'spec/**/*_spec.rb'
30
- spec.rcov = true
31
- end
32
-
33
- task :spec => :check_dependencies
34
- task :default => :spec
35
-
36
- require 'rake/rdoctask'
37
- Rake::RDocTask.new do |rdoc|
38
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
39
-
40
- rdoc.rdoc_dir = 'rdoc'
41
- rdoc.title = "client_side_validations #{version}"
42
- rdoc.rdoc_files.include('README*')
43
- rdoc.rdoc_files.include('lib/**/*.rb')
44
- end
45
-
46
- Dir['tasks/**/*.rake'].each { |t| load t }
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.8.0
@@ -1,80 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{client_side_validations}
8
- s.version = "0.8.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Brian Cardarella"]
12
- s.date = %q{2010-06-08}
13
- s.description = %q{ORM and Framework agnostic Client Side Validations}
14
- s.email = %q{cardarellab@dnc.org}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc",
18
- "TODO"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".gitignore",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "TODO",
27
- "VERSION",
28
- "client_side_validations.gemspec",
29
- "generators/client_side_validations/client_side_validations_generator.rb",
30
- "javascript/jspec/commands/example_command.rb",
31
- "javascript/jspec/rhino.js",
32
- "javascript/jspec/unit/jquery.validate.spec.js",
33
- "javascript/jspec/unit/spec.helper.js",
34
- "javascript/lib/client_side_validations.js",
35
- "javascript/vendor/jspec.js",
36
- "javascript/vendor/jspec.xhr.js",
37
- "lib/adapters/action_view.rb",
38
- "lib/adapters/active_model.rb",
39
- "lib/adapters/active_record_2.rb",
40
- "lib/client_side_validations.rb",
41
- "spec/action_view_2_spec.rb",
42
- "spec/action_view_3_spec.rb",
43
- "spec/active_model_3_spec.rb",
44
- "spec/active_record_2_spec.rb",
45
- "spec/spec.opts",
46
- "spec/spec_helper.rb",
47
- "spec/support/required_gems.rb",
48
- "tasks/spec.rake"
49
- ]
50
- s.homepage = %q{http://github.com/dnclabs/client_side_validations}
51
- s.rdoc_options = ["--charset=UTF-8"]
52
- s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.6}
54
- s.summary = %q{Client Side Validations}
55
- s.test_files = [
56
- "spec/action_view_2_spec.rb",
57
- "spec/action_view_3_spec.rb",
58
- "spec/active_model_3_spec.rb",
59
- "spec/active_record_2_spec.rb",
60
- "spec/spec_helper.rb",
61
- "spec/support/required_gems.rb"
62
- ]
63
-
64
- if s.respond_to? :specification_version then
65
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
- s.specification_version = 3
67
-
68
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
70
- s.add_runtime_dependency(%q<validation_reflection>, [">= 0.3.6"])
71
- else
72
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
73
- s.add_dependency(%q<validation_reflection>, [">= 0.3.6"])
74
- end
75
- else
76
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
77
- s.add_dependency(%q<validation_reflection>, [">= 0.3.6"])
78
- end
79
- end
80
-
@@ -1,19 +0,0 @@
1
-
2
- # uncomment and call with `$ jspec example `
3
-
4
- # command :example do |c|
5
- # c.syntax = 'jspec example [options]'
6
- # c.description = 'Just an example command'
7
- # c.option '-f', '--foo string', 'Does some foo with <string>'
8
- # c.option '-b', '--bar [string]', 'Does some bar with [string]'
9
- # c.example 'Do some foo', 'jspec example --foo bar'
10
- # c.example 'Do some bar', 'jspec example --bar'
11
- # c.when_called do |args, options|
12
- # p args
13
- # p options.__hash__
14
- # # options.foo
15
- # # options.bar
16
- # # options.__hash__[:foo]
17
- # # options.__hash__[:bar]
18
- # end
19
- # end
@@ -1,10 +0,0 @@
1
-
2
- load('vendor/jspec.js')
3
- load('vendor/jspec.xhr.js')
4
- load('lib/client_side_validations.js')
5
- load('jspec/unit/spec.helper.js')
6
-
7
- JSpec
8
- .exec('jspec/unit/jquery.validate.spec.js')
9
- .run({ reporter: JSpec.reporters.Terminal, fixturePath: 'spec/fixtures' })
10
- .report()
@@ -1,146 +0,0 @@
1
- describe 'jquery.validate adapter'
2
- before
3
- client = new ClientSideValidations('object', 'jquery.validate');
4
- end
5
-
6
- describe 'required'
7
- before
8
- validations = {
9
- "number": {
10
- "presence": { "message":"can't be blank" }
11
- }
12
- }
13
- result = client.adaptValidations(validations);
14
- end
15
-
16
- it 'should translate the rule'
17
- result.rules['object[number]']['required'].should.be_true
18
- end
19
-
20
- it 'should translate the message'
21
- result.messages['object[number]']['required'].should.equal "can't be blank"
22
- end
23
- end
24
-
25
- describe 'format'
26
- before
27
- validations = {
28
- "number": {
29
- "format": { "message":"is invalid", "with":/\d/ }
30
- }
31
- }
32
- result = client.adaptValidations(validations)
33
- end
34
-
35
- it 'should translate the rule'
36
- result.rules['object[number]']['format'].should.eql(/\d/)
37
- end
38
-
39
- it 'should translate the message'
40
- result.messages['object[number]']['format'].should.equal "is invalid"
41
- end
42
- end
43
-
44
- describe 'digits'
45
- before
46
- validations = {
47
- "number": {
48
- "numericality": { "message":"is not a number" }
49
- }
50
- }
51
- result = client.adaptValidations(validations)
52
- end
53
-
54
- it 'should translate the rule'
55
- result.rules['object[number]']['digits'].should.be_true
56
- end
57
-
58
- it 'should translate the message'
59
- result.messages['object[number]']['digits'].should.equal "is not a number"
60
- end
61
- end
62
-
63
- describe 'minlength'
64
- before
65
- validations = {
66
- "string": {
67
- "length": { "message":"is too short (minimum is 10 characters)", "minimum":10 }
68
- }
69
- }
70
- result = client.adaptValidations(validations)
71
- end
72
-
73
- it 'should translate the rule'
74
- result.rules['object[string]']['minlength'].should.eql(10)
75
- end
76
-
77
- it 'should translate the message'
78
- result.messages['object[string]']['minlength'].should.equal "is too short (minimum is 10 characters)"
79
- end
80
- end
81
-
82
- describe 'maxlength'
83
- before
84
- validations = {
85
- "string": {
86
- "length": { "message":"is too short (maximum is 10 characters)", "maximum":10 }
87
- }
88
- }
89
- result = client.adaptValidations(validations)
90
- end
91
-
92
- it 'should translate the rule'
93
- result.rules['object[string]']['maxlength'].should.eql(10)
94
- end
95
-
96
- it 'should translate the message'
97
- result.messages['object[string]']['maxlength'].should.equal "is too short (maximum is 10 characters)"
98
- end
99
- end
100
-
101
- describe 'multiple attributes'
102
- before
103
- validations = {
104
- "number_1": {
105
- "presence": { "message":"can't be blank" }
106
- },
107
- "number_2": {
108
- "presence": { "message":"can't be blank" }
109
- }
110
- }
111
- result = client.adaptValidations(validations)
112
- end
113
-
114
- it 'should translate the rules for both attributes'
115
- result.rules['object[number_1]']['required'].should.be_true
116
- result.rules['object[number_2]']['required'].should.be_true
117
- end
118
-
119
- it 'should translate the messages for both attributes'
120
- result.messages['object[number_1]']['required'].should.eql("can't be blank")
121
- result.messages['object[number_2]']['required'].should.eql("can't be blank")
122
- end
123
- end
124
-
125
- describe 'multiple rules'
126
- before
127
- validations = {
128
- "number": {
129
- "presence": { "message":"can't be blank" },
130
- "numericality": { "message":"is not a number" }
131
- }
132
- }
133
- result = client.adaptValidations(validations)
134
- end
135
-
136
- it 'should translate the rules for both attributes'
137
- result.rules['object[number]']['required'].should.be_true
138
- result.rules['object[number]']['digits'].should.be_true
139
- end
140
-
141
- it 'should translate the messages for both attributes'
142
- result.messages['object[number]']['required'].should.eql("can't be blank")
143
- result.messages['object[number]']['digits'].should.eql("is not a number")
144
- end
145
- end
146
- end