mini-sharp-mod 0.0.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 (70) hide show
  1. checksums.yaml +7 -0
  2. data/mini-sharp-mod.gemspec +12 -0
  3. data/simple_form-5.4.1/CHANGELOG.md +259 -0
  4. data/simple_form-5.4.1/MIT-LICENSE +21 -0
  5. data/simple_form-5.4.1/README.md +1334 -0
  6. data/simple_form-5.4.1/lib/generators/simple_form/USAGE +3 -0
  7. data/simple_form-5.4.1/lib/generators/simple_form/install_generator.rb +42 -0
  8. data/simple_form-5.4.1/lib/generators/simple_form/templates/README +10 -0
  9. data/simple_form-5.4.1/lib/generators/simple_form/templates/_form.html.erb +15 -0
  10. data/simple_form-5.4.1/lib/generators/simple_form/templates/_form.html.haml +12 -0
  11. data/simple_form-5.4.1/lib/generators/simple_form/templates/_form.html.slim +11 -0
  12. data/simple_form-5.4.1/lib/generators/simple_form/templates/config/initializers/simple_form.rb +176 -0
  13. data/simple_form-5.4.1/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +372 -0
  14. data/simple_form-5.4.1/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +122 -0
  15. data/simple_form-5.4.1/lib/generators/simple_form/templates/config/locales/simple_form.en.yml +31 -0
  16. data/simple_form-5.4.1/lib/simple_form/action_view_extensions/builder.rb +38 -0
  17. data/simple_form-5.4.1/lib/simple_form/action_view_extensions/form_helper.rb +72 -0
  18. data/simple_form-5.4.1/lib/simple_form/components/errors.rb +74 -0
  19. data/simple_form-5.4.1/lib/simple_form/components/hints.rb +24 -0
  20. data/simple_form-5.4.1/lib/simple_form/components/html5.rb +33 -0
  21. data/simple_form-5.4.1/lib/simple_form/components/label_input.rb +34 -0
  22. data/simple_form-5.4.1/lib/simple_form/components/labels.rb +88 -0
  23. data/simple_form-5.4.1/lib/simple_form/components/maxlength.rb +35 -0
  24. data/simple_form-5.4.1/lib/simple_form/components/min_max.rb +41 -0
  25. data/simple_form-5.4.1/lib/simple_form/components/minlength.rb +35 -0
  26. data/simple_form-5.4.1/lib/simple_form/components/pattern.rb +27 -0
  27. data/simple_form-5.4.1/lib/simple_form/components/placeholders.rb +17 -0
  28. data/simple_form-5.4.1/lib/simple_form/components/readonly.rb +23 -0
  29. data/simple_form-5.4.1/lib/simple_form/components.rb +24 -0
  30. data/simple_form-5.4.1/lib/simple_form/error_notification.rb +49 -0
  31. data/simple_form-5.4.1/lib/simple_form/form_builder.rb +723 -0
  32. data/simple_form-5.4.1/lib/simple_form/helpers/autofocus.rb +12 -0
  33. data/simple_form-5.4.1/lib/simple_form/helpers/disabled.rb +16 -0
  34. data/simple_form-5.4.1/lib/simple_form/helpers/readonly.rb +16 -0
  35. data/simple_form-5.4.1/lib/simple_form/helpers/required.rb +36 -0
  36. data/simple_form-5.4.1/lib/simple_form/helpers/validators.rb +66 -0
  37. data/simple_form-5.4.1/lib/simple_form/helpers.rb +13 -0
  38. data/simple_form-5.4.1/lib/simple_form/inputs/base.rb +232 -0
  39. data/simple_form-5.4.1/lib/simple_form/inputs/block_input.rb +15 -0
  40. data/simple_form-5.4.1/lib/simple_form/inputs/boolean_input.rb +108 -0
  41. data/simple_form-5.4.1/lib/simple_form/inputs/collection_check_boxes_input.rb +22 -0
  42. data/simple_form-5.4.1/lib/simple_form/inputs/collection_input.rb +122 -0
  43. data/simple_form-5.4.1/lib/simple_form/inputs/collection_radio_buttons_input.rb +59 -0
  44. data/simple_form-5.4.1/lib/simple_form/inputs/collection_select_input.rb +17 -0
  45. data/simple_form-5.4.1/lib/simple_form/inputs/color_input.rb +14 -0
  46. data/simple_form-5.4.1/lib/simple_form/inputs/date_time_input.rb +39 -0
  47. data/simple_form-5.4.1/lib/simple_form/inputs/file_input.rb +12 -0
  48. data/simple_form-5.4.1/lib/simple_form/inputs/grouped_collection_select_input.rb +54 -0
  49. data/simple_form-5.4.1/lib/simple_form/inputs/hidden_input.rb +20 -0
  50. data/simple_form-5.4.1/lib/simple_form/inputs/numeric_input.rb +20 -0
  51. data/simple_form-5.4.1/lib/simple_form/inputs/password_input.rb +14 -0
  52. data/simple_form-5.4.1/lib/simple_form/inputs/priority_input.rb +37 -0
  53. data/simple_form-5.4.1/lib/simple_form/inputs/range_input.rb +15 -0
  54. data/simple_form-5.4.1/lib/simple_form/inputs/rich_text_area_input.rb +14 -0
  55. data/simple_form-5.4.1/lib/simple_form/inputs/string_input.rb +25 -0
  56. data/simple_form-5.4.1/lib/simple_form/inputs/text_input.rb +14 -0
  57. data/simple_form-5.4.1/lib/simple_form/inputs/weekday_input.rb +14 -0
  58. data/simple_form-5.4.1/lib/simple_form/inputs.rb +27 -0
  59. data/simple_form-5.4.1/lib/simple_form/map_type.rb +17 -0
  60. data/simple_form-5.4.1/lib/simple_form/railtie.rb +19 -0
  61. data/simple_form-5.4.1/lib/simple_form/tags.rb +73 -0
  62. data/simple_form-5.4.1/lib/simple_form/version.rb +4 -0
  63. data/simple_form-5.4.1/lib/simple_form/wrappers/builder.rb +80 -0
  64. data/simple_form-5.4.1/lib/simple_form/wrappers/leaf.rb +29 -0
  65. data/simple_form-5.4.1/lib/simple_form/wrappers/many.rb +74 -0
  66. data/simple_form-5.4.1/lib/simple_form/wrappers/root.rb +43 -0
  67. data/simple_form-5.4.1/lib/simple_form/wrappers/single.rb +27 -0
  68. data/simple_form-5.4.1/lib/simple_form/wrappers.rb +10 -0
  69. data/simple_form-5.4.1/lib/simple_form.rb +340 -0
  70. metadata +109 -0
@@ -0,0 +1,3 @@
1
+ To copy a SimpleForm initializer to your Rails App, with some configuration values, just do:
2
+
3
+ rails generate simple_form:install
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ module SimpleForm
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc "Copy SimpleForm default files"
6
+ source_root File.expand_path('../templates', __FILE__)
7
+ class_option :template_engine, desc: 'Template engine to be invoked (erb, haml or slim).'
8
+ class_option :bootstrap, type: :boolean, desc: 'Add the Bootstrap 5 wrappers to the SimpleForm initializer.'
9
+ class_option :foundation, type: :boolean, desc: 'Add the Zurb Foundation 5 wrappers to the SimpleForm initializer.'
10
+
11
+ def info_bootstrap
12
+ return if options.bootstrap? || options.foundation?
13
+ puts "SimpleForm supports Bootstrap 5 and Zurb Foundation 5. If you want "\
14
+ "a configuration that is compatible with one of these frameworks, then please " \
15
+ "re-run this generator with --bootstrap or --foundation as an option."
16
+ end
17
+
18
+ def copy_config
19
+ template "config/initializers/simple_form.rb"
20
+
21
+ if options[:bootstrap]
22
+ template "config/initializers/simple_form_bootstrap.rb"
23
+ elsif options[:foundation]
24
+ template "config/initializers/simple_form_foundation.rb"
25
+ end
26
+
27
+ directory 'config/locales'
28
+ end
29
+
30
+ def copy_scaffold_template
31
+ engine = options[:template_engine]
32
+ copy_file "_form.html.#{engine}", "lib/templates/#{engine}/scaffold/_form.html.#{engine}"
33
+ end
34
+
35
+ def show_readme
36
+ if behavior == :invoke && options.bootstrap?
37
+ readme "README"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ ===============================================================================
2
+
3
+ Be sure to have a copy of the Bootstrap stylesheet available on your
4
+ application, you can get it on http://getbootstrap.com/.
5
+
6
+ For usage examples and documentation, see:
7
+
8
+ https://simple-form-bootstrap.herokuapp.com
9
+
10
+ ===============================================================================
@@ -0,0 +1,15 @@
1
+ <%# frozen_string_literal: true %>
2
+ <%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
3
+ <%%= f.error_notification %>
4
+ <%%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
5
+
6
+ <div class="form-inputs">
7
+ <%- attributes.each do |attribute| -%>
8
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
9
+ <%- end -%>
10
+ </div>
11
+
12
+ <div class="form-actions">
13
+ <%%= f.button :submit %>
14
+ </div>
15
+ <%% end %>
@@ -0,0 +1,12 @@
1
+ -# frozen_string_literal: true
2
+ = simple_form_for(@<%= singular_table_name %>) do |f|
3
+ = f.error_notification
4
+ = f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present?
5
+
6
+ .form-inputs
7
+ <%- attributes.each do |attribute| -%>
8
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
9
+ <%- end -%>
10
+
11
+ .form-actions
12
+ = f.button :submit
@@ -0,0 +1,11 @@
1
+ = simple_form_for(@<%= singular_table_name %>) do |f|
2
+ = f.error_notification
3
+ = f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present?
4
+
5
+ .form-inputs
6
+ <%- attributes.each do |attribute| -%>
7
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
8
+ <%- end -%>
9
+
10
+ .form-actions
11
+ = f.button :submit
@@ -0,0 +1,176 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Uncomment this and change the path if necessary to include your own
4
+ # components.
5
+ # See https://github.com/heartcombo/simple_form#custom-components to know
6
+ # more about custom components.
7
+ # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
8
+ #
9
+ # Use this setup block to configure all options available in SimpleForm.
10
+ SimpleForm.setup do |config|
11
+ # Wrappers are used by the form builder to generate a
12
+ # complete input. You can remove any component from the
13
+ # wrapper, change the order or even add your own to the
14
+ # stack. The options given below are used to wrap the
15
+ # whole input.
16
+ config.wrappers :default, class: :input,
17
+ hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b|
18
+ ## Extensions enabled by default
19
+ # Any of these extensions can be disabled for a
20
+ # given input by passing: `f.input EXTENSION_NAME => false`.
21
+ # You can make any of these extensions optional by
22
+ # renaming `b.use` to `b.optional`.
23
+
24
+ # Determines whether to use HTML5 (:email, :url, ...)
25
+ # and required attributes
26
+ b.use :html5
27
+
28
+ # Calculates placeholders automatically from I18n
29
+ # You can also pass a string as f.input placeholder: "Placeholder"
30
+ b.use :placeholder
31
+
32
+ ## Optional extensions
33
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
34
+ # to the input. If so, they will retrieve the values from the model
35
+ # if any exists. If you want to enable any of those
36
+ # extensions by default, you can change `b.optional` to `b.use`.
37
+
38
+ # Calculates maxlength from length validations for string inputs
39
+ # and/or database column lengths
40
+ b.optional :maxlength
41
+
42
+ # Calculate minlength from length validations for string inputs
43
+ b.optional :minlength
44
+
45
+ # Calculates pattern from format validations for string inputs
46
+ b.optional :pattern
47
+
48
+ # Calculates min and max from length validations for numeric inputs
49
+ b.optional :min_max
50
+
51
+ # Calculates readonly automatically from readonly attributes
52
+ b.optional :readonly
53
+
54
+ ## Inputs
55
+ # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid'
56
+ b.use :label_input
57
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
58
+ b.use :error, wrap_with: { tag: :span, class: :error }
59
+
60
+ ## full_messages_for
61
+ # If you want to display the full error message for the attribute, you can
62
+ # use the component :full_error, like:
63
+ #
64
+ # b.use :full_error, wrap_with: { tag: :span, class: :error }
65
+ end
66
+
67
+ # The default wrapper to be used by the FormBuilder.
68
+ config.default_wrapper = :default
69
+
70
+ # Define the way to render check boxes / radio buttons with labels.
71
+ # Defaults to :nested for bootstrap config.
72
+ # inline: input + label
73
+ # nested: label > input
74
+ config.boolean_style = :nested
75
+
76
+ # Default class for buttons
77
+ config.button_class = 'btn'
78
+
79
+ # Method used to tidy up errors. Specify any Rails Array method.
80
+ # :first lists the first message for each field.
81
+ # Use :to_sentence to list all errors for each field.
82
+ # config.error_method = :first
83
+
84
+ # Default tag used for error notification helper.
85
+ config.error_notification_tag = :div
86
+
87
+ # CSS class to add for error notification helper.
88
+ config.error_notification_class = 'error_notification'
89
+
90
+ # Series of attempts to detect a default label method for collection.
91
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
92
+
93
+ # Series of attempts to detect a default value method for collection.
94
+ # config.collection_value_methods = [ :id, :to_s ]
95
+
96
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
97
+ # config.collection_wrapper_tag = nil
98
+
99
+ # You can define the class to use on all collection wrappers. Defaulting to none.
100
+ # config.collection_wrapper_class = nil
101
+
102
+ # You can wrap each item in a collection of radio/check boxes with a tag,
103
+ # defaulting to :span.
104
+ # config.item_wrapper_tag = :span
105
+
106
+ # You can define a class to use in all item wrappers. Defaulting to none.
107
+ # config.item_wrapper_class = nil
108
+
109
+ # How the label text should be generated altogether with the required text.
110
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
111
+
112
+ # You can define the class to use on all labels. Default is nil.
113
+ # config.label_class = nil
114
+
115
+ # You can define the default class to be used on forms. Can be overridden
116
+ # with `html: { :class }`. Defaulting to none.
117
+ # config.default_form_class = nil
118
+
119
+ # You can define which elements should obtain additional classes
120
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
121
+
122
+ # Whether attributes are required by default (or not). Default is true.
123
+ # config.required_by_default = true
124
+
125
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
126
+ # These validations are enabled in SimpleForm's internal config but disabled by default
127
+ # in this configuration, which is recommended due to some quirks from different browsers.
128
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
129
+ # change this configuration to true.
130
+ config.browser_validations = false
131
+
132
+ # Custom mappings for input types. This should be a hash containing a regexp
133
+ # to match as key, and the input type that will be used when the field name
134
+ # matches the regexp as value.
135
+ # config.input_mappings = { /count/ => :integer }
136
+
137
+ # Custom wrappers for input types. This should be a hash containing an input
138
+ # type as key and the wrapper that will be used for all inputs with specified type.
139
+ # config.wrapper_mappings = { string: :prepend }
140
+
141
+ # Namespaces where SimpleForm should look for custom input classes that
142
+ # override default inputs.
143
+ # config.custom_inputs_namespaces << "CustomInputs"
144
+
145
+ # Default priority for time_zone inputs.
146
+ # config.time_zone_priority = nil
147
+
148
+ # Default priority for country inputs.
149
+ # config.country_priority = nil
150
+
151
+ # When false, do not use translations for labels.
152
+ # config.translate_labels = true
153
+
154
+ # Automatically discover new inputs in Rails' autoload path.
155
+ # config.inputs_discovery = true
156
+
157
+ # Cache SimpleForm inputs discovery
158
+ # config.cache_discovery = !Rails.env.development?
159
+
160
+ # Default class for inputs
161
+ # config.input_class = nil
162
+
163
+ # Define the default class of the input wrapper of the boolean input.
164
+ config.boolean_label_class = 'checkbox'
165
+
166
+ # Defines if the default input wrapper class should be included in radio
167
+ # collection wrappers.
168
+ # config.include_default_input_wrapper_class = true
169
+
170
+ # Defines which i18n scope will be used in Simple Form.
171
+ # config.i18n_scope = 'simple_form'
172
+
173
+ # Defines validation classes to the input_field. By default it's nil.
174
+ # config.input_field_valid_class = 'is-valid'
175
+ # config.input_field_error_class = 'is-invalid'
176
+ end
@@ -0,0 +1,372 @@
1
+ # frozen_string_literal: true
2
+
3
+ # These defaults are defined and maintained by the community at
4
+ # https://github.com/heartcombo/simple_form-bootstrap
5
+ # Please submit feedback, changes and tests only there.
6
+
7
+ # Uncomment this and change the path if necessary to include your own
8
+ # components.
9
+ # See https://github.com/heartcombo/simple_form#custom-components
10
+ # to know more about custom components.
11
+ # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
12
+
13
+ # Use this setup block to configure all options available in SimpleForm.
14
+ SimpleForm.setup do |config|
15
+ # Default class for buttons
16
+ config.button_class = 'btn'
17
+
18
+ # Define the default class of the input wrapper of the boolean input.
19
+ config.boolean_label_class = 'form-check-label'
20
+
21
+ # How the label text should be generated altogether with the required text.
22
+ config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" }
23
+
24
+ # Define the way to render check boxes / radio buttons with labels.
25
+ config.boolean_style = :inline
26
+
27
+ # You can wrap each item in a collection of radio/check boxes with a tag
28
+ config.item_wrapper_tag = :div
29
+
30
+ # Defines if the default input wrapper class should be included in radio
31
+ # collection wrappers.
32
+ config.include_default_input_wrapper_class = false
33
+
34
+ # CSS class to add for error notification helper.
35
+ config.error_notification_class = 'alert alert-danger'
36
+
37
+ # Method used to tidy up errors. Specify any Rails Array method.
38
+ # :first lists the first message for each field.
39
+ # :to_sentence to list all errors for each field.
40
+ config.error_method = :to_sentence
41
+
42
+ # add validation classes to `input_field`
43
+ config.input_field_error_class = 'is-invalid'
44
+ config.input_field_valid_class = 'is-valid'
45
+
46
+
47
+ # vertical forms
48
+ #
49
+ # vertical default_wrapper
50
+ config.wrappers :vertical_form, class: 'mb-3' do |b|
51
+ b.use :html5
52
+ b.use :placeholder
53
+ b.optional :maxlength
54
+ b.optional :minlength
55
+ b.optional :pattern
56
+ b.optional :min_max
57
+ b.optional :readonly
58
+ b.use :label, class: 'form-label'
59
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
60
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
61
+ b.use :hint, wrap_with: { class: 'form-text' }
62
+ end
63
+
64
+ # vertical input for boolean
65
+ config.wrappers :vertical_boolean, tag: 'fieldset', class: 'mb-3' do |b|
66
+ b.use :html5
67
+ b.optional :readonly
68
+ b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
69
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
70
+ bb.use :label, class: 'form-check-label'
71
+ bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
72
+ bb.use :hint, wrap_with: { class: 'form-text' }
73
+ end
74
+ end
75
+
76
+ # vertical input for radio buttons and check boxes
77
+ config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b|
78
+ b.use :html5
79
+ b.optional :readonly
80
+ b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
81
+ ba.use :label_text
82
+ end
83
+ b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
84
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
85
+ b.use :hint, wrap_with: { class: 'form-text' }
86
+ end
87
+
88
+ # vertical input for inline radio buttons and check boxes
89
+ config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b|
90
+ b.use :html5
91
+ b.optional :readonly
92
+ b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
93
+ ba.use :label_text
94
+ end
95
+ b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
96
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
97
+ b.use :hint, wrap_with: { class: 'form-text' }
98
+ end
99
+
100
+ # vertical file input
101
+ config.wrappers :vertical_file, class: 'mb-3' do |b|
102
+ b.use :html5
103
+ b.use :placeholder
104
+ b.optional :maxlength
105
+ b.optional :minlength
106
+ b.optional :readonly
107
+ b.use :label, class: 'form-label'
108
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
109
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
110
+ b.use :hint, wrap_with: { class: 'form-text' }
111
+ end
112
+
113
+ # vertical select input
114
+ config.wrappers :vertical_select, class: 'mb-3' do |b|
115
+ b.use :html5
116
+ b.optional :readonly
117
+ b.use :label, class: 'form-label'
118
+ b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
119
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
120
+ b.use :hint, wrap_with: { class: 'form-text' }
121
+ end
122
+
123
+ # vertical multi select
124
+ config.wrappers :vertical_multi_select, class: 'mb-3' do |b|
125
+ b.use :html5
126
+ b.optional :readonly
127
+ b.use :label, class: 'form-label'
128
+ b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
129
+ ba.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
130
+ end
131
+ b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
132
+ b.use :hint, wrap_with: { class: 'form-text' }
133
+ end
134
+
135
+ # vertical range input
136
+ config.wrappers :vertical_range, class: 'mb-3' do |b|
137
+ b.use :html5
138
+ b.use :placeholder
139
+ b.optional :readonly
140
+ b.optional :step
141
+ b.use :label, class: 'form-label'
142
+ b.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid'
143
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
144
+ b.use :hint, wrap_with: { class: 'form-text' }
145
+ end
146
+
147
+
148
+ # horizontal forms
149
+ #
150
+ # horizontal default_wrapper
151
+ config.wrappers :horizontal_form, class: 'row mb-3' do |b|
152
+ b.use :html5
153
+ b.use :placeholder
154
+ b.optional :maxlength
155
+ b.optional :minlength
156
+ b.optional :pattern
157
+ b.optional :min_max
158
+ b.optional :readonly
159
+ b.use :label, class: 'col-sm-3 col-form-label'
160
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
161
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
162
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
163
+ ba.use :hint, wrap_with: { class: 'form-text' }
164
+ end
165
+ end
166
+
167
+ # horizontal input for boolean
168
+ config.wrappers :horizontal_boolean, class: 'row mb-3' do |b|
169
+ b.use :html5
170
+ b.optional :readonly
171
+ b.wrapper :grid_wrapper, class: 'col-sm-9 offset-sm-3' do |wr|
172
+ wr.wrapper :form_check_wrapper, class: 'form-check' do |bb|
173
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
174
+ bb.use :label, class: 'form-check-label'
175
+ bb.use :full_error, wrap_with: { class: 'invalid-feedback' }
176
+ bb.use :hint, wrap_with: { class: 'form-text' }
177
+ end
178
+ end
179
+ end
180
+
181
+ # horizontal input for radio buttons and check boxes
182
+ config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', class: 'row mb-3' do |b|
183
+ b.use :html5
184
+ b.optional :readonly
185
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
186
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
187
+ ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
188
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
189
+ ba.use :hint, wrap_with: { class: 'form-text' }
190
+ end
191
+ end
192
+
193
+ # horizontal input for inline radio buttons and check boxes
194
+ config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', class: 'row mb-3' do |b|
195
+ b.use :html5
196
+ b.optional :readonly
197
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
198
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
199
+ ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
200
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
201
+ ba.use :hint, wrap_with: { class: 'form-text' }
202
+ end
203
+ end
204
+
205
+ # horizontal file input
206
+ config.wrappers :horizontal_file, class: 'row mb-3' do |b|
207
+ b.use :html5
208
+ b.use :placeholder
209
+ b.optional :maxlength
210
+ b.optional :minlength
211
+ b.optional :readonly
212
+ b.use :label, class: 'col-sm-3 col-form-label'
213
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
214
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
215
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
216
+ ba.use :hint, wrap_with: { class: 'form-text' }
217
+ end
218
+ end
219
+
220
+ # horizontal select input
221
+ config.wrappers :horizontal_select, class: 'row mb-3' do |b|
222
+ b.use :html5
223
+ b.optional :readonly
224
+ b.use :label, class: 'col-sm-3 col-form-label'
225
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
226
+ ba.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
227
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
228
+ ba.use :hint, wrap_with: { class: 'form-text' }
229
+ end
230
+ end
231
+
232
+ # horizontal multi select
233
+ config.wrappers :horizontal_multi_select, class: 'row mb-3' do |b|
234
+ b.use :html5
235
+ b.optional :readonly
236
+ b.use :label, class: 'col-sm-3 col-form-label'
237
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
238
+ ba.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
239
+ bb.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
240
+ end
241
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' }
242
+ ba.use :hint, wrap_with: { class: 'form-text' }
243
+ end
244
+ end
245
+
246
+ # horizontal range input
247
+ config.wrappers :horizontal_range, class: 'row mb-3' do |b|
248
+ b.use :html5
249
+ b.use :placeholder
250
+ b.optional :readonly
251
+ b.optional :step
252
+ b.use :label, class: 'col-sm-3 col-form-label pt-0'
253
+ b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba|
254
+ ba.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid'
255
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
256
+ ba.use :hint, wrap_with: { class: 'form-text' }
257
+ end
258
+ end
259
+
260
+
261
+ # inline forms
262
+ #
263
+ # inline default_wrapper
264
+ config.wrappers :inline_form, class: 'col-12' do |b|
265
+ b.use :html5
266
+ b.use :placeholder
267
+ b.optional :maxlength
268
+ b.optional :minlength
269
+ b.optional :pattern
270
+ b.optional :min_max
271
+ b.optional :readonly
272
+ b.use :label, class: 'visually-hidden'
273
+
274
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
275
+ b.use :error, wrap_with: { class: 'invalid-feedback' }
276
+ b.optional :hint, wrap_with: { class: 'form-text' }
277
+ end
278
+
279
+ # inline input for boolean
280
+ config.wrappers :inline_boolean, class: 'col-12' do |b|
281
+ b.use :html5
282
+ b.optional :readonly
283
+ b.wrapper :form_check_wrapper, class: 'form-check' do |bb|
284
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
285
+ bb.use :label, class: 'form-check-label'
286
+ bb.use :error, wrap_with: { class: 'invalid-feedback' }
287
+ bb.optional :hint, wrap_with: { class: 'form-text' }
288
+ end
289
+ end
290
+
291
+
292
+ # bootstrap custom forms
293
+ #
294
+ # custom input switch for boolean
295
+ config.wrappers :custom_boolean_switch, class: 'mb-3' do |b|
296
+ b.use :html5
297
+ b.optional :readonly
298
+ b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check form-switch' do |bb|
299
+ bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
300
+ bb.use :label, class: 'form-check-label'
301
+ bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
302
+ bb.use :hint, wrap_with: { class: 'form-text' }
303
+ end
304
+ end
305
+
306
+
307
+ # Input Group - custom component
308
+ # see example app and config at https://github.com/heartcombo/simple_form-bootstrap
309
+ config.wrappers :input_group, class: 'mb-3' do |b|
310
+ b.use :html5
311
+ b.use :placeholder
312
+ b.optional :maxlength
313
+ b.optional :minlength
314
+ b.optional :pattern
315
+ b.optional :min_max
316
+ b.optional :readonly
317
+ b.use :label, class: 'form-label'
318
+ b.wrapper :input_group_tag, class: 'input-group' do |ba|
319
+ ba.optional :prepend
320
+ ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
321
+ ba.optional :append
322
+ ba.use :full_error, wrap_with: { class: 'invalid-feedback' }
323
+ end
324
+ b.use :hint, wrap_with: { class: 'form-text' }
325
+ end
326
+
327
+
328
+ # Floating Labels form
329
+ #
330
+ # floating labels default_wrapper
331
+ config.wrappers :floating_labels_form, class: 'form-floating mb-3' do |b|
332
+ b.use :html5
333
+ b.use :placeholder
334
+ b.optional :maxlength
335
+ b.optional :minlength
336
+ b.optional :pattern
337
+ b.optional :min_max
338
+ b.optional :readonly
339
+ b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
340
+ b.use :label
341
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
342
+ b.use :hint, wrap_with: { class: 'form-text' }
343
+ end
344
+
345
+ # custom multi select
346
+ config.wrappers :floating_labels_select, class: 'form-floating mb-3' do |b|
347
+ b.use :html5
348
+ b.optional :readonly
349
+ b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid'
350
+ b.use :label
351
+ b.use :full_error, wrap_with: { class: 'invalid-feedback' }
352
+ b.use :hint, wrap_with: { class: 'form-text' }
353
+ end
354
+
355
+
356
+ # The default wrapper to be used by the FormBuilder.
357
+ config.default_wrapper = :vertical_form
358
+
359
+ # Custom wrappers for input types. This should be a hash containing an input
360
+ # type as key and the wrapper that will be used for all inputs with specified type.
361
+ config.wrapper_mappings = {
362
+ boolean: :vertical_boolean,
363
+ check_boxes: :vertical_collection,
364
+ date: :vertical_multi_select,
365
+ datetime: :vertical_multi_select,
366
+ file: :vertical_file,
367
+ radio_buttons: :vertical_collection,
368
+ range: :vertical_range,
369
+ time: :vertical_multi_select,
370
+ select: :vertical_select
371
+ }
372
+ end