simple_form 2.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of simple_form might be problematic. Click here for more details.

Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +77 -33
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +387 -187
  5. data/lib/generators/simple_form/install_generator.rb +4 -4
  6. data/lib/generators/simple_form/templates/README +3 -4
  7. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +45 -22
  8. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +128 -24
  9. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +87 -6
  10. data/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +7 -2
  11. data/lib/simple_form/action_view_extensions/builder.rb +2 -319
  12. data/lib/simple_form/action_view_extensions/form_helper.rb +8 -11
  13. data/lib/simple_form/components/errors.rb +28 -2
  14. data/lib/simple_form/components/hints.rb +8 -3
  15. data/lib/simple_form/components/html5.rb +6 -3
  16. data/lib/simple_form/components/label_input.rb +20 -2
  17. data/lib/simple_form/components/labels.rb +14 -10
  18. data/lib/simple_form/components/maxlength.rb +2 -9
  19. data/lib/simple_form/components/min_max.rb +1 -1
  20. data/lib/simple_form/components/pattern.rb +3 -3
  21. data/lib/simple_form/components/placeholders.rb +2 -2
  22. data/lib/simple_form/components/readonly.rb +1 -1
  23. data/lib/simple_form/components.rb +1 -1
  24. data/lib/simple_form/error_notification.rb +2 -2
  25. data/lib/simple_form/form_builder.rb +262 -107
  26. data/lib/simple_form/helpers.rb +6 -6
  27. data/lib/simple_form/inputs/base.rb +37 -16
  28. data/lib/simple_form/inputs/block_input.rb +2 -2
  29. data/lib/simple_form/inputs/boolean_input.rb +33 -18
  30. data/lib/simple_form/inputs/collection_input.rb +34 -13
  31. data/lib/simple_form/inputs/collection_radio_buttons_input.rb +7 -12
  32. data/lib/simple_form/inputs/collection_select_input.rb +4 -2
  33. data/lib/simple_form/inputs/date_time_input.rb +23 -9
  34. data/lib/simple_form/inputs/file_input.rb +4 -2
  35. data/lib/simple_form/inputs/grouped_collection_select_input.rb +15 -3
  36. data/lib/simple_form/inputs/hidden_input.rb +4 -2
  37. data/lib/simple_form/inputs/numeric_input.rb +3 -8
  38. data/lib/simple_form/inputs/password_input.rb +4 -3
  39. data/lib/simple_form/inputs/priority_input.rb +4 -2
  40. data/lib/simple_form/inputs/range_input.rb +1 -1
  41. data/lib/simple_form/inputs/string_input.rb +4 -3
  42. data/lib/simple_form/inputs/text_input.rb +4 -2
  43. data/lib/simple_form/railtie.rb +14 -0
  44. data/lib/simple_form/tags.rb +68 -0
  45. data/lib/simple_form/version.rb +1 -1
  46. data/lib/simple_form/wrappers/builder.rb +11 -35
  47. data/lib/simple_form/wrappers/leaf.rb +28 -0
  48. data/lib/simple_form/wrappers/many.rb +7 -7
  49. data/lib/simple_form/wrappers/root.rb +2 -2
  50. data/lib/simple_form/wrappers/single.rb +5 -3
  51. data/lib/simple_form/wrappers.rb +2 -1
  52. data/lib/simple_form.rb +99 -52
  53. data/test/action_view_extensions/builder_test.rb +113 -127
  54. data/test/action_view_extensions/form_helper_test.rb +58 -30
  55. data/test/components/label_test.rb +83 -83
  56. data/test/form_builder/association_test.rb +96 -61
  57. data/test/form_builder/button_test.rb +14 -14
  58. data/test/form_builder/error_notification_test.rb +9 -9
  59. data/test/form_builder/error_test.rb +159 -34
  60. data/test/form_builder/general_test.rb +176 -121
  61. data/test/form_builder/hint_test.rb +43 -37
  62. data/test/form_builder/input_field_test.rb +99 -52
  63. data/test/form_builder/label_test.rb +67 -15
  64. data/test/form_builder/wrapper_test.rb +157 -41
  65. data/test/generators/simple_form_generator_test.rb +4 -4
  66. data/test/inputs/boolean_input_test.rb +92 -24
  67. data/test/inputs/collection_check_boxes_input_test.rb +150 -71
  68. data/test/inputs/collection_radio_buttons_input_test.rb +213 -113
  69. data/test/inputs/collection_select_input_test.rb +221 -85
  70. data/test/inputs/datetime_input_test.rb +125 -47
  71. data/test/inputs/disabled_test.rb +25 -25
  72. data/test/inputs/discovery_test.rb +60 -10
  73. data/test/inputs/file_input_test.rb +3 -3
  74. data/test/inputs/general_test.rb +48 -32
  75. data/test/inputs/grouped_collection_select_input_test.rb +76 -27
  76. data/test/inputs/hidden_input_test.rb +6 -5
  77. data/test/inputs/numeric_input_test.rb +46 -46
  78. data/test/inputs/priority_input_test.rb +21 -15
  79. data/test/inputs/readonly_test.rb +31 -31
  80. data/test/inputs/required_test.rb +30 -18
  81. data/test/inputs/string_input_test.rb +53 -52
  82. data/test/inputs/text_input_test.rb +15 -8
  83. data/test/simple_form_test.rb +8 -0
  84. data/test/support/discovery_inputs.rb +32 -2
  85. data/test/support/misc_helpers.rb +130 -29
  86. data/test/support/mock_controller.rb +6 -6
  87. data/test/support/models.rb +125 -71
  88. data/test/test_helper.rb +28 -35
  89. metadata +17 -29
  90. data/lib/simple_form/action_view_extensions/builder.rb.orig +0 -247
  91. data/lib/simple_form/core_ext/hash.rb +0 -16
  92. data/lib/simple_form/form_builder.rb.orig +0 -486
  93. 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.0
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
- * `input_field` supports components that don't generate tags
5
- as `:min_max`, `:maxlength`, `:placeholder`, `:pattern`, `:readonly`.
6
- Closes[#362](https://github.com/plataformatec/simple_form/issues/632).
7
- ([@nashby](https://github.com/nashby))
8
- * support for Rails eager loading.
9
- Closes [#478](https://github.com/plataformatec/simple_form/issues/478).
10
- * generate required attribute for `date_time` input.
11
- ([@nashby](https://github.com/nashby))
12
- Closes [#730](https://github.com/plataformatec/simple_form/issues/730).
13
- * `grouped_collection_select` now accepts proc/lambda as label and value method.
14
- ([@svendahlstrand](https://github.com/svendahlstrand))
15
- Closes [#623](https://github.com/plataformatec/simple_form/issues/623).
16
- * Add Zurb Foundation 3 integration.
17
- ([@balexand](https://github.com/balexand))
18
- * Generates additional wrapper class based on object + attribute name.
19
- ([@lucasmazza](https://github.com/lucasmazza))
20
- Closes [#576](https://github.com/plataformatec/simple_form/issues/576).
21
- * Allow `input_field` to work with `:defaults` options.
22
- ([@smidwap](https://github.com/smidwap))
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
- * Do not lookup for hints if it was explicitly given false.
26
- After #405 we added hint classes for the wrappers, but this has forced the
27
- loading of the hint text doing I18n lookups, even though it was explicitly
28
- given false. This checks for the option in `#has_hint?`, avoiding the lookup
29
- in such cases. This issues has been caught with #627, thanks to
30
- ([@shwoodard](https://github.com/shwoodard)).
31
- * Fix default I18n lookup for association input.
32
- ([@nashby](https://github.com/nashby))
33
- Closes [#679](https://github.com/plataformatec/simple_form/issues/679).
34
- * Fix escaping issue in `label_input` component
35
- ([@allomov](https://github.com/allomov))
36
-
37
- Please check [v2.0](https://github.com/plataformatec/simple_form/blob/v2.0/CHANGELOG.md) for previous changes.
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-2013 Plataformatec http://plataformatec.com.br/
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