optimism 0.4.0 → 0.4.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.
- checksums.yaml +4 -4
 - data/README.md +4 -0
 - data/lib/optimism.rb +3 -3
 - data/lib/optimism/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5880f22ff564228a65bbc9c7b9954a5ce996174266ed8567b6c28fd5da729062
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2f1dd15c17eadd3b6b577d7c9bad6ad4a195b71da629bbe0f8a4ebdbe29c5dfd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 84bae96ece4aa0caaa75989b04b7edf1dd4efd6f2179f705da107c6917f0c9bd408ad8aacbb3fd47ed9796a3e6844d5fdee1f14f2b63723d2608da1b31e5304a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8a30edd135765c3b5d5224fe8b030a0123f8e819ef2ddf0be11bf98e662827a5123c13ee54951932a0859858d9c6acd8c7df359421c1b91bc25c4fd6a3815598
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -4,6 +4,10 @@ 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            The missing drop-in solution for realtime remote form validation in Rails.
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
            {% hint style="success" %}
         
     | 
| 
      
 8 
     | 
    
         
            +
            Optimism v0.4.1 now supports Ruby 3.0.0, thanks to [Julian Rubisch](https://twitter.com/julian_rubisch) and Rails 6.1, thanks to [Josh LeBlanc](https://github.com/joshleblanc). 🎉
         
     | 
| 
      
 9 
     | 
    
         
            +
            {% endhint %}
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       7 
11 
     | 
    
         
             
            ## Why have optimism?
         
     | 
| 
       8 
12 
     | 
    
         | 
| 
       9 
13 
     | 
    
         
             
            [Optimism](https://github.com/leastbad/optimism) is an MIT-licensed [Ruby on Rails](https://rubyonrails.org/) gem that makes it easy to give your users instant constructive feedback if they enter invalid data into your application. Instead of dumping a list of errors at the top of your interface, Optimism provides specific instructions directly beside or below individual input elements.
         
     | 
    
        data/lib/optimism.rb
    CHANGED
    
    | 
         @@ -92,7 +92,7 @@ end 
     | 
|
| 
       92 
92 
     | 
    
         
             
            module ActionView::Helpers
         
     | 
| 
       93 
93 
     | 
    
         
             
              module FormHelper
         
     | 
| 
       94 
94 
     | 
    
         
             
                def error_for(object_name, attribute, **options)
         
     | 
| 
       95 
     | 
    
         
            -
                  tag.span options.merge 
     | 
| 
      
 95 
     | 
    
         
            +
                  tag.span **options.merge(id: error_id_for(object_name, attribute))
         
     | 
| 
       96 
96 
     | 
    
         
             
                end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
98 
     | 
    
         
             
                def error_id_for(object_name, attribute)
         
     | 
| 
         @@ -102,7 +102,7 @@ module ActionView::Helpers 
     | 
|
| 
       102 
102 
     | 
    
         | 
| 
       103 
103 
     | 
    
         
             
              class FormBuilder
         
     | 
| 
       104 
104 
     | 
    
         
             
                def container_for(attribute, **options, &block)
         
     | 
| 
       105 
     | 
    
         
            -
                  @template.tag.div @template.capture(&block), options.merge 
     | 
| 
      
 105 
     | 
    
         
            +
                  @template.tag.div @template.capture(&block), **options.merge(id: container_id_for(attribute)) if block_given?
         
     | 
| 
       106 
106 
     | 
    
         
             
                end
         
     | 
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
                def container_id_for(attribute)
         
     | 
| 
         @@ -110,7 +110,7 @@ module ActionView::Helpers 
     | 
|
| 
       110 
110 
     | 
    
         
             
                end
         
     | 
| 
       111 
111 
     | 
    
         | 
| 
       112 
112 
     | 
    
         
             
                def error_for(attribute, **options)
         
     | 
| 
       113 
     | 
    
         
            -
                  @template.error_for(object_name, attribute, options)
         
     | 
| 
      
 113 
     | 
    
         
            +
                  @template.error_for(object_name, attribute, **options)
         
     | 
| 
       114 
114 
     | 
    
         
             
                end
         
     | 
| 
       115 
115 
     | 
    
         
             
              end
         
     | 
| 
       116 
116 
     | 
    
         
             
            end
         
     | 
    
        data/lib/optimism/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: optimism
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - leastbad
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-01-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |