midas-live_validator 1.0.0 → 1.0.1

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/History.txt CHANGED
@@ -1,4 +1,7 @@
1
+ == 1.0.1
2
+
3
+ * Added a guilded.live_validator.min.js file.
4
+
1
5
  == 0.0.1 2009-03-09
2
6
 
3
- * 1 major enhancement:
4
- * Initial release
7
+ * Initial release
data/Manifest.txt CHANGED
@@ -6,9 +6,11 @@ Rakefile
6
6
  lib/live_validator.rb
7
7
  lib/live_validator/active_record_extensions.rb
8
8
  lib/live_validator/view_helpers.rb
9
+ live_validator.gemspec
9
10
  rails_generators/live_validator_assets/live_validator_assets_generator.rb
10
11
  rails_generators/live_validator_assets/templates/guilded.live_validator.js
11
- rails_generators/live_validator_assets/templates/livevalidation-1.3.compressed.js
12
+ rails_generators/live_validator_assets/templates/guilded.live_validator.min.js
13
+ rails_generators/live_validator_assets/templates/livevalidation-1.3.min.js
12
14
  script/console
13
15
  script/destroy
14
16
  script/generate
data/README.rdoc CHANGED
@@ -5,12 +5,26 @@ http://github.com/midas/live_validator/tree/master
5
5
 
6
6
  == DESCRIPTION:
7
7
 
8
- Live validator is a Rails Guilded component that will reflect ActiveRecord validations and use them to live validate forms. Live
9
- validator uses the Live Validation (http://www.livevalidation.com) JavaScript library to accomplish this task. It also uses an
10
- ActiveRecord extension authored by Michael Schuerig.
8
+ Live validator is a Rails Guilded (http://github.com/midas/guilded/tree/master) component that will reflect ActiveRecord validations
9
+ and use them to live validate forms. Live validator uses the Live Validation (http://www.livevalidation.com) JavaScript library to
10
+ accomplish this task. It also uses an ActiveRecord extension authored by Michael Schuerig to mre easily reflect on the ActiveRecord
11
+ valdiations.
11
12
 
12
13
 
13
- == FEATURES/PROBLEMS:
14
+ == FEATURES:
15
+
16
+ * Validate Rails XHTML forms without submitting form to server.
17
+ * Declare validations once in ActiveRecord model's. If JavaScript is enabled, the validation will happen live. Otherwise,
18
+ the validation will happen normally, with a submission to the server.
19
+ * The error message defined in the validation macro will be used in live validation
20
+ * The following ActiveRecrod validations are currently implemented and working: validates_presence_of (:message),
21
+ validates_numericality_of (:less_than, :less_than_or_equal_to, :equal_to, :greater_than, :greater_then_or_equal_to,
22
+ :only_integer, :notANumberMessage, :notAnIntegerMessage, :wrongNumberMessage, :tooLowMessage, :tooHighMessage),
23
+ validates_length_of / validates_size_of (:maximum, :minimum, :is, :within, :in, :too_long, :too_short, :wrong_length),
24
+ validates_confirmation_of (Only works for 2 fields, no more nor less.), validates_acceptance_of (:message),
25
+ validates_inclusion_of (:message), validates_exclusion_of (:message)
26
+
27
+ ==PROBLEMS:
14
28
 
15
29
 
16
30
  == INSTALL:
@@ -20,17 +34,34 @@ ActiveRecord extension authored by Michael Schuerig.
20
34
 
21
35
  == USE:
22
36
 
37
+ Add gem requirement to your environment.rb file:
23
38
 
39
+ config.gem 'midas-live_validator', :version => '1.0.0', :lib => 'live_validator', :source => 'http://gems.github.com'
24
40
 
25
- == REQUIREMENTS:
41
+ Generate the assets for live validator:
42
+
43
+ script/generate live_validator_assets
44
+
45
+ Make a call to the view_helper within a form:
26
46
 
47
+ <%= g_live_validator f %> # where f is the form variable passed into the form_for block
48
+
49
+
50
+ == OPTIONS:
51
+
52
+ :except - List of fields not to validate. Foreign key fields (that end in _id) are automatically excluded. Can be a string,
53
+ symbol or an array of string or sybmols.
54
+
55
+ == REQUIREMENTS:
27
56
 
57
+ * Guilded >= 0.0.5 (http://github.com/midas/guilded/tree/master)
58
+ * Rails >= 2.0
28
59
 
29
60
  == LICENSE:
30
61
 
31
62
  (The MIT License)
32
63
 
33
- Copyright (c) 2009 midas (excluding included material copyrighte by others)
64
+ Copyright (c) 2009 midas (excluding included material copyrighted by others)
34
65
 
35
66
  Permission is hereby granted, free of charge, to any person obtaining
36
67
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/lib/live_validator'
4
4
  # Generate all the Rake tasks
5
5
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
6
  $hoe = Hoe.new('live_validator', LiveValidator::VERSION) do |p|
7
- p.developer('midas', 'jason@lookforwardenterprises.com')
7
+ p.developer('C. Jason Harrelson (midas)', 'jason@lookforwardenterprises.com')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
9
  p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
10
  p.rubyforge_name = p.name # TODO this is default value
@@ -13,7 +13,7 @@ $hoe = Hoe.new('live_validator', LiveValidator::VERSION) do |p|
13
13
  # ]
14
14
  p.extra_dev_deps = [
15
15
  ['newgem', ">= #{::Newgem::VERSION}"],
16
- ['midas-guilded', ">=0.0.5"]
16
+ ['midas-guilded', ">=0.0.6"]
17
17
  ]
18
18
 
19
19
  p.clean_globs |= %w[**/.DS_Store tmp *.log]
@@ -5,7 +5,7 @@ require 'live_validator/view_helpers'
5
5
  require 'live_validator/active_record_extensions'
6
6
 
7
7
  module LiveValidator
8
- VERSION = '1.0.0'
8
+ VERSION = '1.0.1'
9
9
  end
10
10
 
11
11
  if defined?( ActiveRecord::Base )
@@ -82,7 +82,7 @@ module LiveValidator
82
82
  end
83
83
 
84
84
  options.merge! :validations => validations
85
- Guilded::Guilder.instance.add( :live_validator, options, [ 'livevalidation-1.3.compressed.js' ] )
85
+ Guilded::Guilder.instance.add( :live_validator, options, [ 'livevalidation-1.3.min.js' ] )
86
86
  return ""
87
87
  end
88
88
 
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{live_validator}
5
+ s.version = "1.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["C. Jason Harrelson (midas)"]
9
+ s.date = %q{2009-03-11}
10
+ s.description = %q{Live validator is a Rails Guilded (http://github.com/midas/guilded/tree/master) component that will reflect ActiveRecord validations and use them to live validate forms. Live validator uses the Live Validation (http://www.livevalidation.com) JavaScript library to accomplish this task. It also uses an ActiveRecord extension authored by Michael Schuerig to mre easily reflect on the ActiveRecord valdiations.}
11
+ s.email = ["jason@lookforwardenterprises.com"]
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "lib/live_validator.rb", "lib/live_validator/active_record_extensions.rb", "lib/live_validator/view_helpers.rb", "live_validator.gemspec", "rails_generators/live_validator_assets/live_validator_assets_generator.rb", "rails_generators/live_validator_assets/templates/guilded.live_validator.js", "rails_generators/live_validator_assets/templates/guilded.live_validator.min.js", "rails_generators/live_validator_assets/templates/livevalidation-1.3.min.js", "script/console", "script/destroy", "script/generate", "spec/live_validator_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/midas/live_validator/tree/master}
16
+ s.post_install_message = %q{PostInstall.txt}
17
+ s.rdoc_options = ["--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{live_validator}
20
+ s.rubygems_version = %q{1.3.1}
21
+ s.summary = %q{Live validator is a Rails Guilded (http://github.com/midas/guilded/tree/master) component that will reflect ActiveRecord validations and use them to live validate forms}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
29
+ s.add_development_dependency(%q<midas-guilded>, [">= 0.0.6"])
30
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
31
+ else
32
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
33
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.6"])
34
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
38
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.6"])
39
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
40
+ end
41
+ end
@@ -6,10 +6,8 @@ class LiveValidatorAssetsGenerator < Rails::Generator::Base
6
6
  def manifest
7
7
  record do |m|
8
8
  m.file "guilded.live_validator.js", "public/javascripts/guilded.live_validator.js"
9
- #m.directory "public/stylesheets/guilded"
10
- #m.directory "public/stylesheets/guilded/flash_growler"
11
- #m.directory "public/stylesheets/guilded/flash_growler/default"
12
- m.file "livevalidation-1.3.compressed.js", "public/javascripts/livevalidation-1.3.compressed.js"
9
+ m.file "guilded.live_validator.min.js", "public/javascripts/guilded.live_validator.min.js"
10
+ m.file "livevalidation-1.3.min.js", "public/javascripts/livevalidation-1.3.min.js"
13
11
  end
14
12
  end
15
13
  end
@@ -0,0 +1,15 @@
1
+ g.doInvalidField=function()
2
+ {if(g.liveValidatorInvalidField)
3
+ {g.liveValidatorInvalidField(this);}
4
+ else
5
+ {this.insertMessage(this.createMessageSpan());this.addFieldClass();}};g.doValidField=function()
6
+ {if(g.liveValidatorValidField)
7
+ g.liveValidatorValidField(this);else
8
+ {this.insertMessage(this.createMessageSpan());this.addFieldClass();}};g.liveValidatorInit=function(options)
9
+ {if(g.beforeLiveValidatorInit)
10
+ g.beforeLiveValidatorInit(options);var moreValidationMethods={presence:Validate.Presence,numericality:Validate.Numericality,format:Validate.Format,length:Validate.Length,acceptance:Validate.Acceptance,confirmation:Validate.Confirmation};var validationMethods={validates_presence_of:Validate.Presence,validates_numericality_of:Validate.Numericality,validates_format_of:Validate.Format,validates_length_of:Validate.Length,validates_size_of:Validate.Length,validates_acceptance_of:Validate.Acceptance,validates_confirmation_of:Validate.Confirmation,validates_inclusion_of:Validate.Inclusion,validates_exclusion_of:Validate.Exclusion};var validations=options['validations'];for(field in validations)
11
+ {fieldEl=$j('#'+field);if(fieldEl.length==0)
12
+ continue;var vList=validations[field];var v=null;v=new LiveValidation(field,{onlyOnBlur:true,onInvalid:g.doInvalidField,onValid:g.doValidField});for(var i=0;i<vList.length;i++)
13
+ {var validation=vList[i];v.add(validationMethods[validation.name],validation.args);}}
14
+ if(g.afterLiveValidatorInit)
15
+ g.afterLiveValidatorInit(options);};
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-live_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - midas
7
+ - C. Jason Harrelson (midas)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-10 00:00:00 -07:00
12
+ date: 2009-03-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.5
33
+ version: 0.0.6
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: hoe
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.8.0
44
44
  version:
45
- description: Live validator is a Rails Guilded component that will reflect ActiveRecord validations and use them to live validate forms. Live validator uses the Live Validation (http://www.livevalidation.com) JavaScript library to accomplish this task. It also uses an ActiveRecord extension authored by Michael Schuerig.
45
+ description: Live validator is a Rails Guilded (http://github.com/midas/guilded/tree/master) component that will reflect ActiveRecord validations and use them to live validate forms. Live validator uses the Live Validation (http://www.livevalidation.com) JavaScript library to accomplish this task. It also uses an ActiveRecord extension authored by Michael Schuerig to mre easily reflect on the ActiveRecord valdiations.
46
46
  email:
47
47
  - jason@lookforwardenterprises.com
48
48
  executables: []
@@ -63,9 +63,11 @@ files:
63
63
  - lib/live_validator.rb
64
64
  - lib/live_validator/active_record_extensions.rb
65
65
  - lib/live_validator/view_helpers.rb
66
+ - live_validator.gemspec
66
67
  - rails_generators/live_validator_assets/live_validator_assets_generator.rb
67
68
  - rails_generators/live_validator_assets/templates/guilded.live_validator.js
68
- - rails_generators/live_validator_assets/templates/livevalidation-1.3.compressed.js
69
+ - rails_generators/live_validator_assets/templates/guilded.live_validator.min.js
70
+ - rails_generators/live_validator_assets/templates/livevalidation-1.3.min.js
69
71
  - script/console
70
72
  - script/destroy
71
73
  - script/generate
@@ -99,6 +101,6 @@ rubyforge_project: live_validator
99
101
  rubygems_version: 1.2.0
100
102
  signing_key:
101
103
  specification_version: 2
102
- summary: Live validator is a Rails Guilded component that will reflect ActiveRecord validations and use them to live validate forms
104
+ summary: Live validator is a Rails Guilded (http://github.com/midas/guilded/tree/master) component that will reflect ActiveRecord validations and use them to live validate forms
103
105
  test_files: []
104
106