simple_form 3.1.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +148 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +278 -68
  5. data/lib/generators/simple_form/install_generator.rb +1 -0
  6. data/lib/generators/simple_form/templates/README +3 -3
  7. data/lib/generators/simple_form/templates/_form.html.erb +2 -0
  8. data/lib/generators/simple_form/templates/_form.html.haml +2 -0
  9. data/lib/generators/simple_form/templates/_form.html.slim +1 -0
  10. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +19 -9
  11. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +367 -63
  12. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +23 -8
  13. data/lib/simple_form/action_view_extensions/builder.rb +1 -0
  14. data/lib/simple_form/action_view_extensions/form_helper.rb +4 -1
  15. data/lib/simple_form/components/errors.rb +15 -2
  16. data/lib/simple_form/components/hints.rb +1 -0
  17. data/lib/simple_form/components/html5.rb +15 -4
  18. data/lib/simple_form/components/label_input.rb +2 -1
  19. data/lib/simple_form/components/labels.rb +12 -5
  20. data/lib/simple_form/components/maxlength.rb +8 -4
  21. data/lib/simple_form/components/min_max.rb +1 -0
  22. data/lib/simple_form/components/minlength.rb +38 -0
  23. data/lib/simple_form/components/pattern.rb +1 -0
  24. data/lib/simple_form/components/placeholders.rb +2 -1
  25. data/lib/simple_form/components/readonly.rb +1 -0
  26. data/lib/simple_form/components.rb +2 -0
  27. data/lib/simple_form/error_notification.rb +1 -0
  28. data/lib/simple_form/form_builder.rb +117 -35
  29. data/lib/simple_form/helpers/autofocus.rb +1 -0
  30. data/lib/simple_form/helpers/disabled.rb +1 -0
  31. data/lib/simple_form/helpers/readonly.rb +1 -0
  32. data/lib/simple_form/helpers/required.rb +1 -0
  33. data/lib/simple_form/helpers/validators.rb +2 -1
  34. data/lib/simple_form/helpers.rb +1 -0
  35. data/lib/simple_form/i18n_cache.rb +1 -0
  36. data/lib/simple_form/inputs/base.rb +36 -12
  37. data/lib/simple_form/inputs/block_input.rb +1 -0
  38. data/lib/simple_form/inputs/boolean_input.rb +14 -3
  39. data/lib/simple_form/inputs/collection_check_boxes_input.rb +2 -1
  40. data/lib/simple_form/inputs/collection_input.rb +7 -5
  41. data/lib/simple_form/inputs/collection_radio_buttons_input.rb +3 -2
  42. data/lib/simple_form/inputs/collection_select_input.rb +1 -0
  43. data/lib/simple_form/inputs/color_input.rb +14 -0
  44. data/lib/simple_form/inputs/date_time_input.rb +13 -8
  45. data/lib/simple_form/inputs/file_input.rb +1 -0
  46. data/lib/simple_form/inputs/grouped_collection_select_input.rb +1 -0
  47. data/lib/simple_form/inputs/hidden_input.rb +1 -0
  48. data/lib/simple_form/inputs/numeric_input.rb +1 -0
  49. data/lib/simple_form/inputs/password_input.rb +2 -1
  50. data/lib/simple_form/inputs/priority_input.rb +1 -4
  51. data/lib/simple_form/inputs/range_input.rb +1 -0
  52. data/lib/simple_form/inputs/string_input.rb +3 -2
  53. data/lib/simple_form/inputs/text_input.rb +2 -1
  54. data/lib/simple_form/inputs.rb +2 -0
  55. data/lib/simple_form/map_type.rb +1 -0
  56. data/lib/simple_form/railtie.rb +1 -0
  57. data/lib/simple_form/tags.rb +7 -2
  58. data/lib/simple_form/version.rb +2 -1
  59. data/lib/simple_form/wrappers/builder.rb +1 -0
  60. data/lib/simple_form/wrappers/leaf.rb +2 -1
  61. data/lib/simple_form/wrappers/many.rb +1 -0
  62. data/lib/simple_form/wrappers/root.rb +2 -0
  63. data/lib/simple_form/wrappers/single.rb +2 -1
  64. data/lib/simple_form/wrappers.rb +1 -0
  65. data/lib/simple_form.rb +79 -14
  66. data/test/action_view_extensions/builder_test.rb +28 -9
  67. data/test/action_view_extensions/form_helper_test.rb +3 -2
  68. data/test/components/custom_components_test.rb +62 -0
  69. data/test/components/label_test.rb +33 -4
  70. data/test/form_builder/association_test.rb +33 -2
  71. data/test/form_builder/button_test.rb +1 -0
  72. data/test/form_builder/error_notification_test.rb +1 -0
  73. data/test/form_builder/error_test.rb +44 -9
  74. data/test/form_builder/general_test.rb +92 -20
  75. data/test/form_builder/hint_test.rb +6 -0
  76. data/test/form_builder/input_field_test.rb +76 -70
  77. data/test/form_builder/label_test.rb +27 -4
  78. data/test/form_builder/wrapper_test.rb +66 -14
  79. data/test/generators/simple_form_generator_test.rb +4 -3
  80. data/test/inputs/boolean_input_test.rb +35 -0
  81. data/test/inputs/collection_check_boxes_input_test.rb +38 -14
  82. data/test/inputs/collection_radio_buttons_input_test.rb +48 -24
  83. data/test/inputs/collection_select_input_test.rb +40 -39
  84. data/test/inputs/color_input_test.rb +10 -0
  85. data/test/inputs/datetime_input_test.rb +12 -8
  86. data/test/inputs/disabled_test.rb +14 -0
  87. data/test/inputs/discovery_test.rb +23 -0
  88. data/test/inputs/file_input_test.rb +1 -0
  89. data/test/inputs/general_test.rb +3 -2
  90. data/test/inputs/grouped_collection_select_input_test.rb +11 -10
  91. data/test/inputs/hidden_input_test.rb +1 -0
  92. data/test/inputs/numeric_input_test.rb +5 -1
  93. data/test/inputs/priority_input_test.rb +7 -6
  94. data/test/inputs/readonly_test.rb +1 -0
  95. data/test/inputs/required_test.rb +45 -0
  96. data/test/inputs/string_input_test.rb +18 -16
  97. data/test/inputs/text_input_test.rb +13 -0
  98. data/test/simple_form_test.rb +1 -0
  99. data/test/support/discovery_inputs.rb +8 -0
  100. data/test/support/misc_helpers.rb +44 -2
  101. data/test/support/mock_controller.rb +7 -1
  102. data/test/support/models.rb +105 -22
  103. data/test/test_helper.rb +14 -3
  104. metadata +42 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 275599af691b7ba0bd40146940b8936b7b00bb65
4
- data.tar.gz: bf12768bc9960272a7823e62276f8191a5b293d7
2
+ SHA256:
3
+ metadata.gz: a1bfd4d5f14c750caf9e2fa6287033c0331473215737a96b4bcece8e6f84a7a9
4
+ data.tar.gz: 9c09b014e449f5b8823c062092b864e538c638fd418d782919a9c0a3cd50df78
5
5
  SHA512:
6
- metadata.gz: f62bec40ad89719416a5010cd0ec3eab18a6322289cd817e732061d4b53dd01e6f749a3a1a89caabe2fa233749d9841dea374365572fa91f8dc70755382d6811
7
- data.tar.gz: 82930fed0d675a74d7e226ebf39e78ebf86807ba583988959be4f633c50f76e3cbc2e2b924d243ce87e5423089610962dab3f1795eb242ce544d985d702c8f36
6
+ metadata.gz: 620056c8b34f6f93229b2ee0771adb0aa7d267fcc22b9d94c214f62287061930e9b0e35a648f47a890452cb8098bc57643a1dce7bbed3df3c2058546b58c5090
7
+ data.tar.gz: 4fa4e5a106b9065405fbba77b8a84ed99e86d84ea4a4435d0a459ee0196a020afbec0ec62fcd2c79f8885d771e48700409ae055ea4858d15b2b5ddd9c3fb5168
data/CHANGELOG.md CHANGED
@@ -1,3 +1,151 @@
1
+ ## Unreleased
2
+
3
+ ## 5.0.0
4
+
5
+ ### Enhancements
6
+ * Set multiple attribute for grouped selects also. [@ollym](https://github.com/ollym)
7
+ * Removes or renames label classes. [Abduvakilov](https://github.com/Abduvakilov)
8
+ * Support to label custom classes for inline collections. [@feliperenan](https://github.com/feliperenan)
9
+ * Update bootstrap generator template to match v4.3.x. [@m5o](https://github.com/m5o)
10
+ * Allow "required" attribute in generated select elements of PriorityInput. [@mcountis](https://github.com/mcountis)
11
+
12
+ ### Bug fix
13
+ * Do not call `#send` in form object to check whether the attribute is a file input. [@tegon](https://github.com/tegon)
14
+
15
+ ## Deprecations
16
+ * The config `SimpleForm.file_methods` is deprecated and it has no effect. Simple Form now supports automatically discover of file inputs for the following Gems: activestorage, carrierwave, paperclip, refile and shrine. If you are using a custom method that is not from one of the supported Gems, please change your forms to pass the input type explicitly:
17
+
18
+ ```erb
19
+ <%= form.input :avatar, as: :file %>
20
+ ```
21
+
22
+ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-form-cve-2019-16676 for more information.
23
+
24
+ ## 4.1.0
25
+
26
+ ### Enhancements
27
+ * Guess input type more carefully. [@sringling](https://github.com/sringling)
28
+ * Allow custom error on forms without model. [@victorperez](https://github.com/victorperez)
29
+ * Do not support Ruby < 2.3 anymore. [@gssbzn](https://github.com/gssbzn)
30
+ * Add color input type. [@gssbzn](https://github.com/gssbzn)
31
+
32
+ ### Bug fix
33
+ * Improve disabled option to input_field. [@betelgeuse](https://github.com/betelgeuse)
34
+ * Memoize `input_html_classes` in `SimpleForm::Inputs::Base`. [@RigoTheDev](https://github.com/RigoTheDev)
35
+ * Fix column type citext HTML5 input type bug. [@brucew](https://github.com/brucew)
36
+ * Use form attribute in the nested boolean hidden field when it is given. [@feliperenan](https://github.com/feliperenan)
37
+
38
+ ## 4.0.1
39
+
40
+ ### Bug fix
41
+ * Do not support Rails 4 anymore. [@rafaelfranca](https://github.com/rafaelfranca)
42
+ * Add missing comma. [@vill](https://github.com/vill)
43
+
44
+ ## 4.0.0
45
+
46
+ ### Enhancements
47
+ * Add bootstrap v4.1 generator template. [@m5o](https://github.com/m5o)
48
+ * Add Rails 5.2 support. [@gobijan](https://github.com/gobijan)
49
+ * Add API to register custom components.[@feliperenan](https://github.com/feliperenan)
50
+ * Allow custom errors classes to inputs.[@feliperenan](https://github.com/feliperenan)
51
+ * Remove support from Rails 4.0, 4.1 and 4.2. [@feliperenan](https://github.com/feliperenan)
52
+ * Add support for citext, hstore, json & jsonb column types. [@swrobel](https://github.com/swrobel)
53
+ * Add :valid_class on input wrapper when value is present and valid [@aeberlin](https://github.com/aeberlin), [@m5o](https://github.com/m5o)
54
+ * Allow :valid_class to inputs when value is present and valid. [@m5o](https://github.com/m5o)
55
+ * Allow validation classes on input_field. [@feliperenan](https://github.com/feliperenan)
56
+ * Add basic ActiveStorage support. [@murb](https://github.com/murb)
57
+
58
+ ### Bug fix
59
+ * Fix horizontal form label position, from right to text-right. [@cavpollo](https://github.com/cavpollo)
60
+ * Add base error display alongside existing errors. [@bluefalcon26](https://github.com/bluefalcon26)
61
+ * Silent deprication warning for placeholder_text. [@moofkit](https://github.com/moofkit)
62
+ * Use custom i18n scope for label required html. [@tvdeyen](https://github.com/tvdeyen)
63
+
64
+ ## 3.5.1
65
+
66
+ ### Enhancements
67
+ * Exclude hidden field when unchecked_value: false. [@fschwahn](https://github.com/fschwahn)
68
+ * Add frozen_string_literal magic comment to several files. [@oniofchaos](https://github.com/oniofchaos)
69
+ * Try convert @object to model in case we got decorated object [@timurvafin](https://github.com/timurvafin)
70
+ - From now, if you are using some object that inherits from `SimpleDelegator`, you must implement
71
+ `def to_model; self; end`. Otherwise, *Simple Form* will convert the decorated object to the model
72
+ since `SimpleDelegator` will delegate it to the model.
73
+ * Code cleanup [@Fornacula](https://github.com/Fornacula)
74
+
75
+ ### Bug fix
76
+ * Fix error when the scope from association has parameter. [@feliperenan](https://github.com/feliperenan)
77
+ * Only call `where` on associations when they respond to it. [@anicholson](https://github.com/anicholson)
78
+ * require 'action_pack' before using it. [@etagwerker](https://github.com/etagwerker)
79
+ * Check if Rails.env is defined. [@etagwerker](https://github.com/etagwerker)
80
+ * Fix minlength. [@mameier](https://github.com/mameier)
81
+ * Make errors_on_attribute return [] when not present. [@redrick](https://github.com/redrick)
82
+ * Fix boolean inputs in nested style for label non-string. [@feliperenan](https://github.com/feliperenan)
83
+
84
+ ## 3.5.0
85
+
86
+ * Updated gem dependency to support Rails 5.1.x.
87
+
88
+ ## 3.4.0
89
+
90
+ * Removed Ruby 2.4.0 `Integer` unification deprecation warning.
91
+ * Removed EOL Ruby 1.9.3 from the build matrix.
92
+ * Added `minlength` component.
93
+ * `boolean_label_class` can be set on a per-input basis.
94
+
95
+ ## 3.3.1
96
+
97
+ ### Bug fix
98
+
99
+ * Fix support for symbols when looking up types with `ActiveModel::Type`.
100
+
101
+ ## 3.3.0
102
+
103
+ ### enhancements
104
+ * Add the `aria-invalid` attribute on inputs with errors.
105
+ * Added support for the new `ActiveModel::Type` API over Active Record's
106
+ column objects.
107
+
108
+ ### bug fix
109
+ * Fix `merge_wrapper_options` to correctly merge options with duplicated keys. [@herminiotorres](https://github.com/herminiotorres)
110
+ Closes [#1278](https://github.com/plataformatec/simple_form/issues/1278).
111
+
112
+ ## 3.2.1
113
+
114
+ ### enhancements
115
+ * Updated gem dependency to support Rails 5.0.x.
116
+
117
+ ## 3.2.0
118
+
119
+ ### bug fix
120
+ * Improve performance of input generation by disabling support for `_html` translations. This reverts the feature introduced on the 3.1.0 branch
121
+
122
+ ## 3.1.1
123
+
124
+ ### enhancements
125
+ * Add the `disabled_class` to the label when the input is disabled. [@rhodrid](https://github.com/rhodrid)
126
+
127
+ ### bug fix
128
+ * Make it possible to override `required` value that was previously set in the wrapper. [@nashby](https://github.com/nashby)
129
+
130
+ * `date/time/datetime` inputs now correctly generate the label `for` attribute when
131
+ HTML5 compatibility is explicitly enabled. [@ericsullivan](https://github.com/ericsullivan)
132
+
133
+ * The datetime, date, and time inputs now have a nice format by default on bootstrap.
134
+ [@ulissesalmeida](https://github.com/ulissesalmeida) [@eltonchrls](https://github.com/eltonchrls)
135
+
136
+ * Now it is possible to set custom input mappings for collections.
137
+
138
+ Example:
139
+
140
+ ```ruby
141
+ # On configuration:
142
+ config.input_mappings = { /gender$/ => :check_boxes }
143
+
144
+ # On form:
145
+ f.input :gender, collection: [:male, :female]
146
+ ```
147
+ [strangeworks](https://github.com/strangeworks)
148
+
1
149
  ## 3.1.0
2
150
 
3
151
  ### enhancements
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009-2014 Plataformatec http://plataformatec.com.br/
1
+ Copyright (c) 2009-2019 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