simple_form 2.1.0 → 3.2.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +77 -33
- data/MIT-LICENSE +1 -1
- data/README.md +387 -187
- data/lib/generators/simple_form/install_generator.rb +4 -4
- data/lib/generators/simple_form/templates/README +3 -4
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +45 -22
- data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +128 -24
- data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +87 -6
- data/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +7 -2
- data/lib/simple_form/action_view_extensions/builder.rb +2 -319
- data/lib/simple_form/action_view_extensions/form_helper.rb +8 -11
- data/lib/simple_form/components/errors.rb +28 -2
- data/lib/simple_form/components/hints.rb +8 -3
- data/lib/simple_form/components/html5.rb +6 -3
- data/lib/simple_form/components/label_input.rb +20 -2
- data/lib/simple_form/components/labels.rb +14 -10
- data/lib/simple_form/components/maxlength.rb +2 -9
- data/lib/simple_form/components/min_max.rb +1 -1
- data/lib/simple_form/components/pattern.rb +3 -3
- data/lib/simple_form/components/placeholders.rb +2 -2
- data/lib/simple_form/components/readonly.rb +1 -1
- data/lib/simple_form/components.rb +1 -1
- data/lib/simple_form/error_notification.rb +2 -2
- data/lib/simple_form/form_builder.rb +262 -107
- data/lib/simple_form/helpers.rb +6 -6
- data/lib/simple_form/inputs/base.rb +37 -16
- data/lib/simple_form/inputs/block_input.rb +2 -2
- data/lib/simple_form/inputs/boolean_input.rb +33 -18
- data/lib/simple_form/inputs/collection_input.rb +34 -13
- data/lib/simple_form/inputs/collection_radio_buttons_input.rb +7 -12
- data/lib/simple_form/inputs/collection_select_input.rb +4 -2
- data/lib/simple_form/inputs/date_time_input.rb +23 -9
- data/lib/simple_form/inputs/file_input.rb +4 -2
- data/lib/simple_form/inputs/grouped_collection_select_input.rb +15 -3
- data/lib/simple_form/inputs/hidden_input.rb +4 -2
- data/lib/simple_form/inputs/numeric_input.rb +3 -8
- data/lib/simple_form/inputs/password_input.rb +4 -3
- data/lib/simple_form/inputs/priority_input.rb +4 -2
- data/lib/simple_form/inputs/range_input.rb +1 -1
- data/lib/simple_form/inputs/string_input.rb +4 -3
- data/lib/simple_form/inputs/text_input.rb +4 -2
- data/lib/simple_form/railtie.rb +14 -0
- data/lib/simple_form/tags.rb +68 -0
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form/wrappers/builder.rb +11 -35
- data/lib/simple_form/wrappers/leaf.rb +28 -0
- data/lib/simple_form/wrappers/many.rb +7 -7
- data/lib/simple_form/wrappers/root.rb +2 -2
- data/lib/simple_form/wrappers/single.rb +5 -3
- data/lib/simple_form/wrappers.rb +2 -1
- data/lib/simple_form.rb +99 -52
- data/test/action_view_extensions/builder_test.rb +113 -127
- data/test/action_view_extensions/form_helper_test.rb +58 -30
- data/test/components/label_test.rb +83 -83
- data/test/form_builder/association_test.rb +96 -61
- data/test/form_builder/button_test.rb +14 -14
- data/test/form_builder/error_notification_test.rb +9 -9
- data/test/form_builder/error_test.rb +159 -34
- data/test/form_builder/general_test.rb +176 -121
- data/test/form_builder/hint_test.rb +43 -37
- data/test/form_builder/input_field_test.rb +99 -52
- data/test/form_builder/label_test.rb +67 -15
- data/test/form_builder/wrapper_test.rb +157 -41
- data/test/generators/simple_form_generator_test.rb +4 -4
- data/test/inputs/boolean_input_test.rb +92 -24
- data/test/inputs/collection_check_boxes_input_test.rb +150 -71
- data/test/inputs/collection_radio_buttons_input_test.rb +213 -113
- data/test/inputs/collection_select_input_test.rb +221 -85
- data/test/inputs/datetime_input_test.rb +125 -47
- data/test/inputs/disabled_test.rb +25 -25
- data/test/inputs/discovery_test.rb +60 -10
- data/test/inputs/file_input_test.rb +3 -3
- data/test/inputs/general_test.rb +48 -32
- data/test/inputs/grouped_collection_select_input_test.rb +76 -27
- data/test/inputs/hidden_input_test.rb +6 -5
- data/test/inputs/numeric_input_test.rb +46 -46
- data/test/inputs/priority_input_test.rb +21 -15
- data/test/inputs/readonly_test.rb +31 -31
- data/test/inputs/required_test.rb +30 -18
- data/test/inputs/string_input_test.rb +53 -52
- data/test/inputs/text_input_test.rb +15 -8
- data/test/simple_form_test.rb +8 -0
- data/test/support/discovery_inputs.rb +32 -2
- data/test/support/misc_helpers.rb +130 -29
- data/test/support/mock_controller.rb +6 -6
- data/test/support/models.rb +125 -71
- data/test/test_helper.rb +28 -35
- metadata +17 -29
- data/lib/simple_form/action_view_extensions/builder.rb.orig +0 -247
- data/lib/simple_form/core_ext/hash.rb +0 -16
- data/lib/simple_form/form_builder.rb.orig +0 -486
- data/lib/simple_form/version.rb.orig +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5db9c72e3a5c06c71d99163bfaf4206c37cf6770
|
4
|
+
data.tar.gz: a79c7066e8584acf008a9c45a13a3055457f131a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40e45eac78c5655e3a4675f4dc0227dc55538bee8f641ac561370b8be4effba398d6b77869cdab97447e6b44ffc8dccb3c74592d9b718e25ff9a6edeb1d453b4
|
7
|
+
data.tar.gz: 9c8ed9f7753bb99bc536b79f37551e13125d5292a3fa071e10370e89bfa37f9d69e56862ab6b2df336699c8a70a256428c1127e8d1555b20e6bc9b810b71523b
|
data/CHANGELOG.md
CHANGED
@@ -1,37 +1,81 @@
|
|
1
|
-
## 2.
|
1
|
+
## 3.2.0
|
2
|
+
|
3
|
+
### bug fix
|
4
|
+
* Improve performance of input generation by disabling support for `_html` translations. This reverts the feature introduced on the 3.1.0 branch
|
5
|
+
|
6
|
+
## 3.1.1
|
7
|
+
|
8
|
+
### enhancements
|
9
|
+
* Add the `disabled_class` to the label when the input is disabled. [@rhodrid](https://github.com/rhodrid)
|
10
|
+
|
11
|
+
### bug fix
|
12
|
+
* Make it possible to override `required` value that was previously set in the wrapper. [@nashby](https://github.com/nashby)
|
13
|
+
|
14
|
+
* `date/time/datetime` inputs now correctly generate the label `for` attribute when
|
15
|
+
HTML5 compatibility is explicitly enabled. [@ericsullivan](https://github.com/ericsullivan)
|
16
|
+
|
17
|
+
* The datetime, date, and time inputs now have a nice format by default on bootstrap.
|
18
|
+
[@ulissesalmeida](https://github.com/ulissesalmeida) [@eltonchrls](https://github.com/eltonchrls)
|
19
|
+
|
20
|
+
* Now it is possible to set custom input mappings for collections.
|
21
|
+
|
22
|
+
Example:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# On configuration:
|
26
|
+
config.input_mappings = { /gender$/ => :check_boxes }
|
27
|
+
|
28
|
+
# On form:
|
29
|
+
f.input :gender, collection: [:male, :female]
|
30
|
+
```
|
31
|
+
[strangeworks](https://github.com/strangeworks)
|
32
|
+
|
33
|
+
## 3.1.0
|
2
34
|
|
3
35
|
### enhancements
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
* support
|
9
|
-
|
10
|
-
*
|
11
|
-
|
12
|
-
|
13
|
-
*
|
14
|
-
|
15
|
-
|
16
|
-
* Add
|
17
|
-
|
18
|
-
*
|
19
|
-
|
20
|
-
|
21
|
-
*
|
22
|
-
|
36
|
+
* Update foundation generator to version 5. [@jorge-d](https://github.com/jorge-d)
|
37
|
+
* Add mapping to `uuid` columns.
|
38
|
+
* Add custom namespaces for custom inputs feature. [@vala](https://github.com/vala)
|
39
|
+
* Add `:unless_blank` option to the wrapper API. [@IanVaughan](https://github.com/IanVaughan)
|
40
|
+
* Add support to html markup in the I18n options. [@laurocaetano](https://github.com/laurocaetano)
|
41
|
+
* Add the `full_error` component. [@laurocaetano](https://github.com/laurocaetano)
|
42
|
+
* Add support to `scope` to be used on associations. [@laurocaetano](https://github.com/laurocaetano)
|
43
|
+
* Execute the association `condition` in the object context. [@laurocaetano](https://github.com/laurocaetano)
|
44
|
+
* Check if the given association responds to `order` before calling it. [@laurocaetano](https://github.com/laurocaetano)
|
45
|
+
* Add Bootstrap 3 initializer template.
|
46
|
+
* For radio or checkbox collection always use `:item_wrapper_tag` to wrap the content and add `label` when using `boolean_style` with `:nested` [@kassio](https://github.com/kassio) and [@erichkist](https://github.com/erichkist)
|
47
|
+
* `input_field` uses the same wrapper as input but only with attribute components. [@nashby](https://github.com/nashby)
|
48
|
+
* Add wrapper mapping per form basis [@rcillo](https://github.com/rcillo) and [@bernardoamc](https://github.com/bernardoamc)
|
49
|
+
* Add `for` attribute to `label` when collections are rendered as radio or checkbox [@erichkist](https://github.com/erichkist), [@ulissesalmeida](https://github.com/ulissesalmeida) and [@fabioyamate](https://github.com/fabioyamate)
|
50
|
+
* Add `include_default_input_wrapper_class` config [@luizcosta](https://github.com/luizcosta)
|
51
|
+
* Map `datetime`, `date` and `time` input types to their respective HTML5 input tags
|
52
|
+
when the `:html5` is set to `true` [@volmer](https://github.com/volmer)
|
53
|
+
* Add `boolean_label_class` config.
|
54
|
+
* Add `:html` option to include additional attributes on custom wrappers [@remofritzsche](https://github.com/remofritzsche) and [@ulissesalmeida](https://github.com/ulissesalmeida)
|
55
|
+
* Make possible to use the Wrappers API to define attributes for the components.
|
56
|
+
See https://github.com/plataformatec/simple_form/pull/997 for more information.
|
57
|
+
* Put a whitespace before the `inline_label` options of boolean input if it is present.
|
58
|
+
* Add support to configure the `label_text` proc at the wrapper level. [@NOX73](https://github.com/NOX73)
|
59
|
+
* `label_text` proc now receive three arguments (label, request, and if the label was explicit). [@timscott](https://github.com/timscott)
|
60
|
+
* Add I18n support to `:include_blank` and `:prompt` when `:translate` is used as value. [@haines](https://github.com/plataformatec/simple_form/pull/616)
|
61
|
+
* Add support to define custom error messages for the attributes.
|
62
|
+
* Add support to change the I18n scope to be used in Simple Form. [@nielsbuus](https://github.com/nielsbuus)
|
63
|
+
* The default form class can now be overridden with `html: { :class }`. [@rmm5t](https://github.com/rmm5t)
|
23
64
|
|
24
65
|
### bug fix
|
25
|
-
*
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
66
|
+
* Fix `full_error` when the attribute is an association. [@mvdamme](https://github.com/jorge-d)
|
67
|
+
* Fix suppport to `:namespace` and `:index` options for nested check boxes and radio buttons when the attribute is an association.
|
68
|
+
* Collection input that uses automatic collection translation properly sets checked values.
|
69
|
+
Closes [#971](https://github.com/plataformatec/simple_form/issues/971) [@nashby](https://github.com/nashby)
|
70
|
+
* Collection input generates `required` attribute if it has `prompt` option. [@nashby](https://github.com/nashby)
|
71
|
+
* Grouped collection uses the first non-empty object to detect label and value methods.
|
72
|
+
|
73
|
+
## deprecation
|
74
|
+
* Methods on custom inputs now accept a required argument with the wrapper options.
|
75
|
+
See https://github.com/plataformatec/simple_form/pull/997 for more information.
|
76
|
+
* SimpleForm.form_class is deprecated in favor of SimpleForm.default_form_class.
|
77
|
+
Future versions of Simple Form will not generate `simple_form` class for the form
|
78
|
+
element.
|
79
|
+
See https://github.com/plataformatec/simple_form/pull/1109 for more information.
|
80
|
+
|
81
|
+
Please check [v3.0](https://github.com/plataformatec/simple_form/blob/v3.0/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2009-
|
1
|
+
Copyright (c) 2009-2015 Plataformatec http://plataformatec.com.br/
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|