simple_form 3.0.1 → 3.1.1

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 +75 -25
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +251 -93
  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 +29 -9
  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 +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 +28 -2
  14. data/lib/simple_form/components/hints.rb +2 -2
  15. data/lib/simple_form/components/html5.rb +5 -5
  16. data/lib/simple_form/components/label_input.rb +20 -2
  17. data/lib/simple_form/components/labels.rb +11 -7
  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 +127 -76
  24. data/lib/simple_form/helpers.rb +5 -5
  25. data/lib/simple_form/inputs/base.rb +33 -11
  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 +7 -12
  30. data/lib/simple_form/inputs/collection_select_input.rb +4 -2
  31. data/lib/simple_form/inputs/date_time_input.rb +23 -9
  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 +144 -24
  58. data/test/form_builder/general_test.rb +107 -71
  59. data/test/form_builder/hint_test.rb +18 -18
  60. data/test/form_builder/input_field_test.rb +86 -56
  61. data/test/form_builder/label_test.rb +55 -13
  62. data/test/form_builder/wrapper_test.rb +136 -20
  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 +120 -48
  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 +25 -13
  79. data/test/inputs/string_input_test.rb +50 -30
  80. data/test/inputs/text_input_test.rb +14 -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 +84 -5
  84. data/test/support/models.rb +60 -24
  85. data/test/test_helper.rb +11 -1
  86. metadata +22 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16a083a7be892436f572b9e055699a94d889d8ca
4
- data.tar.gz: 5240794b73edefddc037c5a528f3a5eb362fb7bc
3
+ metadata.gz: e30c2408e03c6ec8e50e4c96eb6b6ed2496c2c17
4
+ data.tar.gz: 324665062b839154b5c7b2c2fd8d2a603466c854
5
5
  SHA512:
6
- metadata.gz: 54cfce6263962c3918d36467a0681dc31e48262a777110c2e05ebf4f8daa8bf2ce8c0dec773c9cf37d60af34f424936d09766e34ccb98572780c0f877d9051b8
7
- data.tar.gz: 70d460b6f6f5467aa84b599ffc5e1cdbb59b6b581d5cc51ac064c2f2100b1ed70f1550073db7ca3670a4955a2a33a49657b81a3c70b6e3bdccef1a0ab88227e4
6
+ metadata.gz: 1b58ac3394c6237e862f81de9eae3c8511d72a27f3e65ec4c11929f6e30f52378ff325a5c7a336f18015d5707f8bce061e797c264b8fc4a15b95e653f1c8613c
7
+ data.tar.gz: 81e743325007ec095390aac7762bfe62c7ac5e0f1650a133db3834faa8303931b6e287acf5f4ed191241e3d50b9afa1d0aeba68dc43c6d0ae4229fdd27a1b94d
data/CHANGELOG.md CHANGED
@@ -1,32 +1,82 @@
1
- ## 3.0.1
1
+ ## master
2
+
3
+ ## enhancements
4
+
5
+ ## bug fix
6
+
7
+ ## 3.1.1
8
+
9
+ ### enhancements
10
+ * Add the `disabled_class` to the label when the input is disabled. [@rhodrid](https://github.com/rhodrid)
2
11
 
3
12
  ### bug fix
4
- * Fix XSS vulnerability on label, hint and error components.
13
+ * Make it possible to override `required` value that was previously set in the wrapper. [@nashby](https://github.com/nashby)
14
+
15
+ * `date/time/datetime` inputs now correctly generate the label `for` attribute when
16
+ HTML5 compatibility is explicitly enabled. [@ericsullivan](https://github.com/ericsullivan)
17
+
18
+ * The datetime, date, and time inputs now have a nice format by default on bootstrap.
19
+ [ulissesalmeida](https://github.com/ulissesalmeida) [eltonchrls](https://github.com/eltonchrls)
5
20
 
6
- ## 3.0.0
21
+ * Now it is possible to set custom input mappings for collections.
22
+
23
+ Example:
24
+
25
+ ```ruby
26
+ # On configuration:
27
+ config.input_mappings = { /gender$/ => :check_boxes }
28
+
29
+ # On form:
30
+ f.input :gender, collection: [:male, :female]
31
+ ```
32
+ [strangeworks](https://github.com/strangeworks)
33
+
34
+ ## 3.1.0
7
35
 
8
36
  ### enhancements
9
- * New `input_class` global config option to set a class to be generated in all inputs.
10
- * Collection tags accept html attributes as the last element of collection [@nashby](https://github.com/nashby)
11
- * Change default `:value_method` of collection tags from `:last` to `:second` [@nashby](https://github.com/nashby)
12
- * Support `Proc` object in `:conditions` option of associations [@bradly](https://github.com/bradly)
13
- * `input_field` supports `html5` component [@nashby](https://github.com/nashby)
14
- * Make `field_error_proc` configurable [@dfens](https://github.com/dfens)
15
- * Support to Rails 4.
16
- * Removed deprecated methods.
17
- * SimpleForm no longer sets the `size` attribute automatically and the `default_input_size` setting
18
- is now deprecated.
19
- * Support to aria-required attribute to required fields [@ckundo](https://github.com/ckundo)
37
+ * Update foundation generator to version 5. [@jorge-d](https://github.com/jorge-d)
38
+ * Add mapping to `uuid` columns.
39
+ * Add custom namespaces for custom inputs feature. [@vala](https://github.com/vala)
40
+ * Add `:unless_blank` option to the wrapper API. [@IanVaughan](https://github.com/IanVaughan)
41
+ * Add support to html markup in the I18n options. [@laurocaetano](https://github.com/laurocaetano)
42
+ * Add the `full_error` component. [@laurocaetano](https://github.com/laurocaetano)
43
+ * Add support to `scope` to be used on associations. [@laurocaetano](https://github.com/laurocaetano)
44
+ * Execute the association `condition` in the object context. [@laurocaetano](https://github.com/laurocaetano)
45
+ * Check if the given association responds to `order` before calling it. [@laurocaetano](https://github.com/laurocaetano)
46
+ * Add Bootstrap 3 initializer template.
47
+ * 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)
48
+ * `input_field` uses the same wrapper as input but only with attribute components. [@nashby](https://github.com/nashby)
49
+ * Add wrapper mapping per form basis [@rcillo](https://github.com/rcillo) and [@bernardoamc](https://github.com/bernardoamc)
50
+ * 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)
51
+ * Add `include_default_input_wrapper_class` config [@luizcosta](https://github.com/luizcosta)
52
+ * Map `datetime`, `date` and `time` input types to their respective HTML5 input tags
53
+ when the `:html5` is set to `true` [@volmer](https://github.com/volmer)
54
+ * Add `boolean_label_class` config.
55
+ * Add `:html` option to include additional attributes on custom wrappers [@remofritzsche](https://github.com/remofritzsche) and [@ulissesalmeida](https://github.com/ulissesalmeida)
56
+ * Make possible to use the Wrappers API to define attributes for the components.
57
+ See https://github.com/plataformatec/simple_form/pull/997 for more information.
58
+ * Put a whitespace before the `inline_label` options of boolean input if it is present.
59
+ * Add support to configure the `label_text` proc at the wrapper level. [@NOX73](https://github.com/NOX73)
60
+ * `label_text` proc now receive three arguments (label, request, and if the label was explicit). [@timscott](https://github.com/timscott)
61
+ * Add I18n support to `:include_blank` and `:prompt` when `:translate` is used as value. [@haines](https://github.com/plataformatec/simple_form/pull/616)
62
+ * Add support to define custom error messages for the attributes.
63
+ * Add support to change the I18n scope to be used in Simple Form. [@nielsbuus](https://github.com/nielsbuus)
64
+ * The default form class can now be overridden with `html: { :class }`. [@rmm5t](https://github.com/rmm5t)
20
65
 
21
66
  ### bug fix
22
- * Make `DateTimeInput#label_target` method to work with string values in `I18n.t('date.order')` (default
23
- behaviour in Rails 4)
24
- Closes [#846](https://github.com/plataformatec/simple_form/issues/846) [@mjankowski](https://github.com/mjankowski)
25
- * Add "checkbox" class to the label of boolean input when there is no `:label`
26
- in `generate_additional_classes_for` config option [@nashby](https://github.com/nashby)
27
- * Support models with digits in their names [@webgago](https://github.com/webgago)
28
- * Remove deprecation warnings related to `Relation#all` from Rails 4.
29
- * Form builder can be used outside the context of a controller [@jasonwebster](https://github.com/jasonwebster)
30
- * Skip pattern attribute when using `validates_format_of` with `:without` option [@glebm](https://github.com/glebm)
31
-
32
- Please check [v2.1](https://github.com/plataformatec/simple_form/blob/v2.1/CHANGELOG.md) for previous changes.
67
+ * Fix `full_error` when the attribute is an association. [@mvdamme](https://github.com/jorge-d)
68
+ * Fix suppport to `:namespace` and `:index` options for nested check boxes and radio buttons when the attribute is an association.
69
+ * Collection input that uses automatic collection translation properly sets checked values.
70
+ Closes [#971](https://github.com/plataformatec/simple_form/issues/971) [@nashby](https://github.com/nashby)
71
+ * Collection input generates `required` attribute if it has `prompt` option. [@nashby](https://github.com/nashby)
72
+ * Grouped collection uses the first non-empty object to detect label and value methods.
73
+
74
+ ## deprecation
75
+ * Methods on custom inputs now accept a required argument with the wrapper options.
76
+ See https://github.com/plataformatec/simple_form/pull/997 for more information.
77
+ * SimpleForm.form_class is deprecated in favor of SimpleForm.default_form_class.
78
+ Future versions of Simple Form will not generate `simple_form` class for the form
79
+ element.
80
+ See https://github.com/plataformatec/simple_form/pull/1109 for more information.
81
+
82
+ 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