simple_form 2.0.1 → 2.0.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/CHANGELOG.md +21 -0
- data/MIT-LICENSE +1 -1
- data/README.md +149 -147
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb.tt +3 -1
- data/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +7 -5
- data/lib/simple_form/action_view_extensions/builder.rb +4 -2
- data/lib/simple_form/components/hints.rb +2 -1
- data/lib/simple_form/components/labels.rb +1 -1
- data/lib/simple_form/components/min_max.rb +1 -0
- data/lib/simple_form/error_notification.rb +1 -1
- data/lib/simple_form/form_builder.rb +1 -1
- data/lib/simple_form/inputs/base.rb +19 -2
- data/lib/simple_form/inputs/boolean_input.rb +6 -1
- data/lib/simple_form/version.rb +1 -1
- data/test/action_view_extensions/builder_test.rb +6 -0
- data/test/action_view_extensions/form_helper_test.rb +18 -18
- data/test/form_builder/association_test.rb +3 -3
- data/test/form_builder/error_notification_test.rb +1 -1
- data/test/form_builder/general_test.rb +14 -0
- data/test/form_builder/general_test.rb.orig +380 -0
- data/test/form_builder/hint_test.rb +16 -0
- data/test/form_builder/wrapper_test.rb +17 -4
- data/test/inputs/boolean_input_test.rb +14 -0
- data/test/inputs/discovery_test.rb +9 -1
- data/test/inputs/numeric_input_test.rb +6 -0
- data/test/inputs/string_input_test.rb +6 -0
- data/test/support/discovery_inputs.rb +6 -0
- data/test/support/misc_helpers.rb +11 -1
- data/test/support/models.rb +7 -3
- data/test/test_helper.rb +2 -5
- metadata +20 -10
- data/test/support/mock_response.rb +0 -14
| @@ -57,6 +57,12 @@ class StringInputTest < ActionView::TestCase | |
| 57 57 | 
             
                assert_select 'input.string[maxlength=12]'
         | 
| 58 58 | 
             
              end
         | 
| 59 59 |  | 
| 60 | 
            +
              test 'input size and maxlength should be the column limit plus one to make room for decimal point' do
         | 
| 61 | 
            +
                with_input_for @user, :credit_limit, :string
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                assert_select "input.string[maxlength=16][size=16]"
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
             | 
| 60 66 | 
             
              test 'input should not generate placeholder by default' do
         | 
| 61 67 | 
             
                with_input_for @user, :name, :string
         | 
| 62 68 | 
             
                assert_no_select 'input[placeholder]'
         | 
| @@ -54,6 +54,12 @@ module MiscHelpers | |
| 54 54 | 
             
                end
         | 
| 55 55 | 
             
              end
         | 
| 56 56 |  | 
| 57 | 
            +
              def custom_wrapper_with_label_html_option
         | 
| 58 | 
            +
                SimpleForm.build :tag => :div, :class => "custom_wrapper", :label_html => { :class => 'extra-label-class' } do |b|
         | 
| 59 | 
            +
                  b.use :label_input
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
              end
         | 
| 62 | 
            +
             | 
| 57 63 | 
             
              def custom_form_for(object, *args, &block)
         | 
| 58 64 | 
             
                simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
         | 
| 59 65 | 
             
              end
         | 
| @@ -63,7 +69,11 @@ module MiscHelpers | |
| 63 69 | 
             
              end
         | 
| 64 70 |  | 
| 65 71 | 
             
              def with_concat_form_for(*args, &block)
         | 
| 66 | 
            -
                concat simple_form_for(*args, &block)
         | 
| 72 | 
            +
                concat simple_form_for(*args, &(block || proc {}))
         | 
| 73 | 
            +
              end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              def with_concat_fields_for(*args, &block)
         | 
| 76 | 
            +
                concat simple_fields_for(*args, &block)
         | 
| 67 77 | 
             
              end
         | 
| 68 78 |  | 
| 69 79 | 
             
              def with_concat_custom_form_for(*args, &block)
         | 
    
        data/test/support/models.rb
    CHANGED
    
    | @@ -1,8 +1,12 @@ | |
| 1 | 
            -
            require 'ostruct'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            Column = Struct.new(:name, :type, :limit)
         | 
| 4 1 | 
             
            Association = Struct.new(:klass, :name, :macro, :options)
         | 
| 5 2 |  | 
| 3 | 
            +
            class Column < Struct.new(:name, :type, :limit)
         | 
| 4 | 
            +
              # Returns +true+ if the column is either of type integer, float or decimal.
         | 
| 5 | 
            +
              def number?
         | 
| 6 | 
            +
                type == :integer || type == :float || type == :decimal
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 6 10 | 
             
            class Company < Struct.new(:id, :name)
         | 
| 7 11 | 
             
              extend ActiveModel::Naming
         | 
| 8 12 | 
             
              include ActiveModel::Conversion
         | 
    
        data/test/test_helper.rb
    CHANGED
    
    | @@ -32,22 +32,19 @@ I18n.default_locale = :en | |
| 32 32 |  | 
| 33 33 | 
             
            require 'country_select'
         | 
| 34 34 |  | 
| 35 | 
            +
            ActionDispatch::Assertions::NO_STRIP << "label"
         | 
| 36 | 
            +
             | 
| 35 37 | 
             
            class ActionView::TestCase
         | 
| 36 38 | 
             
              include MiscHelpers
         | 
| 37 39 | 
             
              include SimpleForm::ActionViewExtensions::FormHelper
         | 
| 38 40 |  | 
| 39 41 | 
             
              setup :set_controller
         | 
| 40 | 
            -
              setup :set_response
         | 
| 41 42 | 
             
              setup :setup_new_user
         | 
| 42 43 |  | 
| 43 44 | 
             
              def set_controller
         | 
| 44 45 | 
             
                @controller = MockController.new
         | 
| 45 46 | 
             
              end
         | 
| 46 47 |  | 
| 47 | 
            -
              def set_response
         | 
| 48 | 
            -
                @response = MockResponse.new(self)
         | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
             | 
| 51 48 | 
             
              def setup_new_user(options={})
         | 
| 52 49 | 
             
                @user = User.new({
         | 
| 53 50 | 
             
                  :id => 1,
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simple_form
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.0.2
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -11,11 +11,11 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2012- | 
| 14 | 
            +
            date: 2012-04-30 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: activemodel
         | 
| 18 | 
            -
              requirement:  | 
| 18 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 19 19 | 
             
                none: false
         | 
| 20 20 | 
             
                requirements:
         | 
| 21 21 | 
             
                - - ~>
         | 
| @@ -23,10 +23,15 @@ dependencies: | |
| 23 23 | 
             
                    version: '3.0'
         | 
| 24 24 | 
             
              type: :runtime
         | 
| 25 25 | 
             
              prerelease: false
         | 
| 26 | 
            -
              version_requirements:  | 
| 26 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 27 | 
            +
                none: false
         | 
| 28 | 
            +
                requirements:
         | 
| 29 | 
            +
                - - ~>
         | 
| 30 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 31 | 
            +
                    version: '3.0'
         | 
| 27 32 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 33 | 
             
              name: actionpack
         | 
| 29 | 
            -
              requirement:  | 
| 34 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 35 | 
             
                none: false
         | 
| 31 36 | 
             
                requirements:
         | 
| 32 37 | 
             
                - - ~>
         | 
| @@ -34,7 +39,12 @@ dependencies: | |
| 34 39 | 
             
                    version: '3.0'
         | 
| 35 40 | 
             
              type: :runtime
         | 
| 36 41 | 
             
              prerelease: false
         | 
| 37 | 
            -
              version_requirements:  | 
| 42 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 | 
            +
                none: false
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - ~>
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '3.0'
         | 
| 38 48 | 
             
            description: Forms made easy!
         | 
| 39 49 | 
             
            email: contact@plataformatec.com.br
         | 
| 40 50 | 
             
            executables: []
         | 
| @@ -109,6 +119,7 @@ files: | |
| 109 119 | 
             
            - test/form_builder/error_notification_test.rb
         | 
| 110 120 | 
             
            - test/form_builder/error_test.rb
         | 
| 111 121 | 
             
            - test/form_builder/general_test.rb
         | 
| 122 | 
            +
            - test/form_builder/general_test.rb.orig
         | 
| 112 123 | 
             
            - test/form_builder/hint_test.rb
         | 
| 113 124 | 
             
            - test/form_builder/input_field_test.rb
         | 
| 114 125 | 
             
            - test/form_builder/label_test.rb
         | 
| @@ -135,10 +146,9 @@ files: | |
| 135 146 | 
             
            - test/support/discovery_inputs.rb
         | 
| 136 147 | 
             
            - test/support/misc_helpers.rb
         | 
| 137 148 | 
             
            - test/support/mock_controller.rb
         | 
| 138 | 
            -
            - test/support/mock_response.rb
         | 
| 139 149 | 
             
            - test/support/models.rb
         | 
| 140 150 | 
             
            - test/test_helper.rb
         | 
| 141 | 
            -
            homepage:  | 
| 151 | 
            +
            homepage: https://github.com/plataformatec/simple_form
         | 
| 142 152 | 
             
            licenses: []
         | 
| 143 153 | 
             
            post_install_message: 
         | 
| 144 154 | 
             
            rdoc_options: []
         | 
| @@ -158,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 158 168 | 
             
                  version: '0'
         | 
| 159 169 | 
             
            requirements: []
         | 
| 160 170 | 
             
            rubyforge_project: simple_form
         | 
| 161 | 
            -
            rubygems_version: 1.8. | 
| 171 | 
            +
            rubygems_version: 1.8.23
         | 
| 162 172 | 
             
            signing_key: 
         | 
| 163 173 | 
             
            specification_version: 3
         | 
| 164 174 | 
             
            summary: Forms made easy!
         | 
| @@ -171,6 +181,7 @@ test_files: | |
| 171 181 | 
             
            - test/form_builder/error_notification_test.rb
         | 
| 172 182 | 
             
            - test/form_builder/error_test.rb
         | 
| 173 183 | 
             
            - test/form_builder/general_test.rb
         | 
| 184 | 
            +
            - test/form_builder/general_test.rb.orig
         | 
| 174 185 | 
             
            - test/form_builder/hint_test.rb
         | 
| 175 186 | 
             
            - test/form_builder/input_field_test.rb
         | 
| 176 187 | 
             
            - test/form_builder/label_test.rb
         | 
| @@ -197,6 +208,5 @@ test_files: | |
| 197 208 | 
             
            - test/support/discovery_inputs.rb
         | 
| 198 209 | 
             
            - test/support/misc_helpers.rb
         | 
| 199 210 | 
             
            - test/support/mock_controller.rb
         | 
| 200 | 
            -
            - test/support/mock_response.rb
         | 
| 201 211 | 
             
            - test/support/models.rb
         | 
| 202 212 | 
             
            - test/test_helper.rb
         |