simple_form 3.0.4 → 3.1.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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -45
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +204 -81
  5. data/lib/generators/simple_form/install_generator.rb +3 -3
  6. data/lib/generators/simple_form/templates/README +3 -4
  7. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +28 -7
  8. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +115 -24
  9. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +86 -5
  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 +1 -0
  12. data/lib/simple_form/action_view_extensions/form_helper.rb +6 -2
  13. data/lib/simple_form/components/errors.rb +24 -4
  14. data/lib/simple_form/components/hints.rb +2 -2
  15. data/lib/simple_form/components/html5.rb +1 -1
  16. data/lib/simple_form/components/label_input.rb +20 -2
  17. data/lib/simple_form/components/labels.rb +10 -6
  18. data/lib/simple_form/components/maxlength.rb +1 -1
  19. data/lib/simple_form/components/min_max.rb +1 -1
  20. data/lib/simple_form/components/pattern.rb +1 -1
  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/form_builder.rb +122 -74
  24. data/lib/simple_form/helpers.rb +5 -5
  25. data/lib/simple_form/inputs/base.rb +34 -12
  26. data/lib/simple_form/inputs/block_input.rb +1 -1
  27. data/lib/simple_form/inputs/boolean_input.rb +28 -15
  28. data/lib/simple_form/inputs/collection_input.rb +30 -9
  29. data/lib/simple_form/inputs/collection_radio_buttons_input.rb +6 -11
  30. data/lib/simple_form/inputs/collection_select_input.rb +4 -2
  31. data/lib/simple_form/inputs/date_time_input.rb +12 -2
  32. data/lib/simple_form/inputs/file_input.rb +4 -2
  33. data/lib/simple_form/inputs/grouped_collection_select_input.rb +15 -3
  34. data/lib/simple_form/inputs/hidden_input.rb +4 -2
  35. data/lib/simple_form/inputs/numeric_input.rb +5 -4
  36. data/lib/simple_form/inputs/password_input.rb +4 -2
  37. data/lib/simple_form/inputs/priority_input.rb +4 -2
  38. data/lib/simple_form/inputs/range_input.rb +1 -1
  39. data/lib/simple_form/inputs/string_input.rb +4 -2
  40. data/lib/simple_form/inputs/text_input.rb +4 -2
  41. data/lib/simple_form/railtie.rb +7 -0
  42. data/lib/simple_form/tags.rb +6 -0
  43. data/lib/simple_form/version.rb +1 -1
  44. data/lib/simple_form/wrappers/builder.rb +6 -6
  45. data/lib/simple_form/wrappers/leaf.rb +28 -0
  46. data/lib/simple_form/wrappers/many.rb +6 -6
  47. data/lib/simple_form/wrappers/root.rb +1 -1
  48. data/lib/simple_form/wrappers/single.rb +5 -3
  49. data/lib/simple_form/wrappers.rb +1 -0
  50. data/lib/simple_form.rb +59 -8
  51. data/test/action_view_extensions/builder_test.rb +36 -36
  52. data/test/action_view_extensions/form_helper_test.rb +33 -14
  53. data/test/components/label_test.rb +37 -37
  54. data/test/form_builder/association_test.rb +52 -35
  55. data/test/form_builder/button_test.rb +10 -10
  56. data/test/form_builder/error_notification_test.rb +1 -1
  57. data/test/form_builder/error_test.rb +111 -33
  58. data/test/form_builder/general_test.rb +89 -64
  59. data/test/form_builder/hint_test.rb +18 -18
  60. data/test/form_builder/input_field_test.rb +40 -16
  61. data/test/form_builder/label_test.rb +45 -13
  62. data/test/form_builder/wrapper_test.rb +135 -19
  63. data/test/generators/simple_form_generator_test.rb +4 -4
  64. data/test/inputs/boolean_input_test.rb +62 -6
  65. data/test/inputs/collection_check_boxes_input_test.rb +85 -17
  66. data/test/inputs/collection_radio_buttons_input_test.rb +134 -36
  67. data/test/inputs/collection_select_input_test.rb +146 -41
  68. data/test/inputs/datetime_input_test.rb +117 -50
  69. data/test/inputs/disabled_test.rb +15 -15
  70. data/test/inputs/discovery_test.rb +56 -6
  71. data/test/inputs/file_input_test.rb +2 -2
  72. data/test/inputs/general_test.rb +20 -20
  73. data/test/inputs/grouped_collection_select_input_test.rb +44 -8
  74. data/test/inputs/hidden_input_test.rb +4 -4
  75. data/test/inputs/numeric_input_test.rb +43 -43
  76. data/test/inputs/priority_input_test.rb +13 -13
  77. data/test/inputs/readonly_test.rb +19 -19
  78. data/test/inputs/required_test.rb +13 -13
  79. data/test/inputs/string_input_test.rb +50 -30
  80. data/test/inputs/text_input_test.rb +7 -7
  81. data/test/simple_form_test.rb +8 -0
  82. data/test/support/discovery_inputs.rb +32 -2
  83. data/test/support/misc_helpers.rb +71 -5
  84. data/test/support/models.rb +60 -24
  85. data/test/test_helper.rb +5 -1
  86. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffed0afbf1694b8176a255206fc6d658e4a539af
4
- data.tar.gz: 7af2a7a0199551b2b17491d9510c2477aa125265
3
+ metadata.gz: 275599af691b7ba0bd40146940b8936b7b00bb65
4
+ data.tar.gz: bf12768bc9960272a7823e62276f8191a5b293d7
5
5
  SHA512:
6
- metadata.gz: bbf22389176622fe689c4d401526d5c973124245cb3b587b3ff2428053377930a358c31eaf8088ffb2b030cef016d0b59ee790984fdedd1219c4d3daab76ff23
7
- data.tar.gz: a3e826bd625da954e73d5df1cfe546117024c5b7eb08a1ea9eb37e187e25b3479d9549a13b6e853520e68e8eb3d54ed1ead89e2f0de7318df3478d624654c611
6
+ metadata.gz: f62bec40ad89719416a5010cd0ec3eab18a6322289cd817e732061d4b53dd01e6f749a3a1a89caabe2fa233749d9841dea374365572fa91f8dc70755382d6811
7
+ data.tar.gz: 82930fed0d675a74d7e226ebf39e78ebf86807ba583988959be4f633c50f76e3cbc2e2b924d243ce87e5423089610962dab3f1795eb242ce544d985d702c8f36
data/CHANGELOG.md CHANGED
@@ -1,49 +1,49 @@
1
- ## 3.0.4
2
-
3
- ### bug fix
4
- * Fix method reflection for Ruby 2.1+. [@badosu](https://github.com/badosu)
5
- * Do not remove HTML attributes if components are not present.
6
-
7
- ## 3.0.3
8
-
9
- ### bug fix
10
- * Fix XSS vulnerability on error components.
11
-
12
- ## 3.0.2
13
-
14
- ### enhancements
15
-
16
- * Support Rails 4.1
17
-
18
- ## 3.0.1
19
-
20
- ### bug fix
21
- * Fix XSS vulnerability on label, hint and error components.
22
-
23
- ## 3.0.0
1
+ ## 3.1.0
24
2
 
25
3
  ### enhancements
26
- * New `input_class` global config option to set a class to be generated in all inputs.
27
- * Collection tags accept html attributes as the last element of collection [@nashby](https://github.com/nashby)
28
- * Change default `:value_method` of collection tags from `:last` to `:second` [@nashby](https://github.com/nashby)
29
- * Support `Proc` object in `:conditions` option of associations [@bradly](https://github.com/bradly)
30
- * `input_field` supports `html5` component [@nashby](https://github.com/nashby)
31
- * Make `field_error_proc` configurable [@dfens](https://github.com/dfens)
32
- * Support to Rails 4.
33
- * Removed deprecated methods.
34
- * SimpleForm no longer sets the `size` attribute automatically and the `default_input_size` setting
35
- is now deprecated.
36
- * Support to aria-required attribute to required fields [@ckundo](https://github.com/ckundo)
4
+ * Update foundation generator to version 5. [@jorge-d](https://github.com/jorge-d)
5
+ * Add mapping to `uuid` columns.
6
+ * Add custom namespaces for custom inputs feature. [@vala](https://github.com/vala)
7
+ * Add `:unless_blank` option to the wrapper API. [@IanVaughan](https://github.com/IanVaughan)
8
+ * Add support to html markup in the I18n options. [@laurocaetano](https://github.com/laurocaetano)
9
+ * Add the `full_error` component. [@laurocaetano](https://github.com/laurocaetano)
10
+ * Add support to `scope` to be used on associations. [@laurocaetano](https://github.com/laurocaetano)
11
+ * Execute the association `condition` in the object context. [@laurocaetano](https://github.com/laurocaetano)
12
+ * Check if the given association responds to `order` before calling it. [@laurocaetano](https://github.com/laurocaetano)
13
+ * Add Bootstrap 3 initializer template.
14
+ * 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)
15
+ * `input_field` uses the same wrapper as input but only with attribute components. [@nashby](https://github.com/nashby)
16
+ * Add wrapper mapping per form basis [@rcillo](https://github.com/rcillo) and [@bernardoamc](https://github.com/bernardoamc)
17
+ * 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)
18
+ * Add `include_default_input_wrapper_class` config [@luizcosta](https://github.com/luizcosta)
19
+ * Map `datetime`, `date` and `time` input types to their respective HTML5 input tags
20
+ when the `:html5` is set to `true` [@volmer](https://github.com/volmer)
21
+ * Add `boolean_label_class` config.
22
+ * Add `:html` option to include additional attributes on custom wrappers [@remofritzsche](https://github.com/remofritzsche) and [@ulissesalmeida](https://github.com/ulissesalmeida)
23
+ * Make possible to use the Wrappers API to define attributes for the components.
24
+ See https://github.com/plataformatec/simple_form/pull/997 for more information.
25
+ * Put a whitespace before the `inline_label` options of boolean input if it is present.
26
+ * Add support to configure the `label_text` proc at the wrapper level. [@NOX73](https://github.com/NOX73)
27
+ * `label_text` proc now receive three arguments (label, request, and if the label was explicit). [@timscott](https://github.com/timscott)
28
+ * Add I18n support to `:include_blank` and `:prompt` when `:translate` is used as value. [@haines](https://github.com/plataformatec/simple_form/pull/616)
29
+ * Add support to define custom error messages for the attributes.
30
+ * Add support to change the I18n scope to be used in Simple Form. [@nielsbuus](https://github.com/nielsbuus)
31
+ * The default form class can now be overridden with `html: { :class }`. [@rmm5t](https://github.com/rmm5t)
37
32
 
38
33
  ### bug fix
39
- * Make `DateTimeInput#label_target` method to work with string values in `I18n.t('date.order')` (default
40
- behaviour in Rails 4)
41
- Closes [#846](https://github.com/plataformatec/simple_form/issues/846) [@mjankowski](https://github.com/mjankowski)
42
- * Add "checkbox" class to the label of boolean input when there is no `:label`
43
- in `generate_additional_classes_for` config option [@nashby](https://github.com/nashby)
44
- * Support models with digits in their names [@webgago](https://github.com/webgago)
45
- * Remove deprecation warnings related to `Relation#all` from Rails 4.
46
- * Form builder can be used outside the context of a controller [@jasonwebster](https://github.com/jasonwebster)
47
- * Skip pattern attribute when using `validates_format_of` with `:without` option [@glebm](https://github.com/glebm)
48
-
49
- Please check [v2.1](https://github.com/plataformatec/simple_form/blob/v2.1/CHANGELOG.md) for previous changes.
34
+ * Fix `full_error` when the attribute is an association. [@mvdamme](https://github.com/jorge-d)
35
+ * Fix suppport to `:namespace` and `:index` options for nested check boxes and radio buttons when the attribute is an association.
36
+ * Collection input that uses automatic collection translation properly sets checked values.
37
+ Closes [#971](https://github.com/plataformatec/simple_form/issues/971) [@nashby](https://github.com/nashby)
38
+ * Collection input generates `required` attribute if it has `prompt` option. [@nashby](https://github.com/nashby)
39
+ * Grouped collection uses the first non-empty object to detect label and value methods.
40
+
41
+ ## deprecation
42
+ * Methods on custom inputs now accept a required argument with the wrapper options.
43
+ See https://github.com/plataformatec/simple_form/pull/997 for more information.
44
+ * SimpleForm.form_class is deprecated in favor of SimpleForm.default_form_class.
45
+ Future versions of Simple Form will not generate `simple_form` class for the form
46
+ element.
47
+ See https://github.com/plataformatec/simple_form/pull/1109 for more information.
48
+
49
+ 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-2014 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