simple_form 1.4.1 → 1.4.2
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.
Potentially problematic release.
This version of simple_form might be problematic. Click here for more details.
- data/.travis.yml +1 -1
- data/CHANGELOG.rdoc +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -44
- data/lib/simple_form/action_view_extensions/form_helper.rb +24 -20
- data/lib/simple_form/form_builder.rb +1 -1
- data/lib/simple_form/version.rb +1 -1
- data/simple_form.gemspec +3 -0
- data/test/form_builder_test.rb +11 -0
- data/test/support/mock_controller.rb +9 -0
- metadata +38 -7
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,13 +1,17 @@ | |
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                simple_form (1.4.1)
         | 
| 5 | 
            +
                  actionpack (~> 3.0)
         | 
| 6 | 
            +
                  activemodel (~> 3.0)
         | 
| 7 | 
            +
             | 
| 1 8 | 
             
            GEM
         | 
| 2 9 | 
             
              remote: http://rubygems.org/
         | 
| 3 10 | 
             
              specs:
         | 
| 4 11 | 
             
                abstract (1.0.0)
         | 
| 5 | 
            -
                 | 
| 6 | 
            -
                   | 
| 7 | 
            -
                   | 
| 8 | 
            -
                actionpack (3.0.7)
         | 
| 9 | 
            -
                  activemodel (= 3.0.7)
         | 
| 10 | 
            -
                  activesupport (= 3.0.7)
         | 
| 12 | 
            +
                actionpack (3.0.9)
         | 
| 13 | 
            +
                  activemodel (= 3.0.9)
         | 
| 14 | 
            +
                  activesupport (= 3.0.9)
         | 
| 11 15 | 
             
                  builder (~> 2.1.2)
         | 
| 12 16 | 
             
                  erubis (~> 2.6.6)
         | 
| 13 17 | 
             
                  i18n (~> 0.5.0)
         | 
| @@ -15,68 +19,36 @@ GEM | |
| 15 19 | 
             
                  rack-mount (~> 0.6.14)
         | 
| 16 20 | 
             
                  rack-test (~> 0.5.7)
         | 
| 17 21 | 
             
                  tzinfo (~> 0.3.23)
         | 
| 18 | 
            -
                activemodel (3.0. | 
| 19 | 
            -
                  activesupport (= 3.0. | 
| 22 | 
            +
                activemodel (3.0.9)
         | 
| 23 | 
            +
                  activesupport (= 3.0.9)
         | 
| 20 24 | 
             
                  builder (~> 2.1.2)
         | 
| 21 25 | 
             
                  i18n (~> 0.5.0)
         | 
| 22 | 
            -
                 | 
| 23 | 
            -
                  activemodel (= 3.0.7)
         | 
| 24 | 
            -
                  activesupport (= 3.0.7)
         | 
| 25 | 
            -
                  arel (~> 2.0.2)
         | 
| 26 | 
            -
                  tzinfo (~> 0.3.23)
         | 
| 27 | 
            -
                activeresource (3.0.7)
         | 
| 28 | 
            -
                  activemodel (= 3.0.7)
         | 
| 29 | 
            -
                  activesupport (= 3.0.7)
         | 
| 30 | 
            -
                activesupport (3.0.7)
         | 
| 31 | 
            -
                arel (2.0.9)
         | 
| 26 | 
            +
                activesupport (3.0.9)
         | 
| 32 27 | 
             
                builder (2.1.2)
         | 
| 33 28 | 
             
                columnize (0.3.2)
         | 
| 34 29 | 
             
                erubis (2.6.6)
         | 
| 35 30 | 
             
                  abstract (>= 1.0.0)
         | 
| 36 31 | 
             
                i18n (0.5.0)
         | 
| 37 32 | 
             
                linecache (0.43)
         | 
| 38 | 
            -
                mail (2.2.18)
         | 
| 39 | 
            -
                  activesupport (>= 2.3.6)
         | 
| 40 | 
            -
                  i18n (>= 0.4.0)
         | 
| 41 | 
            -
                  mime-types (~> 1.16)
         | 
| 42 | 
            -
                  treetop (~> 1.4.8)
         | 
| 43 | 
            -
                mime-types (1.16)
         | 
| 44 33 | 
             
                mocha (0.9.10)
         | 
| 45 34 | 
             
                  rake
         | 
| 46 | 
            -
                 | 
| 47 | 
            -
                rack (1.2.2)
         | 
| 35 | 
            +
                rack (1.2.3)
         | 
| 48 36 | 
             
                rack-mount (0.6.14)
         | 
| 49 37 | 
             
                  rack (>= 1.0.0)
         | 
| 50 38 | 
             
                rack-test (0.5.7)
         | 
| 51 39 | 
             
                  rack (>= 1.0)
         | 
| 52 | 
            -
                rails (3.0.7)
         | 
| 53 | 
            -
                  actionmailer (= 3.0.7)
         | 
| 54 | 
            -
                  actionpack (= 3.0.7)
         | 
| 55 | 
            -
                  activerecord (= 3.0.7)
         | 
| 56 | 
            -
                  activeresource (= 3.0.7)
         | 
| 57 | 
            -
                  activesupport (= 3.0.7)
         | 
| 58 | 
            -
                  bundler (~> 1.0)
         | 
| 59 | 
            -
                  railties (= 3.0.7)
         | 
| 60 | 
            -
                railties (3.0.7)
         | 
| 61 | 
            -
                  actionpack (= 3.0.7)
         | 
| 62 | 
            -
                  activesupport (= 3.0.7)
         | 
| 63 | 
            -
                  rake (>= 0.8.7)
         | 
| 64 | 
            -
                  thor (~> 0.14.4)
         | 
| 65 40 | 
             
                rake (0.8.7)
         | 
| 66 41 | 
             
                ruby-debug (0.10.4)
         | 
| 67 42 | 
             
                  columnize (>= 0.1)
         | 
| 68 43 | 
             
                  ruby-debug-base (~> 0.10.4.0)
         | 
| 69 44 | 
             
                ruby-debug-base (0.10.4)
         | 
| 70 45 | 
             
                  linecache (>= 0.3)
         | 
| 71 | 
            -
                 | 
| 72 | 
            -
                treetop (1.4.9)
         | 
| 73 | 
            -
                  polyglot (>= 0.3.1)
         | 
| 74 | 
            -
                tzinfo (0.3.27)
         | 
| 46 | 
            +
                tzinfo (0.3.28)
         | 
| 75 47 |  | 
| 76 48 | 
             
            PLATFORMS
         | 
| 77 49 | 
             
              ruby
         | 
| 78 50 |  | 
| 79 51 | 
             
            DEPENDENCIES
         | 
| 80 52 | 
             
              mocha
         | 
| 81 | 
            -
              rails (~> 3.0.7)
         | 
| 82 53 | 
             
              ruby-debug
         | 
| 54 | 
            +
              simple_form!
         | 
| @@ -29,27 +29,31 @@ module SimpleForm | |
| 29 29 | 
             
                    result
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 |  | 
| 32 | 
            -
                   | 
| 33 | 
            -
                     | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
                          options[:html][:novalidate] = !SimpleForm.browser_validations
         | 
| 45 | 
            -
                        end
         | 
| 46 | 
            -
                        options[:html][:class] = "\#{SimpleForm.form_class} \#{css_class} \#{options[:html][:class]}".strip
         | 
| 32 | 
            +
                  def simple_form_for(record, options={}, &block)
         | 
| 33 | 
            +
                    options[:builder] ||= SimpleForm::FormBuilder
         | 
| 34 | 
            +
                    css_class = case record
         | 
| 35 | 
            +
                                when String, Symbol then record.to_s
         | 
| 36 | 
            +
                                when Array then dom_class(record.last)
         | 
| 37 | 
            +
                                else dom_class(record)
         | 
| 38 | 
            +
                                end
         | 
| 39 | 
            +
                    options[:html] ||= {}
         | 
| 40 | 
            +
                    unless options[:html].key?(:novalidate)
         | 
| 41 | 
            +
                      options[:html][:novalidate] = !SimpleForm.browser_validations
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
                    options[:html][:class] = "#{SimpleForm.form_class} #{css_class} #{options[:html][:class]}".strip
         | 
| 47 44 |  | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 45 | 
            +
                    with_custom_field_error_proc do
         | 
| 46 | 
            +
                      form_for(record, options, &block)
         | 
| 47 | 
            +
                    end
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                  def simple_fields_for(record_name, record_object = nil, options = {}, &block)
         | 
| 51 | 
            +
                    options, record_object = record_object, nil if record_object.is_a?(Hash)
         | 
| 52 | 
            +
                    options[:builder] ||= SimpleForm::FormBuilder
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                    with_custom_field_error_proc do
         | 
| 55 | 
            +
                      fields_for(record_name, record_object, options, &block)
         | 
| 56 | 
            +
                    end
         | 
| 53 57 | 
             
                  end
         | 
| 54 58 | 
             
                end
         | 
| 55 59 | 
             
              end
         | 
| @@ -109,7 +109,7 @@ module SimpleForm | |
| 109 109 | 
             
                #        name="user[name]" size="100" type="text" value="Carlos" />
         | 
| 110 110 | 
             
                #
         | 
| 111 111 | 
             
                def input_field(attribute_name, options={})
         | 
| 112 | 
            -
                  options[:input_html] = options.except(:as)
         | 
| 112 | 
            +
                  options[:input_html] = options.except(:as, :collection, :label_method, :value_method)
         | 
| 113 113 | 
             
                  options.merge!(:components => [:input], :wrapper => false)
         | 
| 114 114 | 
             
                  input(attribute_name, options)
         | 
| 115 115 | 
             
                end
         | 
    
        data/lib/simple_form/version.rb
    CHANGED
    
    
    
        data/simple_form.gemspec
    CHANGED
    
    
    
        data/test/form_builder_test.rb
    CHANGED
    
    | @@ -434,6 +434,17 @@ class FormBuilderTest < ActionView::TestCase | |
| 434 434 | 
             
                assert_no_select 'input.integer[as]'
         | 
| 435 435 | 
             
              end
         | 
| 436 436 |  | 
| 437 | 
            +
              test 'builder collection input_field should generate input tag with a clean HTML' do
         | 
| 438 | 
            +
                with_concat_form_for(@user) do |f|
         | 
| 439 | 
            +
                  f.input_field :status, :collection => ['Open', 'Closed'], :class => 'status', :label_method => :to_s, :value_method => :to_s
         | 
| 440 | 
            +
                end
         | 
| 441 | 
            +
             | 
| 442 | 
            +
                assert_no_select 'select.status[input_html]'
         | 
| 443 | 
            +
                assert_no_select 'select.status[collection]'
         | 
| 444 | 
            +
                assert_no_select 'select.status[label_method]'
         | 
| 445 | 
            +
                assert_no_select 'select.status[value_method]'
         | 
| 446 | 
            +
              end
         | 
| 447 | 
            +
             | 
| 437 448 | 
             
              # WITHOUT OBJECT
         | 
| 438 449 | 
             
              test 'builder should generate properly when object is not present' do
         | 
| 439 450 | 
             
                with_form_for :project, :name
         | 
| @@ -12,4 +12,13 @@ class MockController | |
| 12 12 | 
             
              def url_for(*args)
         | 
| 13 13 | 
             
                "http://example.com"
         | 
| 14 14 | 
             
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def url_helpers
         | 
| 17 | 
            +
                self
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def hash_for_user_path(*args); end
         | 
| 21 | 
            +
              def hash_for_validating_user_path(*args); end
         | 
| 22 | 
            +
              def hash_for_other_validating_user_path(*args); end
         | 
| 23 | 
            +
              def hash_for_users_path(*args); end
         | 
| 15 24 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: simple_form
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 8 | 
             
              - 4
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1.4. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 1.4.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - "Jos\xC3\xA9 Valim"
         | 
| @@ -16,9 +16,39 @@ autorequire: | |
| 16 16 | 
             
            bindir: bin
         | 
| 17 17 | 
             
            cert_chain: []
         | 
| 18 18 |  | 
| 19 | 
            -
            date: 2011-06- | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 19 | 
            +
            date: 2011-06-27 00:00:00 -03:00
         | 
| 20 | 
            +
            default_executable: 
         | 
| 21 | 
            +
            dependencies: 
         | 
| 22 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 23 | 
            +
              name: activemodel
         | 
| 24 | 
            +
              prerelease: false
         | 
| 25 | 
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 26 | 
            +
                none: false
         | 
| 27 | 
            +
                requirements: 
         | 
| 28 | 
            +
                - - ~>
         | 
| 29 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 30 | 
            +
                    hash: 7
         | 
| 31 | 
            +
                    segments: 
         | 
| 32 | 
            +
                    - 3
         | 
| 33 | 
            +
                    - 0
         | 
| 34 | 
            +
                    version: "3.0"
         | 
| 35 | 
            +
              type: :runtime
         | 
| 36 | 
            +
              version_requirements: *id001
         | 
| 37 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 38 | 
            +
              name: actionpack
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements: 
         | 
| 43 | 
            +
                - - ~>
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 45 | 
            +
                    hash: 7
         | 
| 46 | 
            +
                    segments: 
         | 
| 47 | 
            +
                    - 3
         | 
| 48 | 
            +
                    - 0
         | 
| 49 | 
            +
                    version: "3.0"
         | 
| 50 | 
            +
              type: :runtime
         | 
| 51 | 
            +
              version_requirements: *id002
         | 
| 22 52 | 
             
            description: Forms made easy!
         | 
| 23 53 | 
             
            email: contact@plataformatec.com.br
         | 
| 24 54 | 
             
            executables: []
         | 
| @@ -89,6 +119,7 @@ files: | |
| 89 119 | 
             
            - test/support/mock_response.rb
         | 
| 90 120 | 
             
            - test/support/models.rb
         | 
| 91 121 | 
             
            - test/test_helper.rb
         | 
| 122 | 
            +
            has_rdoc: true
         | 
| 92 123 | 
             
            homepage: http://github.com/plataformatec/simple_form
         | 
| 93 124 | 
             
            licenses: []
         | 
| 94 125 |  | 
| @@ -118,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 118 149 | 
             
            requirements: []
         | 
| 119 150 |  | 
| 120 151 | 
             
            rubyforge_project: simple_form
         | 
| 121 | 
            -
            rubygems_version: 1. | 
| 152 | 
            +
            rubygems_version: 1.5.3
         | 
| 122 153 | 
             
            signing_key: 
         | 
| 123 154 | 
             
            specification_version: 3
         | 
| 124 155 | 
             
            summary: Forms made easy!
         |