simple_form 5.1.0 → 5.3.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +64 -16
  5. data/lib/generators/simple_form/install_generator.rb +2 -2
  6. data/lib/generators/simple_form/templates/README +1 -1
  7. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +1 -1
  8. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +126 -194
  9. data/lib/simple_form/components/label_input.rb +1 -1
  10. data/lib/simple_form/form_builder.rb +2 -6
  11. data/lib/simple_form/inputs/boolean_input.rb +6 -2
  12. data/lib/simple_form/inputs/grouped_collection_select_input.rb +1 -1
  13. data/lib/simple_form/inputs/priority_input.rb +16 -2
  14. data/lib/simple_form/railtie.rb +4 -0
  15. data/lib/simple_form/version.rb +1 -1
  16. data/lib/simple_form/wrappers/leaf.rb +1 -1
  17. data/lib/simple_form.rb +9 -5
  18. metadata +11 -83
  19. data/test/action_view_extensions/builder_test.rb +0 -634
  20. data/test/action_view_extensions/form_helper_test.rb +0 -172
  21. data/test/components/custom_components_test.rb +0 -62
  22. data/test/components/label_test.rb +0 -352
  23. data/test/form_builder/association_test.rb +0 -252
  24. data/test/form_builder/button_test.rb +0 -48
  25. data/test/form_builder/error_notification_test.rb +0 -80
  26. data/test/form_builder/error_test.rb +0 -281
  27. data/test/form_builder/general_test.rb +0 -539
  28. data/test/form_builder/hint_test.rb +0 -150
  29. data/test/form_builder/input_field_test.rb +0 -195
  30. data/test/form_builder/label_test.rb +0 -136
  31. data/test/form_builder/wrapper_test.rb +0 -378
  32. data/test/generators/simple_form_generator_test.rb +0 -43
  33. data/test/inputs/boolean_input_test.rb +0 -243
  34. data/test/inputs/collection_check_boxes_input_test.rb +0 -323
  35. data/test/inputs/collection_radio_buttons_input_test.rb +0 -446
  36. data/test/inputs/collection_select_input_test.rb +0 -380
  37. data/test/inputs/color_input_test.rb +0 -10
  38. data/test/inputs/datetime_input_test.rb +0 -176
  39. data/test/inputs/disabled_test.rb +0 -92
  40. data/test/inputs/discovery_test.rb +0 -142
  41. data/test/inputs/file_input_test.rb +0 -17
  42. data/test/inputs/general_test.rb +0 -133
  43. data/test/inputs/grouped_collection_select_input_test.rb +0 -183
  44. data/test/inputs/hidden_input_test.rb +0 -32
  45. data/test/inputs/numeric_input_test.rb +0 -177
  46. data/test/inputs/priority_input_test.rb +0 -50
  47. data/test/inputs/readonly_test.rb +0 -102
  48. data/test/inputs/required_test.rb +0 -158
  49. data/test/inputs/rich_text_area_input_test.rb +0 -15
  50. data/test/inputs/string_input_test.rb +0 -158
  51. data/test/inputs/text_input_test.rb +0 -37
  52. data/test/simple_form_test.rb +0 -18
  53. data/test/support/discovery_inputs.rb +0 -65
  54. data/test/support/misc_helpers.rb +0 -274
  55. data/test/support/mock_controller.rb +0 -30
  56. data/test/support/models.rb +0 -357
  57. data/test/test_helper.rb +0 -95
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: UTF-8
3
- require 'test_helper'
4
-
5
- class PriorityInputTest < ActionView::TestCase
6
- test 'input generates a country select field' do
7
- with_input_for @user, :country, :country
8
- assert_select 'select#user_country'
9
- assert_select 'select option[value=BR]', 'Brazil'
10
- assert_no_select 'select option[value=""][disabled=disabled]'
11
- end
12
-
13
- test 'input generates a country select with SimpleForm default' do
14
- swap SimpleForm, country_priority: [ 'Brazil' ] do
15
- with_input_for @user, :country, :country
16
- assert_select 'select option[value="---------------"][disabled=disabled]'
17
- end
18
- end
19
-
20
- test 'input generates a time zone select field' do
21
- with_input_for @user, :time_zone, :time_zone
22
- assert_select 'select#user_time_zone'
23
- assert_select 'select option[value=Brasilia]', '(GMT-03:00) Brasilia'
24
- assert_no_select 'select option[value=""][disabled=disabled]'
25
- end
26
-
27
- test 'input generates a time zone select field with default' do
28
- with_input_for @user, :time_zone, :time_zone, default: 'Brasilia'
29
- assert_select 'select option[value=Brasilia][selected=selected]'
30
- assert_no_select 'select option[value=""]'
31
- end
32
-
33
- test 'input generates a time zone select using options priority' do
34
- with_input_for @user, :time_zone, :time_zone, priority: /Brasilia/
35
- assert_select 'select option[value=""][disabled=disabled]'
36
- assert_no_select 'select option[value=""]', /^$/
37
- end
38
-
39
- test 'priority input does generate select element with required html attribute' do
40
- with_input_for @user, :country, :country
41
- assert_select 'select.required'
42
- assert_select 'select[required]'
43
- end
44
-
45
- test 'priority input does generate select element with aria-required html attribute' do
46
- with_input_for @user, :country, :country
47
- assert_select 'select.required'
48
- assert_select 'select[aria-required]'
49
- end
50
- end
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'test_helper'
3
-
4
- class ReadonlyTest < ActionView::TestCase
5
- test 'string input generates readonly elements when readonly option is true' do
6
- with_input_for @user, :name, :string, readonly: true
7
- assert_select 'input.string.readonly[readonly]'
8
- end
9
-
10
- test 'text input generates readonly elements when readonly option is true' do
11
- with_input_for @user, :description, :text, readonly: true
12
- assert_select 'textarea.text.readonly[readonly]'
13
- end
14
-
15
- test 'numeric input generates readonly elements when readonly option is true' do
16
- with_input_for @user, :age, :integer, readonly: true
17
- assert_select 'input.integer.readonly[readonly]'
18
- end
19
-
20
- test 'date input generates readonly elements when readonly option is true' do
21
- with_input_for @user, :born_at, :date, readonly: true
22
- assert_select 'select.date.readonly[readonly]'
23
- end
24
-
25
- test 'datetime input generates readonly elements when readonly option is true' do
26
- with_input_for @user, :created_at, :datetime, readonly: true
27
- assert_select 'select.datetime.readonly[readonly]'
28
- end
29
-
30
- test 'string input generates readonly elements when readonly option is false' do
31
- with_input_for @user, :name, :string, readonly: false
32
- assert_no_select 'input.string.readonly[readonly]'
33
- end
34
-
35
- test 'text input generates readonly elements when readonly option is false' do
36
- with_input_for @user, :description, :text, readonly: false
37
- assert_no_select 'textarea.text.readonly[readonly]'
38
- end
39
-
40
- test 'numeric input generates readonly elements when readonly option is false' do
41
- with_input_for @user, :age, :integer, readonly: false
42
- assert_no_select 'input.integer.readonly[readonly]'
43
- end
44
-
45
- test 'date input generates readonly elements when readonly option is false' do
46
- with_input_for @user, :born_at, :date, readonly: false
47
- assert_no_select 'select.date.readonly[readonly]'
48
- end
49
-
50
- test 'datetime input generates readonly elements when readonly option is false' do
51
- with_input_for @user, :created_at, :datetime, readonly: false
52
- assert_no_select 'select.datetime.readonly[readonly]'
53
- end
54
-
55
- test 'string input generates readonly elements when readonly option is not present' do
56
- with_input_for @user, :name, :string
57
- assert_no_select 'input.string.readonly[readonly]'
58
- end
59
-
60
- test 'text input generates readonly elements when readonly option is not present' do
61
- with_input_for @user, :description, :text
62
- assert_no_select 'textarea.text.readonly[readonly]'
63
- end
64
-
65
- test 'numeric input generates readonly elements when readonly option is not present' do
66
- with_input_for @user, :age, :integer
67
- assert_no_select 'input.integer.readonly[readonly]'
68
- end
69
-
70
- test 'date input generates readonly elements when readonly option is not present' do
71
- with_input_for @user, :born_at, :date
72
- assert_no_select 'select.date.readonly[readonly]'
73
- end
74
-
75
- test 'datetime input generates readonly elements when readonly option is not present' do
76
- with_input_for @user, :created_at, :datetime
77
- assert_no_select 'select.datetime.readonly[readonly]'
78
- end
79
-
80
- test 'input generates readonly attribute when the field is readonly and the object is persisted' do
81
- with_input_for @user, :credit_card, :string, readonly: :lookup
82
- assert_select 'input.string.readonly[readonly]'
83
- end
84
-
85
- test 'input does not generate readonly attribute when the field is readonly and the object is not persisted' do
86
- @user.new_record!
87
- with_input_for @user, :credit_card, :string, readonly: :lookup
88
- assert_no_select 'input.string.readonly[readonly]'
89
- end
90
-
91
- test 'input does not generate readonly attribute when the field is not readonly and the object is persisted' do
92
- with_input_for @user, :name, :string
93
- assert_no_select 'input.string.readonly[readonly]'
94
- end
95
-
96
- test 'input does not generate readonly attribute when the component is not used' do
97
- swap_wrapper do
98
- with_input_for @user, :credit_card, :string
99
- assert_no_select 'input.string.readonly[readonly]'
100
- end
101
- end
102
- end
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'test_helper'
3
-
4
- class RequiredTest < ActionView::TestCase
5
- # REQUIRED AND PRESENCE VALIDATION
6
- test 'builder input obtains required from ActiveModel::Validations when it is included' do
7
- with_form_for @validating_user, :name
8
- assert_select 'input.required[required]#validating_user_name'
9
- with_form_for @validating_user, :status
10
- assert_select 'input.optional#validating_user_status'
11
- end
12
-
13
- test 'builder input allows overriding required when ActiveModel::Validations is included' do
14
- with_form_for @validating_user, :name, required: false
15
- assert_select 'input.optional#validating_user_name'
16
- with_form_for @validating_user, :status, required: true
17
- assert_select 'input.required[required]#validating_user_status'
18
- end
19
-
20
- test 'builder input is required by default when ActiveModel::Validations is not included' do
21
- with_form_for @user, :name
22
- assert_select 'input.required[required]#user_name'
23
- end
24
-
25
- test 'builder input does not be required by default when ActiveModel::Validations is not included if option is set to false' do
26
- swap SimpleForm, required_by_default: false do
27
- with_form_for @user, :name
28
- assert_select 'input.optional#user_name'
29
- assert_no_select 'input[required]'
30
- end
31
- end
32
-
33
- test 'when not using browser validations, input does not generate required html attribute' do
34
- swap SimpleForm, browser_validations: false do
35
- with_input_for @user, :name, :string
36
- assert_select 'input[type=text].required'
37
- assert_no_select 'input[type=text][required]'
38
- assert_no_select 'input[type=text][aria-required]'
39
- end
40
- end
41
-
42
- test 'when not using browser validations, when required option is set to false, input does not generate required html attribute' do
43
- swap SimpleForm, browser_validations: false do
44
- with_input_for @user, :name, :string, required: false
45
- assert_no_select 'input[type=text].required'
46
- assert_no_select 'input[type=text][required]'
47
- assert_no_select 'input[type=text][aria-required]'
48
- end
49
- end
50
-
51
- test 'when not using browser validations, when required option is set to true, input generates required html attribute' do
52
- swap SimpleForm, browser_validations: false do
53
- with_input_for @user, :name, :string, required: true
54
- assert_select 'input[type=text].required'
55
- assert_select 'input[type=text][required]'
56
- assert_select 'input[type=text][aria-required]'
57
- end
58
- end
59
-
60
- test 'when not using browser validations, when required option is true in the wrapper, input does not generate required html attribute' do
61
- swap SimpleForm, browser_validations: false do
62
- swap_wrapper :default, self.custom_wrapper_with_required_input do
63
- with_concat_form_for(@user) do |f|
64
- concat f.input :name
65
- end
66
- assert_select 'input[type=text].required'
67
- assert_no_select 'input[type=text][required]'
68
- assert_no_select 'input[type=text][aria-required]'
69
- end
70
- end
71
- end
72
-
73
- test 'builder input allows disabling required when ActiveModel::Validations is not included' do
74
- with_form_for @user, :name, required: false
75
- assert_no_select 'input.required'
76
- assert_no_select 'input[required]'
77
- assert_select 'input.optional#user_name'
78
- end
79
-
80
- test 'when not the required component the input does not have the required attribute but has the required class' do
81
- swap_wrapper do
82
- with_input_for @user, :name, :string
83
- assert_select 'input[type=text].required'
84
- assert_no_select 'input[type=text][required]'
85
- end
86
- end
87
-
88
- # VALIDATORS :if :unless
89
- test 'builder input does not be required when ActiveModel::Validations is included and if option is present' do
90
- with_form_for @validating_user, :age
91
- assert_no_select 'input.required'
92
- assert_no_select 'input[required]'
93
- assert_select 'input.optional#validating_user_age'
94
- end
95
-
96
- test 'builder input does not be required when ActiveModel::Validations is included and unless option is present' do
97
- with_form_for @validating_user, :amount
98
- assert_no_select 'input.required'
99
- assert_no_select 'input[required]'
100
- assert_select 'input.optional#validating_user_amount'
101
- end
102
-
103
- # VALIDATORS :on
104
- test 'builder input is required when validation is on create and is not persisted' do
105
- @validating_user.new_record!
106
- with_form_for @validating_user, :action
107
- assert_select 'input.required'
108
- assert_select 'input[required]'
109
- assert_select 'input.required[required]#validating_user_action'
110
- end
111
-
112
- test 'builder input does not be required when validation is on create and is persisted' do
113
- with_form_for @validating_user, :action
114
- assert_no_select 'input.required'
115
- assert_no_select 'input[required]'
116
- assert_select 'input.optional#validating_user_action'
117
- end
118
-
119
- test 'builder input is required when validation is on save' do
120
- with_form_for @validating_user, :credit_limit
121
- assert_select 'input.required'
122
- assert_select 'input[required]'
123
- assert_select 'input.required[required]#validating_user_credit_limit'
124
-
125
- @validating_user.new_record!
126
- with_form_for @validating_user, :credit_limit
127
- assert_select 'input.required'
128
- assert_select 'input[required]'
129
- assert_select 'input.required[required]#validating_user_credit_limit'
130
- end
131
-
132
- test 'builder input is required when validation is on update and is persisted' do
133
- with_form_for @validating_user, :phone_number
134
- assert_select 'input.required'
135
- assert_select 'input[required]'
136
- assert_select 'input.required[required]#validating_user_phone_number'
137
- end
138
-
139
- test 'builder input does not be required when validation is on update and is not persisted' do
140
- @validating_user.new_record!
141
- with_form_for @validating_user, :phone_number
142
- assert_no_select 'input.required'
143
- assert_no_select 'input[required]'
144
- assert_select 'input.optional#validating_user_phone_number'
145
- end
146
-
147
- test 'builder input does not generate required html attribute when option is set to false when it is set to true in wrapper' do
148
- swap SimpleForm, browser_validations: true do
149
- swap_wrapper :default, self.custom_wrapper_with_required_input do
150
- with_concat_form_for(@user) do |f|
151
- concat f.input :name, required: false
152
- end
153
- assert_no_select 'input[type=text][required]'
154
- assert_no_select 'input[type=text][aria-required]'
155
- end
156
- end
157
- end
158
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: UTF-8
3
- require 'test_helper'
4
-
5
- class RichTextAreaInputTest < ActionView::TestCase
6
- test 'input generates a text area for text attributes' do
7
- with_input_for @user, :description, :text
8
- assert_select 'textarea.text#user_description'
9
- end
10
-
11
- test 'input generates a text area for text attributes that accept placeholder' do
12
- with_input_for @user, :description, :text, placeholder: 'Put in some text'
13
- assert_select 'textarea.text[placeholder="Put in some text"]'
14
- end
15
- end
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: UTF-8
3
- require 'test_helper'
4
-
5
- class StringInputTest < ActionView::TestCase
6
- test 'input maps text field to string attribute' do
7
- with_input_for @user, :name, :string
8
- assert_select "input#user_name[type=text][name='user[name]'][value='New in SimpleForm!']"
9
- end
10
-
11
- test 'input maps text field to citext attribute' do
12
- with_input_for @user, :name, :citext
13
- assert_select "input#user_name[type=text][name='user[name]'][value='New in SimpleForm!']"
14
- end
15
-
16
- test 'input generates a password field for password attributes' do
17
- with_input_for @user, :password, :password
18
- assert_select "input#user_password.password[type=password][name='user[password]']"
19
- end
20
-
21
- test 'input gets maxlength from column definition for string attributes' do
22
- with_input_for @user, :name, :string
23
- assert_select 'input.string[maxlength="100"]'
24
- end
25
-
26
- test 'input does not get maxlength from column without size definition for string attributes' do
27
- with_input_for @user, :action, :string
28
- assert_no_select 'input.string[maxlength]'
29
- end
30
-
31
- test 'input gets maxlength from column definition for password attributes' do
32
- with_input_for @user, :password, :password
33
- assert_select 'input.password[type=password][maxlength="100"]'
34
- end
35
-
36
- test 'input infers maxlength column definition from validation when present' do
37
- with_input_for @validating_user, :name, :string
38
- assert_select 'input.string[maxlength="25"]'
39
- end
40
-
41
- test 'input infers minlength column definition from validation when present' do
42
- with_input_for @validating_user, :name, :string
43
- assert_select 'input.string[minlength="5"]'
44
- end
45
-
46
- test 'input gets maxlength from validation when :is option present' do
47
- with_input_for @validating_user, :home_picture, :string
48
- assert_select 'input.string[maxlength="12"]'
49
- end
50
-
51
- test 'input gets minlength from validation when :is option present' do
52
- with_input_for @validating_user, :home_picture, :string
53
- assert_select 'input.string[minlength="12"]'
54
- end
55
-
56
- test 'input maxlength is the column limit plus one to make room for decimal point' do
57
- with_input_for @user, :credit_limit, :string
58
-
59
- assert_select 'input.string[maxlength="16"]'
60
- end
61
-
62
- test 'input does not generate placeholder by default' do
63
- with_input_for @user, :name, :string
64
- assert_no_select 'input[placeholder]'
65
- end
66
-
67
- test 'input accepts the placeholder option' do
68
- with_input_for @user, :name, :string, placeholder: 'Put in some text'
69
- assert_select 'input.string[placeholder="Put in some text"]'
70
- end
71
-
72
- test 'input generates a password field for password attributes that accept placeholder' do
73
- with_input_for @user, :password, :password, placeholder: 'Password Confirmation'
74
- assert_select 'input[type=password].password[placeholder="Password Confirmation"]#user_password'
75
- end
76
-
77
- test 'input does not infer pattern from attributes by default' do
78
- with_input_for @other_validating_user, :country, :string
79
- assert_no_select 'input[pattern="\w+"]'
80
- end
81
-
82
- test 'input infers pattern from attributes' do
83
- with_input_for @other_validating_user, :country, :string, pattern: true
84
- assert_select "input:match('pattern', ?)", /\w+/
85
- end
86
-
87
- test 'input infers pattern from attributes using proc' do
88
- with_input_for @other_validating_user, :name, :string, pattern: true
89
- assert_select "input:match('pattern', ?)", /\w+/
90
- end
91
-
92
- test 'input does not infer pattern from attributes if root default is false' do
93
- swap_wrapper do
94
- with_input_for @other_validating_user, :country, :string
95
- assert_no_select 'input[pattern="\w+"]'
96
- end
97
- end
98
-
99
- test 'input uses given pattern from attributes' do
100
- with_input_for @other_validating_user, :country, :string, input_html: { pattern: "\\d+" }
101
- assert_select "input:match('pattern', ?)", /\\d+/
102
- end
103
-
104
- test 'input does not use pattern if model has :without validation option' do
105
- with_input_for @other_validating_user, :description, :string, pattern: true
106
- assert_no_select 'input[pattern="\d+"]'
107
- end
108
-
109
- test 'input uses i18n to translate placeholder text' do
110
- store_translations(:en, simple_form: { placeholders: { user: {
111
- name: 'Name goes here'
112
- } } }) do
113
- with_input_for @user, :name, :string
114
- assert_select 'input.string[placeholder="Name goes here"]'
115
- end
116
- end
117
-
118
- test 'input uses custom i18n scope to translate placeholder text' do
119
- store_translations(:en, my_scope: { placeholders: { user: {
120
- name: 'Name goes here'
121
- } } }) do
122
- swap SimpleForm, i18n_scope: :my_scope do
123
- with_input_for @user, :name, :string
124
- assert_select 'input.string[placeholder="Name goes here"]'
125
- end
126
- end
127
- end
128
-
129
- %i[email url search tel].each do |type|
130
- test "input allows type #{type}" do
131
- with_input_for @user, :name, type
132
- assert_select "input.string.#{type}"
133
- assert_select "input[type=#{type}]"
134
- end
135
-
136
- test "input does not allow type #{type} if HTML5 compatibility is disabled" do
137
- swap_wrapper do
138
- with_input_for @user, :name, type
139
- assert_select "input[type=text]"
140
- assert_no_select "input[type=#{type}]"
141
- end
142
- end
143
- end
144
-
145
- test 'input strips extra spaces from class html attribute with default classes' do
146
- with_input_for @user, :name, :string
147
- assert_select "input[class='string required']"
148
- assert_no_select "input[class='string required ']"
149
- assert_no_select "input[class=' string required']"
150
- end
151
-
152
- test 'input strips extra spaces from class html attribute when giving a custom class' do
153
- with_input_for @user, :name, :string, input_html: { class: "my_input" }
154
- assert_select "input[class='string required my_input']"
155
- assert_no_select "input[class='string required my_input ']"
156
- assert_no_select "input[class=' string required my_input']"
157
- end
158
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: UTF-8
3
- require 'test_helper'
4
-
5
- class TextInputTest < ActionView::TestCase
6
- test 'input generates a text area for text attributes' do
7
- with_input_for @user, :description, :text
8
- assert_select 'textarea.text#user_description'
9
- end
10
-
11
- test 'input generates a text area for text attributes that accept placeholder' do
12
- with_input_for @user, :description, :text, placeholder: 'Put in some text'
13
- assert_select 'textarea.text[placeholder="Put in some text"]'
14
- end
15
-
16
- test 'input generates a placeholder from the translations' do
17
- store_translations(:en, simple_form: { placeholders: { user: { name: "placeholder from i18n en.simple_form.placeholders.user.name" } } }) do
18
- with_input_for @user, :name, :text
19
- assert_select 'textarea.text[placeholder="placeholder from i18n en.simple_form.placeholders.user.name"]'
20
- end
21
- end
22
-
23
- test 'input gets maxlength from column definition for text attributes' do
24
- with_input_for @user, :description, :text
25
- assert_select 'textarea.text[maxlength="200"]'
26
- end
27
-
28
- test 'input infers maxlength column definition from validation when present for text attributes' do
29
- with_input_for @validating_user, :description, :text
30
- assert_select 'textarea.text[maxlength="50"]'
31
- end
32
-
33
- test 'input infers minlength column definition from validation when present for text attributes' do
34
- with_input_for @validating_user, :description, :text
35
- assert_select 'textarea.text[minlength="15"]'
36
- end
37
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'test_helper'
3
-
4
- class SimpleFormTest < ActiveSupport::TestCase
5
- test 'setup block yields self' do
6
- SimpleForm.setup do |config|
7
- assert_equal SimpleForm, config
8
- end
9
- end
10
-
11
- test 'setup block configure Simple Form' do
12
- SimpleForm.setup do |config|
13
- assert_equal SimpleForm, config
14
- end
15
-
16
- assert_equal true, SimpleForm.configured?
17
- end
18
- end
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
- class StringInput < SimpleForm::Inputs::StringInput
3
- def input(wrapper_options = nil)
4
- "<section>#{super}</section>".html_safe
5
- end
6
- end
7
-
8
- class NumericInput < SimpleForm::Inputs::NumericInput
9
- def input(wrapper_options = nil)
10
- "<section>#{super}</section>".html_safe
11
- end
12
- end
13
-
14
- class CustomizedInput < SimpleForm::Inputs::StringInput
15
- def input(wrapper_options = nil)
16
- "<section>#{super}</section>".html_safe
17
- end
18
-
19
- def input_method
20
- :text_field
21
- end
22
- end
23
-
24
- class DeprecatedInput < SimpleForm::Inputs::StringInput
25
- def input
26
- "<section>#{super}</section>".html_safe
27
- end
28
-
29
- def input_method
30
- :text_field
31
- end
32
- end
33
-
34
- class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
35
- def input_html_classes
36
- super.push('chosen')
37
- end
38
- end
39
-
40
- class FileInput < SimpleForm::Inputs::FileInput
41
- def input_html_classes
42
- super.delete_if { |html_class| html_class == :file }
43
- super.push('file-upload')
44
- end
45
- end
46
-
47
- module CustomInputs
48
- class CustomizedInput < SimpleForm::Inputs::StringInput
49
- def input_html_classes
50
- super.push('customized-namespace-custom-input')
51
- end
52
- end
53
-
54
- class PasswordInput < SimpleForm::Inputs::PasswordInput
55
- def input_html_classes
56
- super.push('password-custom-input')
57
- end
58
- end
59
-
60
- class NumericInput < SimpleForm::Inputs::PasswordInput
61
- def input_html_classes
62
- super.push('numeric-custom-input')
63
- end
64
- end
65
- end