simple_form 3.0.4 → 3.1.0.rc1

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -43
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +146 -71
  5. data/lib/generators/simple_form/install_generator.rb +2 -2
  6. data/lib/generators/simple_form/templates/README +3 -4
  7. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +19 -3
  8. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +83 -22
  9. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +1 -1
  10. data/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +7 -2
  11. data/lib/simple_form.rb +38 -6
  12. data/lib/simple_form/action_view_extensions/form_helper.rb +1 -1
  13. data/lib/simple_form/components/errors.rb +27 -5
  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 +9 -5
  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 +92 -59
  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 +23 -13
  28. data/lib/simple_form/inputs/collection_input.rb +32 -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 +7 -0
  43. data/lib/simple_form/version.rb +1 -1
  44. data/lib/simple_form/wrappers.rb +1 -0
  45. data/lib/simple_form/wrappers/builder.rb +5 -5
  46. data/lib/simple_form/wrappers/leaf.rb +28 -0
  47. data/lib/simple_form/wrappers/many.rb +5 -6
  48. data/lib/simple_form/wrappers/root.rb +1 -1
  49. data/lib/simple_form/wrappers/single.rb +5 -3
  50. data/test/action_view_extensions/builder_test.rb +2 -2
  51. data/test/components/label_test.rb +1 -1
  52. data/test/form_builder/association_test.rb +17 -0
  53. data/test/form_builder/error_notification_test.rb +1 -1
  54. data/test/form_builder/error_test.rb +51 -32
  55. data/test/form_builder/general_test.rb +2 -2
  56. data/test/form_builder/input_field_test.rb +21 -37
  57. data/test/form_builder/label_test.rb +24 -1
  58. data/test/form_builder/wrapper_test.rb +67 -0
  59. data/test/generators/simple_form_generator_test.rb +2 -2
  60. data/test/inputs/boolean_input_test.rb +50 -2
  61. data/test/inputs/collection_check_boxes_input_test.rb +40 -11
  62. data/test/inputs/collection_radio_buttons_input_test.rb +76 -17
  63. data/test/inputs/collection_select_input_test.rb +108 -3
  64. data/test/inputs/datetime_input_test.rb +105 -38
  65. data/test/inputs/discovery_test.rb +12 -1
  66. data/test/inputs/grouped_collection_select_input_test.rb +36 -0
  67. data/test/inputs/string_input_test.rb +20 -0
  68. data/test/simple_form_test.rb +8 -0
  69. data/test/support/discovery_inputs.rb +12 -2
  70. data/test/support/misc_helpers.rb +46 -8
  71. data/test/support/models.rb +49 -24
  72. metadata +7 -7
@@ -4,12 +4,12 @@ module SimpleForm
4
4
  desc "Copy SimpleForm default files"
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
  class_option :template_engine, desc: 'Template engine to be invoked (erb, haml or slim).'
7
- class_option :bootstrap, type: :boolean, desc: 'Add the Twitter Bootstrap wrappers to the SimpleForm initializer.'
7
+ class_option :bootstrap, type: :boolean, desc: 'Add the Bootstrap wrappers to the SimpleForm initializer.'
8
8
  class_option :foundation, type: :boolean, desc: 'Add the Zurb Foundation 3 wrappers to the SimpleForm initializer.'
9
9
 
10
10
  def info_bootstrap
11
11
  return if options.bootstrap? || options.foundation?
12
- puts "SimpleForm 2 supports Twitter Bootstrap and Zurb Foundation 3. If you want "\
12
+ puts "SimpleForm 2 supports Bootstrap and Zurb Foundation 3. If you want "\
13
13
  "a configuration that is compatible with one of these frameworks, then please " \
14
14
  "re-run this generator with --bootstrap or --foundation as an option."
15
15
  end
@@ -1,12 +1,11 @@
1
1
  ===============================================================================
2
2
 
3
3
  Be sure to have a copy of the Bootstrap stylesheet available on your
4
- application, you can get it on http://twitter.github.com/bootstrap.
4
+ application, you can get it on http://getbootstrap.com/.
5
5
 
6
6
  Inside your views, use the 'simple_form_for' with one of the Bootstrap form
7
- classes, '.form-horizontal', '.form-inline', '.form-search' or
8
- '.form-vertical', as the following:
7
+ classes, '.form-horizontal' or '.form-inline', as the following:
9
8
 
10
- = simple_form_for(@user, html: {class: 'form-horizontal' }) do |form|
9
+ = simple_form_for(@user, html: { class: 'form-horizontal' }) do |form|
11
10
 
12
11
  ===============================================================================
@@ -43,6 +43,12 @@ SimpleForm.setup do |config|
43
43
  b.use :label_input
44
44
  b.use :hint, wrap_with: { tag: :span, class: :hint }
45
45
  b.use :error, wrap_with: { tag: :span, class: :error }
46
+
47
+ ## full_messages_for
48
+ # If you want to display the full error message for the attribute, you can
49
+ # use the component :full_error, like:
50
+ #
51
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
46
52
  end
47
53
 
48
54
  # The default wrapper to be used by the FormBuilder.
@@ -66,7 +72,7 @@ SimpleForm.setup do |config|
66
72
  config.error_notification_tag = :div
67
73
 
68
74
  # CSS class to add for error notification helper.
69
- config.error_notification_class = 'alert alert-error'
75
+ config.error_notification_class = 'error_notification'
70
76
 
71
77
  # ID to add for error notification helper.
72
78
  # config.error_notification_id = nil
@@ -92,10 +98,10 @@ SimpleForm.setup do |config|
92
98
  # config.item_wrapper_class = nil
93
99
 
94
100
  # How the label text should be generated altogether with the required text.
95
- # config.label_text = lambda { |label, required| "#{required} #{label}" }
101
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
96
102
 
97
103
  # You can define the class to use on all labels. Default is nil.
98
- config.label_class = 'control-label'
104
+ # config.label_class = nil
99
105
 
100
106
  # You can define the class to use on all forms. Default is simple_form.
101
107
  # config.form_class = :simple_form
@@ -142,4 +148,14 @@ SimpleForm.setup do |config|
142
148
 
143
149
  # Default class for inputs
144
150
  # config.input_class = nil
151
+
152
+ # Define the default class of the input wrapper of the boolean input.
153
+ config.boolean_label_class = 'checkbox'
154
+
155
+ # Defines if the default input wrapper class should be included in radio
156
+ # collection wrappers.
157
+ # config.include_default_input_wrapper_class = true
158
+
159
+ # Defines which i18n scope will be used in Simple Form.
160
+ # config.i18n_scope = 'simple_form'
145
161
  end
@@ -1,45 +1,106 @@
1
1
  # Use this setup block to configure all options available in SimpleForm.
2
2
  SimpleForm.setup do |config|
3
- config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
3
+ config.button_class = 'btn btn-default'
4
+ config.boolean_label_class = nil
5
+
6
+ config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
4
7
  b.use :html5
5
8
  b.use :placeholder
6
- b.use :label
7
- b.wrapper tag: 'div', class: 'controls' do |ba|
9
+ b.use :label, class: 'control-label'
10
+
11
+ b.wrapper tag: 'div' do |ba|
12
+ ba.use :input, class: 'form-control'
13
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
14
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
15
+ end
16
+ end
17
+
18
+ config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
19
+ b.use :html5
20
+ b.use :placeholder
21
+ b.use :label, class: 'control-label'
22
+
23
+ b.wrapper tag: 'div' do |ba|
8
24
  ba.use :input
9
- ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
25
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
10
26
  ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
11
27
  end
12
28
  end
13
29
 
14
- config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
30
+ config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
15
31
  b.use :html5
16
32
  b.use :placeholder
17
- b.use :label
18
- b.wrapper tag: 'div', class: 'controls' do |input|
19
- input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
20
- prepend.use :input
21
- end
22
- input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
23
- input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
33
+
34
+ b.wrapper tag: 'div', class: 'checkbox' do |ba|
35
+ ba.use :label_input
36
+ end
37
+
38
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
39
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
40
+ end
41
+
42
+ config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
43
+ b.use :html5
44
+ b.use :placeholder
45
+ b.use :label_input
46
+ b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
47
+ b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
48
+ end
49
+
50
+ config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
51
+ b.use :html5
52
+ b.use :placeholder
53
+ b.use :label, class: 'col-sm-3 control-label'
54
+
55
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
56
+ ba.use :input, class: 'form-control'
57
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
58
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
24
59
  end
25
60
  end
26
61
 
27
- config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
62
+ config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
28
63
  b.use :html5
29
64
  b.use :placeholder
30
- b.use :label
31
- b.wrapper tag: 'div', class: 'controls' do |input|
32
- input.wrapper tag: 'div', class: 'input-append' do |append|
33
- append.use :input
65
+ b.use :label, class: 'col-sm-3 control-label'
66
+
67
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
68
+ ba.use :input
69
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
70
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
71
+ end
72
+ end
73
+
74
+ config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
75
+ b.use :html5
76
+ b.use :placeholder
77
+
78
+ b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
79
+ wr.wrapper tag: 'div', class: 'checkbox' do |ba|
80
+ ba.use :label_input, class: 'col-sm-9'
34
81
  end
35
- input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
36
- input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
82
+
83
+ wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
84
+ wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
85
+ end
86
+ end
87
+
88
+ config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
89
+ b.use :html5
90
+ b.use :placeholder
91
+
92
+ b.use :label, class: 'col-sm-3 control-label'
93
+
94
+ b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
95
+ ba.use :input
96
+ ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
97
+ ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
37
98
  end
38
99
  end
39
100
 
40
- # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
41
- # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
101
+ # Wrappers for forms and inputs using the Bootstrap toolkit.
102
+ # Check the Bootstrap docs (http://getbootstrap.com)
42
103
  # to learn about the different styles for forms and inputs,
43
104
  # buttons and other elements.
44
- config.default_wrapper = :bootstrap
105
+ config.default_wrapper = :vertical_form
45
106
  end
@@ -8,7 +8,7 @@ SimpleForm.setup do |config|
8
8
  b.optional :min_max
9
9
  b.optional :readonly
10
10
  b.use :label_input
11
- b.use :error, wrap_with: { tag: :small }
11
+ b.use :error, wrap_with: { tag: :small, class: :error }
12
12
 
13
13
  # Uncomment the following line to enable hints. The line is commented out by default since Foundation
14
14
  # does't provide styles for hints. You will need to provide your own CSS styles for hints.
@@ -10,7 +10,7 @@ en:
10
10
  # html: '<abbr title="required">*</abbr>'
11
11
  error_notification:
12
12
  default_message: "Please review the problems below:"
13
- # Labels and hints examples
13
+ # Examples
14
14
  # labels:
15
15
  # defaults:
16
16
  # password: 'Password'
@@ -23,4 +23,9 @@ en:
23
23
  # defaults:
24
24
  # username: 'User name to sign in.'
25
25
  # password: 'No special characters, please.'
26
-
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
@@ -24,6 +24,24 @@ module SimpleForm
24
24
  SimpleForm::Components.eager_load!
25
25
  end
26
26
 
27
+ CUSTOM_INPUT_DEPRECATION_WARN = <<-WARN
28
+ %{name} method now accepts a `wrapper_options` argument. The method definition without the argument is deprecated and will be removed in the next Simple Form version. Change your code from:
29
+
30
+ def %{name}
31
+
32
+ to
33
+
34
+ def %{name}(wrapper_options)
35
+
36
+ See https://github.com/plataformatec/simple_form/pull/997 for more information.
37
+ WARN
38
+
39
+ @@configured = false
40
+
41
+ def self.configured? #:nodoc:
42
+ @@configured
43
+ end
44
+
27
45
  ## CONFIGURATION OPTIONS
28
46
 
29
47
  # Method used to tidy up errors.
@@ -66,7 +84,7 @@ module SimpleForm
66
84
 
67
85
  # How the label text should be generated altogether with the required text.
68
86
  mattr_accessor :label_text
69
- @@label_text = lambda { |label, required| "#{required} #{label}" }
87
+ @@label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
70
88
 
71
89
  # You can define the class to be used on all labels. Defaults to none.
72
90
  mattr_accessor :label_class
@@ -107,6 +125,8 @@ module SimpleForm
107
125
  # Custom wrappers for input types. This should be a hash containing an input
108
126
  # type as key and the wrapper that will be used for all inputs with specified type.
109
127
  # e.g { string: :string_wrapper, boolean: :boolean_wrapper }
128
+ # You can also set a wrapper mapping per form basis.
129
+ # e.g simple_form_for(@foo, wrapper_mappings: { check_boxes: :bootstrap_checkbox })
110
130
  mattr_accessor :wrapper_mappings
111
131
  @@wrapper_mappings = nil
112
132
 
@@ -151,15 +171,26 @@ module SimpleForm
151
171
  mattr_accessor :input_class
152
172
  @@input_class = nil
153
173
 
174
+ # Defines if an input wrapper class should be included or not
175
+ mattr_accessor :include_default_input_wrapper_class
176
+ @@include_default_input_wrapper_class = true
177
+
178
+ # Define the default class of the input wrapper of the boolean input.
179
+ mattr_accessor :boolean_label_class
180
+ @@boolean_label_class = 'checkbox'
181
+
154
182
  ## WRAPPER CONFIGURATION
155
183
  # The default wrapper to be used by the FormBuilder.
156
184
  mattr_accessor :default_wrapper
157
185
  @@default_wrapper = :default
158
- @@wrappers = {}
186
+ @@wrappers = {} #:nodoc:
187
+
188
+ mattr_accessor :i18n_scope
189
+ @@i18n_scope = 'simple_form'
159
190
 
160
191
  # Retrieves a given wrapper
161
192
  def self.wrapper(name)
162
- @@wrappers[name.to_sym] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}"
193
+ @@wrappers[name.to_s] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}"
163
194
  end
164
195
 
165
196
  # Raised when fails to find a given wrapper name
@@ -172,14 +203,14 @@ module SimpleForm
172
203
  if block_given?
173
204
  options = args.extract_options!
174
205
  name = args.first || :default
175
- @@wrappers[name.to_sym] = build(options, &block)
206
+ @@wrappers[name.to_s] = build(options, &block)
176
207
  else
177
208
  @@wrappers
178
209
  end
179
210
  end
180
211
 
181
212
  # Builds a new wrapper using SimpleForm::Wrappers::Builder.
182
- def self.build(options={})
213
+ def self.build(options = {})
183
214
  options[:tag] = :div if options[:tag].nil?
184
215
  builder = SimpleForm::Wrappers::Builder.new(options)
185
216
  yield builder
@@ -210,9 +241,10 @@ module SimpleForm
210
241
  ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
211
242
  end
212
243
 
213
- # Default way to setup SimpleForm. Run rails generate simple_form:install
244
+ # Default way to setup Simple Form. Run rails generate simple_form:install
214
245
  # to create a fresh initializer with all configuration values.
215
246
  def self.setup
247
+ @@configured = true
216
248
  yield self
217
249
  end
218
250
  end
@@ -10,7 +10,7 @@ module SimpleForm
10
10
  #
11
11
  module FormHelper
12
12
 
13
- def simple_form_for(record, options={}, &block)
13
+ def simple_form_for(record, options = {}, &block)
14
14
  options[:builder] ||= SimpleForm::FormBuilder
15
15
  options[:html] ||= {}
16
16
  unless options[:html].key?(:novalidate)
@@ -1,10 +1,14 @@
1
1
  module SimpleForm
2
2
  module Components
3
3
  module Errors
4
- def error
4
+ def error(wrapper_options = nil)
5
5
  error_text if has_errors?
6
6
  end
7
7
 
8
+ def full_error(wrapper_options = nil)
9
+ full_error_text if options[:error] != false && has_errors?
10
+ end
11
+
8
12
  def has_errors?
9
13
  object && object.respond_to?(:errors) && errors.present?
10
14
  end
@@ -12,9 +16,15 @@ module SimpleForm
12
16
  protected
13
17
 
14
18
  def error_text
15
- text = has_error_in_options? ? options[:error] : errors.send(error_method)
19
+ text = has_custom_error? ? options[:error] : errors.send(error_method)
20
+
21
+ "#{html_escape(options[:error_prefix])} #{text}".lstrip.html_safe
22
+ end
23
+
24
+ def full_error_text
25
+ text = has_custom_error? ? options[:error] : full_errors.send(error_method)
16
26
 
17
- "#{html_escape(options[:error_prefix])} #{html_escape(text)}".lstrip.html_safe
27
+ text.html_safe
18
28
  end
19
29
 
20
30
  def error_method
@@ -25,16 +35,28 @@ module SimpleForm
25
35
  @errors ||= (errors_on_attribute + errors_on_association).compact
26
36
  end
27
37
 
38
+ def full_errors
39
+ @full_errors ||= (full_errors_on_attribute + full_errors_on_association).compact
40
+ end
41
+
28
42
  def errors_on_attribute
29
43
  object.errors[attribute_name]
30
44
  end
31
45
 
46
+ def full_errors_on_attribute
47
+ object.errors.full_messages_for(attribute_name)
48
+ end
49
+
32
50
  def errors_on_association
33
51
  reflection ? object.errors[reflection.name] : []
34
52
  end
35
53
 
36
- def has_error_in_options?
37
- options[:error] && !options[:error].nil?
54
+ def full_errors_on_association
55
+ reflection ? object.full_messages_for(reflection.name) : []
56
+ end
57
+
58
+ def has_custom_error?
59
+ options[:error].is_a?(String)
38
60
  end
39
61
  end
40
62
  end
@@ -2,14 +2,14 @@ module SimpleForm
2
2
  module Components
3
3
  # Needs to be enabled in order to do automatic lookups.
4
4
  module Hints
5
- def hint
5
+ def hint(wrapper_options = nil)
6
6
  @hint ||= begin
7
7
  hint = options[:hint]
8
8
 
9
9
  if hint.is_a?(String)
10
10
  html_escape(hint)
11
11
  else
12
- content = translate(:hints)
12
+ content = translate_from_namespace(:hints)
13
13
  content.html_safe if content
14
14
  end
15
15
  end
@@ -5,7 +5,7 @@ module SimpleForm
5
5
  @html5 = false
6
6
  end
7
7
 
8
- def html5
8
+ def html5(wrapper_options = nil)
9
9
  @html5 = true
10
10
  if has_required?
11
11
  input_html_options[:required] = true
@@ -7,8 +7,26 @@ module SimpleForm
7
7
  include SimpleForm::Components::Labels
8
8
  end
9
9
 
10
- def label_input
11
- options[:label] == false ? input : (label + input)
10
+ def label_input(wrapper_options = nil)
11
+ if options[:label] == false
12
+ deprecated_component(:input, wrapper_options)
13
+ else
14
+ deprecated_component(:label, wrapper_options) + deprecated_component(:input, wrapper_options)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def deprecated_component(namespace, wrapper_options)
21
+ method = method(namespace)
22
+
23
+ if method.arity == 0
24
+ ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
25
+
26
+ method.call
27
+ else
28
+ method.call(wrapper_options)
29
+ end
12
30
  end
13
31
  end
14
32
  end