formtastic_validation 0.1.2 → 0.1.3
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/README.textile +11 -5
 - data/Rakefile +2 -2
 - data/VERSION +1 -1
 - data/formtastic_validation.gemspec +12 -12
 - data/lib/generators/formtastic_validation_generator.rb +11 -0
 - data/{rails_generators/formtastic_validation → lib/generators}/templates/config/initializers/formtastic_validation.rb +0 -0
 - data/{rails_generators/formtastic_validation/templates/public/javascripts/formtastic_validation-0.1.2.min.js → lib/generators/templates/public/javascripts/formtastic_validation-0.1.3.min.js} +0 -0
 - data/{rails_generators/formtastic_validation → lib/generators}/templates/public/javascripts/livevalidation-1.3.min.js +0 -0
 - data/spec/formtastic_validation_spec.rb +1 -1
 - metadata +17 -17
 - data/rails_generators/formtastic_validation/formtastic_validation_generator.rb +0 -16
 
    
        data/README.textile
    CHANGED
    
    | 
         @@ -23,14 +23,14 @@ h2. Installation 
     | 
|
| 
       23 
23 
     | 
    
         
             
              $ gem install formtastic_validation
         
     | 
| 
       24 
24 
     | 
    
         
             
            </pre>
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            Remember to add the gem into your  
     | 
| 
      
 26 
     | 
    
         
            +
            Remember to add the gem into your bundler Gemfile
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            Then run the generators to add the files on
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            From your rails root directory:
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            <pre>
         
     | 
| 
       33 
     | 
    
         
            -
              $  
     | 
| 
      
 33 
     | 
    
         
            +
              $ rails generate formtastic_validation
         
     | 
| 
       34 
34 
     | 
    
         
             
            </pre>
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
            This adds a configuration file to config/initializers and a couple of javascript files to public/javascripts
         
     | 
| 
         @@ -40,7 +40,7 @@ After that you need to add this to your application layout 
     | 
|
| 
       40 
40 
     | 
    
         
             
            <pre>
         
     | 
| 
       41 
41 
     | 
    
         
             
              <head>
         
     | 
| 
       42 
42 
     | 
    
         
             
                <%= javascript_include_tag 'livevalidation-1.3.min' %>
         
     | 
| 
       43 
     | 
    
         
            -
                <%= javascript_include_tag 'formtastic_validation-0.1. 
     | 
| 
      
 43 
     | 
    
         
            +
                <%= javascript_include_tag 'formtastic_validation-0.1.3.min' %>
         
     | 
| 
       44 
44 
     | 
    
         
             
                <script type="text/javascript">
         
     | 
| 
       45 
45 
     | 
    
         
             
                  function initialize() {
         
     | 
| 
       46 
46 
     | 
    
         
             
                      var formtasticValidation = new FormtasticValidation;
         
     | 
| 
         @@ -77,9 +77,15 @@ You can style the validation messages with the css selectors 
     | 
|
| 
       77 
77 
     | 
    
         
             
            .LV_invalid { ... }              /* for invalid messages */
         
     | 
| 
       78 
78 
     | 
    
         
             
            </pre>
         
     | 
| 
       79 
79 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
            h2.  
     | 
| 
      
 80 
     | 
    
         
            +
            h2. Compatibility
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            This gem is Rails 2 and 3 compatible. 
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            h2. Upgrading
         
     | 
| 
       81 
85 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
      
 86 
     | 
    
         
            +
            Existing users need not change anything from the upgrade from rails 2 to 3.
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            h2. Caveats
         
     | 
| 
       83 
89 
     | 
    
         | 
| 
       84 
90 
     | 
    
         
             
            Only the following validations work:
         
     | 
| 
       85 
91 
     | 
    
         | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -10,8 +10,8 @@ begin 
     | 
|
| 
       10 
10 
     | 
    
         
             
                gem.email = "zan@liangzan.net"
         
     | 
| 
       11 
11 
     | 
    
         
             
                gem.homepage = "http://github.com/liangzan/formtastic_validation"
         
     | 
| 
       12 
12 
     | 
    
         
             
                gem.authors = ["Wong Liang Zan"]
         
     | 
| 
       13 
     | 
    
         
            -
                gem.add_dependency "validation_reflection", " 
     | 
| 
       14 
     | 
    
         
            -
                gem.add_dependency "formtastic", " 
     | 
| 
      
 13 
     | 
    
         
            +
                gem.add_dependency "validation_reflection", "~> 1.0.0"
         
     | 
| 
      
 14 
     | 
    
         
            +
                gem.add_dependency "formtastic", "~> 1.1.0"
         
     | 
| 
       15 
15 
     | 
    
         
             
                gem.add_development_dependency "rspec", "= 1.3.0"
         
     | 
| 
       16 
16 
     | 
    
         
             
                gem.add_development_dependency "rspec-rails", "= 1.3.2"	
         
     | 
| 
       17 
17 
     | 
    
         
             
                gem.add_development_dependency "rspec_tag_matchers", "= 1.0.0"
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.3
         
     | 
| 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{formtastic_validation}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.1.3"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Wong Liang Zan"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2010- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-11-08}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{A formtastic extension that does client side validation}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{zan@liangzan.net}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -31,10 +31,10 @@ Gem::Specification.new do |s| 
     | 
|
| 
       31 
31 
     | 
    
         
             
                 "javascripts/lib/livevalidation-1.3.min.js",
         
     | 
| 
       32 
32 
     | 
    
         
             
                 "javascripts/src/formtastic_validation.js",
         
     | 
| 
       33 
33 
     | 
    
         
             
                 "lib/formtastic_validation.rb",
         
     | 
| 
       34 
     | 
    
         
            -
                 " 
     | 
| 
       35 
     | 
    
         
            -
                 " 
     | 
| 
       36 
     | 
    
         
            -
                 " 
     | 
| 
       37 
     | 
    
         
            -
                 " 
     | 
| 
      
 34 
     | 
    
         
            +
                 "lib/generators/formtastic_validation_generator.rb",
         
     | 
| 
      
 35 
     | 
    
         
            +
                 "lib/generators/templates/config/initializers/formtastic_validation.rb",
         
     | 
| 
      
 36 
     | 
    
         
            +
                 "lib/generators/templates/public/javascripts/formtastic_validation-0.1.3.min.js",
         
     | 
| 
      
 37 
     | 
    
         
            +
                 "lib/generators/templates/public/javascripts/livevalidation-1.3.min.js",
         
     | 
| 
       38 
38 
     | 
    
         
             
                 "spec/formtastic_validation_spec.rb",
         
     | 
| 
       39 
39 
     | 
    
         
             
                 "spec/spec.opts",
         
     | 
| 
       40 
40 
     | 
    
         
             
                 "spec/spec_helper.rb"
         
     | 
| 
         @@ -54,8 +54,8 @@ Gem::Specification.new do |s| 
     | 
|
| 
       54 
54 
     | 
    
         
             
                s.specification_version = 3
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         
     | 
| 
       57 
     | 
    
         
            -
                  s.add_runtime_dependency(%q<validation_reflection>, [" 
     | 
| 
       58 
     | 
    
         
            -
                  s.add_runtime_dependency(%q<formtastic>, [" 
     | 
| 
      
 57 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<validation_reflection>, ["~> 1.0.0"])
         
     | 
| 
      
 58 
     | 
    
         
            +
                  s.add_runtime_dependency(%q<formtastic>, ["~> 1.1.0"])
         
     | 
| 
       59 
59 
     | 
    
         
             
                  s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
         
     | 
| 
       60 
60 
     | 
    
         
             
                  s.add_development_dependency(%q<rspec-rails>, ["= 1.3.2"])
         
     | 
| 
       61 
61 
     | 
    
         
             
                  s.add_development_dependency(%q<rspec_tag_matchers>, ["= 1.0.0"])
         
     | 
| 
         @@ -63,8 +63,8 @@ Gem::Specification.new do |s| 
     | 
|
| 
       63 
63 
     | 
    
         
             
                  s.add_development_dependency(%q<activesupport>, ["= 2.3.8"])
         
     | 
| 
       64 
64 
     | 
    
         
             
                  s.add_development_dependency(%q<actionpack>, ["= 2.3.8"])
         
     | 
| 
       65 
65 
     | 
    
         
             
                else
         
     | 
| 
       66 
     | 
    
         
            -
                  s.add_dependency(%q<validation_reflection>, [" 
     | 
| 
       67 
     | 
    
         
            -
                  s.add_dependency(%q<formtastic>, [" 
     | 
| 
      
 66 
     | 
    
         
            +
                  s.add_dependency(%q<validation_reflection>, ["~> 1.0.0"])
         
     | 
| 
      
 67 
     | 
    
         
            +
                  s.add_dependency(%q<formtastic>, ["~> 1.1.0"])
         
     | 
| 
       68 
68 
     | 
    
         
             
                  s.add_dependency(%q<rspec>, ["= 1.3.0"])
         
     | 
| 
       69 
69 
     | 
    
         
             
                  s.add_dependency(%q<rspec-rails>, ["= 1.3.2"])
         
     | 
| 
       70 
70 
     | 
    
         
             
                  s.add_dependency(%q<rspec_tag_matchers>, ["= 1.0.0"])
         
     | 
| 
         @@ -73,8 +73,8 @@ Gem::Specification.new do |s| 
     | 
|
| 
       73 
73 
     | 
    
         
             
                  s.add_dependency(%q<actionpack>, ["= 2.3.8"])
         
     | 
| 
       74 
74 
     | 
    
         
             
                end
         
     | 
| 
       75 
75 
     | 
    
         
             
              else
         
     | 
| 
       76 
     | 
    
         
            -
                s.add_dependency(%q<validation_reflection>, [" 
     | 
| 
       77 
     | 
    
         
            -
                s.add_dependency(%q<formtastic>, [" 
     | 
| 
      
 76 
     | 
    
         
            +
                s.add_dependency(%q<validation_reflection>, ["~> 1.0.0"])
         
     | 
| 
      
 77 
     | 
    
         
            +
                s.add_dependency(%q<formtastic>, ["~> 1.1.0"])
         
     | 
| 
       78 
78 
     | 
    
         
             
                s.add_dependency(%q<rspec>, ["= 1.3.0"])
         
     | 
| 
       79 
79 
     | 
    
         
             
                s.add_dependency(%q<rspec-rails>, ["= 1.3.2"])
         
     | 
| 
       80 
80 
     | 
    
         
             
                s.add_dependency(%q<rspec_tag_matchers>, ["= 1.0.0"])
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails/generators'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class FormtasticValidationGenerator < Rails::Generators::Base
         
     | 
| 
      
 4 
     | 
    
         
            +
              source_root File.expand_path("../templates", __FILE__)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def install_formtastic_validations
         
     | 
| 
      
 7 
     | 
    
         
            +
                  copy_file 'public/javascripts/formtastic_validation-0.1.3.min.js', 'public/javascripts/formtastic_validation-0.1.3.min.js'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  copy_file 'public/javascripts/livevalidation-1.3.min.js', 'public/javascripts/livevalidation-1.3.min.js'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  copy_file 'config/initializers/formtastic_validation.rb', 'config/initializers/formtastic_validation.rb'
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -26,7 +26,7 @@ describe "FormtasticValidation#input" do 
     | 
|
| 
       26 
26 
     | 
    
         
             
                      semantic_form_for(@bob) do |builder|
         
     | 
| 
       27 
27 
     | 
    
         
             
                        concat(builder.input(:name))
         
     | 
| 
       28 
28 
     | 
    
         
             
                      end
         
     | 
| 
       29 
     | 
    
         
            -
                      output_buffer.should have_tag('input[@validation_valid_message=" 
     | 
| 
      
 29 
     | 
    
         
            +
                      output_buffer.should have_tag('input[@validation_valid_message="Thank you!"]')
         
     | 
| 
       30 
30 
     | 
    
         
             
                    end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                    it 'should allow changes to the valid message tag' do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: formtastic_validation
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 29
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.3
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Wong Liang Zan
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-11-08 00:00:00 +08:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -24,14 +24,14 @@ dependencies: 
     | 
|
| 
       24 
24 
     | 
    
         
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
       25 
25 
     | 
    
         
             
                none: false
         
     | 
| 
       26 
26 
     | 
    
         
             
                requirements: 
         
     | 
| 
       27 
     | 
    
         
            -
                - -  
     | 
| 
      
 27 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       28 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       29 
     | 
    
         
            -
                    hash:  
     | 
| 
      
 29 
     | 
    
         
            +
                    hash: 23
         
     | 
| 
       30 
30 
     | 
    
         
             
                    segments: 
         
     | 
| 
      
 31 
     | 
    
         
            +
                    - 1
         
     | 
| 
       31 
32 
     | 
    
         
             
                    - 0
         
     | 
| 
       32 
     | 
    
         
            -
                    -  
     | 
| 
       33 
     | 
    
         
            -
                     
     | 
| 
       34 
     | 
    
         
            -
                    version: 0.3.8
         
     | 
| 
      
 33 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 34 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
       35 
35 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: *id001
         
     | 
| 
       37 
37 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -40,14 +40,14 @@ dependencies: 
     | 
|
| 
       40 
40 
     | 
    
         
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       41 
41 
     | 
    
         
             
                none: false
         
     | 
| 
       42 
42 
     | 
    
         
             
                requirements: 
         
     | 
| 
       43 
     | 
    
         
            -
                - -  
     | 
| 
      
 43 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       44 
44 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       45 
     | 
    
         
            -
                    hash:  
     | 
| 
      
 45 
     | 
    
         
            +
                    hash: 19
         
     | 
| 
       46 
46 
     | 
    
         
             
                    segments: 
         
     | 
| 
       47 
47 
     | 
    
         
             
                    - 1
         
     | 
| 
      
 48 
     | 
    
         
            +
                    - 1
         
     | 
| 
       48 
49 
     | 
    
         
             
                    - 0
         
     | 
| 
       49 
     | 
    
         
            -
                     
     | 
| 
       50 
     | 
    
         
            -
                    version: 1.0.0
         
     | 
| 
      
 50 
     | 
    
         
            +
                    version: 1.1.0
         
     | 
| 
       51 
51 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       52 
52 
     | 
    
         
             
              version_requirements: *id002
         
     | 
| 
       53 
53 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -170,10 +170,10 @@ files: 
     | 
|
| 
       170 
170 
     | 
    
         
             
            - javascripts/lib/livevalidation-1.3.min.js
         
     | 
| 
       171 
171 
     | 
    
         
             
            - javascripts/src/formtastic_validation.js
         
     | 
| 
       172 
172 
     | 
    
         
             
            - lib/formtastic_validation.rb
         
     | 
| 
       173 
     | 
    
         
            -
            -  
     | 
| 
       174 
     | 
    
         
            -
            -  
     | 
| 
       175 
     | 
    
         
            -
            -  
     | 
| 
       176 
     | 
    
         
            -
            -  
     | 
| 
      
 173 
     | 
    
         
            +
            - lib/generators/formtastic_validation_generator.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - lib/generators/templates/config/initializers/formtastic_validation.rb
         
     | 
| 
      
 175 
     | 
    
         
            +
            - lib/generators/templates/public/javascripts/formtastic_validation-0.1.3.min.js
         
     | 
| 
      
 176 
     | 
    
         
            +
            - lib/generators/templates/public/javascripts/livevalidation-1.3.min.js
         
     | 
| 
       177 
177 
     | 
    
         
             
            - spec/formtastic_validation_spec.rb
         
     | 
| 
       178 
178 
     | 
    
         
             
            - spec/spec.opts
         
     | 
| 
       179 
179 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
         @@ -1,16 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            class FormtasticValidationGenerator < Rails::Generator::Base
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              def manifest
         
     | 
| 
       4 
     | 
    
         
            -
                record do |m|
         
     | 
| 
       5 
     | 
    
         
            -
                  m.file 'public/javascripts/formtastic_validation-0.1.2.min.js', 'public/javascripts/formtastic_validation-0.1.2.min.js'
         
     | 
| 
       6 
     | 
    
         
            -
                  m.file 'public/javascripts/livevalidation-1.3.min.js', 'public/javascripts/livevalidation-1.3.min.js'
         
     | 
| 
       7 
     | 
    
         
            -
                  m.file 'config/initializers/formtastic_validation.rb', 'config/initializers/formtastic_validation.rb'
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
              protected
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
              def banner
         
     | 
| 
       14 
     | 
    
         
            -
                %\Usage: #{$0} formtastic_validation\
         
     | 
| 
       15 
     | 
    
         
            -
              end
         
     | 
| 
       16 
     | 
    
         
            -
            end
         
     |