Permalink
Browse files

Merge pull request #45 from markburns/master

I somehow failed to notice the notice at the top. If this repo is dead then shall we make it REALLY obvious for idiots like me?
  • Loading branch information...
2 parents 3134563 + e14c1cd commit fdefafb2b4929a1709ab6e75d48667391261739f @bcardarella bcardarella committed Jan 18, 2012
Showing with 0 additions and 4,248 deletions.
  1. +0 −1 .rvmrc
  2. +0 −35 CHANGELOG.markdown
  3. +0 −7 Gemfile
  4. +0 −24 LICENSE
  5. +0 −133 README.markdown
  6. +0 −67 Rakefile
  7. +0 −1 VERSION
  8. +0 −83 client_side_validations.gemspec
  9. +0 −17 generators/client_side_validations/client_side_validations_generator.rb
  10. +0 −93 javascript/lib/client_side_validations.js
  11. +0 −1,146 javascript/lib/jquery-validation.js
  12. +0 −60 lib/client_side_validations.rb
  13. +0 −153 lib/client_side_validations/adapters/action_view.rb
  14. +0 −137 lib/client_side_validations/adapters/active_model.rb
  15. +0 −89 lib/client_side_validations/adapters/orm_base.rb
  16. +0 −226 lib/client_side_validations/orm.rb
  17. +0 −11 lib/client_side_validations/rails.rb
  18. +0 −3 lib/client_side_validations/template.rb
  19. +0 −15 lib/generators/client_side_validations_generator.rb
  20. +0 −105 spec/action_view_2_spec.rb
  21. +0 −125 spec/action_view_3_spec.rb
  22. +0 −58 spec/active_model_3_spec.rb
  23. +0 −19 spec/active_record_2_spec.rb
  24. +0 −61 spec/middleware_spec.rb
  25. +0 −19 spec/options_spec.rb
  26. +0 −153 spec/shared_examples/action_view_examples.rb
  27. +0 −410 spec/shared_examples/active_model_examples.rb
  28. +0 −9 spec/shared_examples/active_record_examples.rb
  29. +0 −65 spec/shared_examples/validate_options_examples.rb
  30. +0 −19 spec/shared_examples/validate_options_examples/acceptance_examples.rb
  31. +0 −19 spec/shared_examples/validate_options_examples/confirmation_examples.rb
  32. +0 −61 spec/shared_examples/validate_options_examples/exclusion_examples.rb
  33. +0 −61 spec/shared_examples/validate_options_examples/format_examples.rb
  34. +0 −61 spec/shared_examples/validate_options_examples/inclusion_examples.rb
  35. +0 −254 spec/shared_examples/validate_options_examples/length_examples.rb
  36. +0 −229 spec/shared_examples/validate_options_examples/numericality_examples.rb
  37. +0 −19 spec/shared_examples/validate_options_examples/required_examples.rb
  38. +0 −92 spec/shared_examples/validate_options_examples/uniqueness_examples.rb
  39. +0 −1 spec/spec.opts
  40. +0 −10 spec/spec_helper.rb
  41. +0 −43 spec/support/be_form_matcher.rb
  42. +0 −34 spec/support/define_model.rb
  43. +0 −3 spec/support/required_gems.rb
  44. +0 −17 spec/support/ruby_version.rb
View
1 .rvmrc
@@ -1 +0,0 @@
-rvm --create use default@client_side_validations > /dev/null
View
@@ -1,35 +0,0 @@
-# Changelog
-
-## v2.9.8
-
-- Support for the Rails 3 form_for :as option
-
-## v2.9.7
-
-- Ruby 1.9.2 support
-
-## v2.9.6
-
-- Fix for numericality's greater_than and less_than
-
-## v2.9.5
-
-- Better Javascript Regular Expression conversion
-
-## v2.9.4
-
-- Fixes for Rails 3.0.0 Final
-
-## v2.9.3
-
-- Fixed bug with confirmation validations... probably the result of the refactor from v2.6.3
-
-## v2.9.0
-
-- The Uniqueness middleware is automatically setup as a middleware via a Rails Engine
-- Cleaned up ActiveRecord::Base method pollution
-- Removed DNCLabs namespace
-- validates_numericality_of: even / odd support, added numericality jquery-validation function,
-- Now using Bundler's gemspec command to keep dependencies in the gemspec
-
-For versions previous to 2.9.0 please refer to the README for the specific version
View
@@ -1,7 +0,0 @@
-source 'http://rubygems.org'
-
-gemspec
-
-# To test against Rails 2.x install these two gems outside of Bundler
-# gem 'activerecord', '2.3.8'
-# gem 'actionpack', '2.3.8'
View
24 LICENSE
@@ -1,24 +0,0 @@
-Copyright (c) 2010, Democratic National Committee
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of the Democratic National Committee nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -1,136 +1,3 @@
# STOP!! #
## This repo is dead! Please [follow the v3.0 rewrite](https://github.com/bcardarella/client_side_validations) ##
-
-# Client Side Validations
-Now you can easily drop in client side validations in any Rails app. It will use validations defined in a given ActiveRecord (or ActiveModel) class for use with [jquery-validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/)
-
-For Rails 2 and Rails 3 example apps please see [client_side_validations_example](http://github.com/dnclabs/client_side_validations_examples)
-
-The concept is simple:
-
-1. Include the middleware
-2. Define validations in the model as you normally would
-3. The validations are sent to the client in JSON
-4. client_side_validations.js converts the JSON for a given validation plugin and binds the validator to the form
-
-Currently the following validations are supported:
-
-* validates_presence_of
-* validates_format_of
-* validates_numericality_of
-* validates_length_of
-* validates_size_of
-* validates_uniqueness_of
-* validates_confirmation_of
-* validates_acceptance_of
-* validates_inclusion_of
-* validates_exclusion_of
-
-The uniqueness validation works for both ActiveRecord and Mongoid.
-
-## Installation
-> gem install client_side_validations
-
-### Rails 2
-Add "config.gem :client_side_validations" to the "config/environment.rb" file
-
-Then run the generator:
- > script/generate client_side_validations
-
-This will copy client_side_validations.js to "public/javascripts"
-
-**This version of ClientSideValidations will also copy a patched version of jquery-validation.js to "public/javascript"**
-
-### Rails 3
-Add "gem 'client_side_validations'" to the Gemfile
-
-Then run the generator:
- > rails g client_side_validations
-
-This will copy client_side_validations.js to "public/javascripts"
-
-**This version of ClientSideValidations will also copy a patched version of jquery-validation.js to "public/javascript"**
-
-## Configuration
-#### *NOTE* This version of ClientSideValidations has a patched version of jquery-validation that will install automatically with the generator. *Do not* download the version listed below.
-Download [jQuery](http://docs.jquery.com/Downloading_jQuery) and [jQuery Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) plugin to "public/javascripts"
-
-### Rack
-As of version 2.9.0 the ClientSideValidations::Uniqueness middleware is automatically included as a Rails Engine. (both Rails 2 and Rails 3)
-
-### Model
-Validate your models as you normally would
-
- class Book < ActiveRecord::Base
- validates_presence_of :author
- end
-
-### Layout
-You currently need both jQuery and the jQuery Validate plugin loaded before you load Client Side Validations
-
- ...
- <%= javascript_include_tag 'jquery', 'jquery-validation', 'client_side_validations' %>
- ...
-
-### View
-Have a form ask for client side validations by passing :validate => true
-
- ...
-
- <% form_for @book, :validations => true do |b| %>
- <%= b.label :author %></br>
- <%= b.text_field :author %></br>
- <%= submit_tag 'Create' %>
- <% end %>
-
- ...
-
-That should be it!
-
-## Advanced Options
-
-### Initialization
-[jquery-validation can be customized by setting various options](http://docs.jquery.com/Plugins/Validation/validate#toptions)
-
-Create config/initializers/client_side_validations.rb
-
-An example set of default options can look like:
-
- ClientSideValidations.default_options = {
- :onkeyup => false,
- :errorClass => "validation_errors"
- }
-
-### Model
-If you want to define only specific fields for client side validations just override the validation_fields method on each model
-
- class Book < ActiveRecord::Base
- validatese_presence_of :author
- validates_presence_of :body
-
- private
-
- def validation_fields
- [:author]
- end
- end
-
-
-### View
-You can override the default options set in the initializer for each form:
-
- <% form_for @book, :validations => { :options => { :errorClass => "bad-field" } } do |b| %>
- ...
-
-If you are not using an instance variable for form_for or for some reason want to use the validations from another class that can be done in two ways:
-
- <% form_for :book, :validations => Book %>
- ...
-
- <% form_for :book, :validations => { :class => Book } %>
- ...
-
-Written by Brian Cardarella
-
-Copyright (c) 2010 Democratic National Committee. See LICENSE for details.
View
@@ -1,67 +0,0 @@
-require 'rubygems'
-require 'rake'
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "client_side_validations"
- gem.summary = %Q{Client Side Validations}
- gem.description = %Q{Client Side Validations for Rails 2.x and 3.x}
- gem.email = "bcardarella@gmail.com"
- gem.homepage = "http://github.com/dnclabs/client_side_validations"
- gem.authors = ["Brian Cardarella"]
- gem.add_dependency 'validation_reflection-active_model', ' 0.3.1'
- gem.add_dependency 'json', '1.4.3'
- gem.files = Dir.glob("lib/**/*") + Dir.glob("javascript/lib/**/*") + Dir.glob("generators/**/*") + %w(LICENSE README.markdown)
- gem.test_files = []
-
- gem.add_development_dependency 'jspec'
- gem.add_development_dependency 'rspec'
- gem.add_development_dependency 'actionpack', '3.0.0'
- gem.add_development_dependency 'activerecord', '3.0.0'
- gem.add_development_dependency 'bson_ext', '1.0.4'
- gem.add_development_dependency 'mongoid', '2.0.0.beta.17'
- gem.add_development_dependency 'crack'
- gem.add_development_dependency 'bourne'
- gem.add_development_dependency 'rack-test'
- end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
-end
-
-desc 'RSpec tests'
-task :rspec do
- system('rake orm')
-
- puts 'ActionView 2.x'
- system('spec spec/action_view_2_spec.rb')
-
- puts 'ActionView 3.x'
- system('spec spec/action_view_3_spec.rb')
-
- puts 'Middleware'
- system('spec spec/middleware_spec.rb')
-
- puts 'Options'
- system('spec spec/options_spec.rb')
-end
-
-desc 'Run the test suite against ree-1.8.7-2010.01 and 1.9.2-p0'
-task :multitest do
- system('rvm ree-1.8.7-2010.01@client_side_validations,1.9.2-p0@client_side_validations rake rspec')
-end
-
-desc 'ORM Specs'
-task :orm do
- puts 'ActiveRecord 2.x'
- system('spec spec/active_record_2_spec.rb')
-
- puts 'ActiveModel 3.x'
- system('spec spec/active_model_3_spec.rb')
-end
-
-desc 'Default: the full test suite.'
-task :default do
- system('rake rspec')
-end
View
@@ -1 +0,0 @@
-2.9.9
@@ -1,83 +0,0 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{client_side_validations}
- s.version = "2.9.9"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Brian Cardarella"]
- s.date = %q{2010-09-05}
- s.description = %q{Client Side Validations for Rails 2.x and 3.x}
- s.email = %q{bcardarella@gmail.com}
- s.extra_rdoc_files = [
- "LICENSE",
- "README.markdown"
- ]
- s.files = [
- "LICENSE",
- "README.markdown",
- "generators/client_side_validations/client_side_validations_generator.rb",
- "javascript/lib/client_side_validations.js",
- "javascript/lib/jquery-validation.js",
- "lib/client_side_validations.rb",
- "lib/client_side_validations/adapters/action_view.rb",
- "lib/client_side_validations/adapters/active_model.rb",
- "lib/client_side_validations/adapters/orm_base.rb",
- "lib/client_side_validations/orm.rb",
- "lib/client_side_validations/rails.rb",
- "lib/client_side_validations/template.rb",
- "lib/generators/client_side_validations_generator.rb"
- ]
- s.homepage = %q{http://github.com/dnclabs/client_side_validations}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.7}
- s.summary = %q{Client Side Validations}
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<validation_reflection-active_model>, ["= 0.3.1"])
- s.add_runtime_dependency(%q<json>, ["= 1.4.3"])
- s.add_development_dependency(%q<jspec>, [">= 0"])
- s.add_development_dependency(%q<rspec>, [">= 0"])
- s.add_development_dependency(%q<actionpack>, ["= 3.0.0"])
- s.add_development_dependency(%q<activerecord>, ["= 3.0.0"])
- s.add_development_dependency(%q<bson_ext>, ["= 1.0.4"])
- s.add_development_dependency(%q<mongoid>, ["= 2.0.0.beta.17"])
- s.add_development_dependency(%q<crack>, [">= 0"])
- s.add_development_dependency(%q<bourne>, [">= 0"])
- s.add_development_dependency(%q<rack-test>, [">= 0"])
- else
- s.add_dependency(%q<validation_reflection-active_model>, ["= 0.3.1"])
- s.add_dependency(%q<json>, ["= 1.4.3"])
- s.add_dependency(%q<jspec>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<actionpack>, ["= 3.0.0"])
- s.add_dependency(%q<activerecord>, ["= 3.0.0"])
- s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
- s.add_dependency(%q<mongoid>, ["= 2.0.0.beta.17"])
- s.add_dependency(%q<crack>, [">= 0"])
- s.add_dependency(%q<bourne>, [">= 0"])
- s.add_dependency(%q<rack-test>, [">= 0"])
- end
- else
- s.add_dependency(%q<validation_reflection-active_model>, ["= 0.3.1"])
- s.add_dependency(%q<json>, ["= 1.4.3"])
- s.add_dependency(%q<jspec>, [">= 0"])
- s.add_dependency(%q<rspec>, [">= 0"])
- s.add_dependency(%q<actionpack>, ["= 3.0.0"])
- s.add_dependency(%q<activerecord>, ["= 3.0.0"])
- s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
- s.add_dependency(%q<mongoid>, ["= 2.0.0.beta.17"])
- s.add_dependency(%q<crack>, [">= 0"])
- s.add_dependency(%q<bourne>, [">= 0"])
- s.add_dependency(%q<rack-test>, [">= 0"])
- end
-end
-
@@ -1,17 +0,0 @@
-class ClientSideValidationsGenerator < Rails::Generator::Base
-
- def initialize(runtime_args, runtime_options = {})
- runtime_options[:source] = File.join(spec.path, '../../javascript/lib')
- super
- end
-
-
- def manifest
- record do |c|
- c.directory('public/javascripts')
- c.file('client_side_validations.js', 'public/javascripts/client_side_validations.js')
- c.file('jquery-validation.js', 'public/javascripts/jquery-validation.js')
- end
- end
-
-end
Oops, something went wrong.

0 comments on commit fdefafb

Please sign in to comment.