cmor_core_backend 0.0.51.pre → 0.0.56.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/cmor/core/backend/resources_controller/base.rb +4 -0
  3. data/app/routes/cmor/core/backend/routing/resources_routes.rb +90 -0
  4. data/app/views/cmor/core/backend/resources_controller/base/_index_actions.html.haml +7 -0
  5. data/app/views/cmor/core/backend/resources_controller/base/_show_actions.html.haml +16 -0
  6. data/config/locales/de.yml +7 -0
  7. data/config/locales/en.yml +7 -0
  8. data/lib/cmor/core/backend/configuration.rb +32 -2
  9. data/lib/generators/cmor/core/backend/install/templates/initializer.rb +23 -0
  10. metadata +10 -77
  11. data/spec/dummy/Rakefile +0 -6
  12. data/spec/dummy/app/assets/config/manifest.js +0 -3
  13. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  14. data/spec/dummy/app/assets/javascripts/cable.js +0 -13
  15. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  16. data/spec/dummy/app/channels/application_cable/channel.rb +0 -4
  17. data/spec/dummy/app/channels/application_cable/connection.rb +0 -4
  18. data/spec/dummy/app/controllers/application_controller.rb +0 -2
  19. data/spec/dummy/app/controllers/backend_controller.rb +0 -2
  20. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  21. data/spec/dummy/app/jobs/application_job.rb +0 -2
  22. data/spec/dummy/app/mailers/application_mailer.rb +0 -4
  23. data/spec/dummy/app/models/application_record.rb +0 -3
  24. data/spec/dummy/app/views/layouts/application.html.erb +0 -15
  25. data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
  26. data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
  27. data/spec/dummy/bin/bundle +0 -3
  28. data/spec/dummy/bin/rails +0 -4
  29. data/spec/dummy/bin/rake +0 -4
  30. data/spec/dummy/bin/setup +0 -36
  31. data/spec/dummy/bin/update +0 -31
  32. data/spec/dummy/bin/yarn +0 -11
  33. data/spec/dummy/config.ru +0 -5
  34. data/spec/dummy/config/application.rb +0 -32
  35. data/spec/dummy/config/boot.rb +0 -5
  36. data/spec/dummy/config/cable.yml +0 -10
  37. data/spec/dummy/config/database.yml +0 -25
  38. data/spec/dummy/config/environment.rb +0 -5
  39. data/spec/dummy/config/environments/development.rb +0 -61
  40. data/spec/dummy/config/environments/production.rb +0 -94
  41. data/spec/dummy/config/environments/test.rb +0 -46
  42. data/spec/dummy/config/initializers/administador.rb +0 -24
  43. data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -8
  44. data/spec/dummy/config/initializers/assets.rb +0 -14
  45. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  46. data/spec/dummy/config/initializers/cmor_core_backend.rb +0 -12
  47. data/spec/dummy/config/initializers/content_security_policy.rb +0 -25
  48. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
  49. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  50. data/spec/dummy/config/initializers/i18n.rb +0 -2
  51. data/spec/dummy/config/initializers/inflections.rb +0 -16
  52. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  53. data/spec/dummy/config/initializers/simple_form.rb +0 -176
  54. data/spec/dummy/config/initializers/simple_form_bootstrap.rb +0 -440
  55. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  56. data/spec/dummy/config/locales/en.yml +0 -33
  57. data/spec/dummy/config/locales/simple_form.en.yml +0 -31
  58. data/spec/dummy/config/puma.rb +0 -34
  59. data/spec/dummy/config/routes.rb +0 -7
  60. data/spec/dummy/config/spring.rb +0 -6
  61. data/spec/dummy/config/storage.yml +0 -34
  62. data/spec/dummy/db/development.sqlite3 +0 -0
  63. data/spec/dummy/db/test.sqlite3 +0 -0
  64. data/spec/dummy/lib/templates/haml/scaffold/_form.html.haml +0 -12
  65. data/spec/dummy/log/development.log +0 -0
  66. data/spec/dummy/package.json +0 -5
  67. data/spec/dummy/public/404.html +0 -67
  68. data/spec/dummy/public/422.html +0 -67
  69. data/spec/dummy/public/500.html +0 -66
  70. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  71. data/spec/dummy/public/apple-touch-icon.png +0 -0
  72. data/spec/dummy/public/favicon.ico +0 -0
  73. data/spec/dummy/tmp/development_secret.txt +0 -1
  74. data/spec/rails_helper.rb +0 -62
  75. data/spec/spec_helper.rb +0 -96
  76. data/spec/support/capybara.rb +0 -1
  77. data/spec/support/factory_bot.rb +0 -12
  78. data/spec/support/pry-rails.rb +0 -1
  79. data/spec/support/rao-shoulda_matchers.rb +0 -5
  80. data/spec/support/shoulda_matchers.rb +0 -8
@@ -1,24 +0,0 @@
1
- Administrador.configure do |config|
2
- # Methods, that will be tried on a resource to generate a nice title
3
- #
4
- # Default: config.resource_label_methods = [:administrador_title, :human, :name, :identifier, :to_s]
5
- #
6
- config.resource_label_methods = [:administrador_title, :human, :name, :identifier, :to_s]
7
-
8
- # All controllers (for resources, services, sidebars, home, etc.) inherit
9
- # from this controller.
10
- #
11
- # Default: config.base_controller_class_name = '::ApplicationController'
12
- #
13
- config.base_controller_class_name = '::ApplicationController'
14
-
15
- # Enable additional features here.
16
- #
17
- # config.enable_feature(:kaminari, {})
18
- # config.enable_feature(:rao_query, {})
19
-
20
- # Engines that are registered will be shown in the administrador main menu
21
- # sidebar. Additionally they can register sidebars.
22
- #
23
- # config.register_engine 'Ecm::Blog::Backend::Engine', {}
24
- end
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # ActiveSupport::Reloader.to_prepare do
4
- # ApplicationController.renderer.defaults.merge!(
5
- # http_host: 'example.org',
6
- # https: false
7
- # )
8
- # end
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Add additional assets to the asset load path.
7
- # Rails.application.config.assets.paths << Emoji.images_path
8
- # Add Yarn node_modules folder to the asset load path.
9
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
-
11
- # Precompile additional assets.
12
- # application.js, application.css, and all non-JS/CSS in the app/assets
13
- # folder are already added.
14
- # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,12 +0,0 @@
1
- Cmor::Core::Backend.configure do |config|
2
- # Globally set variant options to be used in backends.
3
- #
4
- # default: config.image_variant_options = {
5
- # gallery: { resize: "640x480" },
6
- # table: { resize: "160x120" }
7
- # }
8
- config.image_variant_options = {
9
- gallery: { resize: "640x480" },
10
- table: { resize: "160x120" }
11
- }
12
- end
@@ -1,25 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Define an application-wide content security policy
4
- # For further information see the following documentation
5
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
-
7
- # Rails.application.config.content_security_policy do |policy|
8
- # policy.default_src :self, :https
9
- # policy.font_src :self, :https, :data
10
- # policy.img_src :self, :https, :data
11
- # policy.object_src :none
12
- # policy.script_src :self, :https
13
- # policy.style_src :self, :https
14
-
15
- # # Specify URI for violation reports
16
- # # policy.report_uri "/csp-violation-report-endpoint"
17
- # end
18
-
19
- # If you are using UJS then enable automatic nonce generation
20
- # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
-
22
- # Report CSP violations to a specified URI
23
- # For further information see the following documentation:
24
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
- # Rails.application.config.content_security_policy_report_only = true
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Specify a serializer for the signed and encrypted cookie jars.
4
- # Valid options are :json, :marshal, and :hybrid.
5
- Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,2 +0,0 @@
1
- Rails.application.config.i18n.available_locales = [:en, :de]
2
- Rails.application.config.i18n.default_locale = :de
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
@@ -1,176 +0,0 @@
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/plataformatec/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 overriden
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
@@ -1,440 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Please do not make direct changes to this file!
4
- # This generator is maintained by the community around simple_form-bootstrap:
5
- # https://github.com/rafaelfranca/simple_form-bootstrap
6
- # All future development, tests, and organization should happen there.
7
- # Background history: https://github.com/plataformatec/simple_form/issues/1561
8
-
9
- # Uncomment this and change the path if necessary to include your own
10
- # components.
11
- # See https://github.com/plataformatec/simple_form#custom-components
12
- # to know more about custom components.
13
- # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
14
-
15
- # Use this setup block to configure all options available in SimpleForm.
16
- SimpleForm.setup do |config|
17
- # Default class for buttons
18
- config.button_class = 'btn'
19
-
20
- # Define the default class of the input wrapper of the boolean input.
21
- config.boolean_label_class = 'form-check-label'
22
-
23
- # How the label text should be generated altogether with the required text.
24
- config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" }
25
-
26
- # Define the way to render check boxes / radio buttons with labels.
27
- config.boolean_style = :inline
28
-
29
- # You can wrap each item in a collection of radio/check boxes with a tag
30
- config.item_wrapper_tag = :div
31
-
32
- # Defines if the default input wrapper class should be included in radio
33
- # collection wrappers.
34
- config.include_default_input_wrapper_class = false
35
-
36
- # CSS class to add for error notification helper.
37
- config.error_notification_class = 'alert alert-danger'
38
-
39
- # Method used to tidy up errors. Specify any Rails Array method.
40
- # :first lists the first message for each field.
41
- # :to_sentence to list all errors for each field.
42
- config.error_method = :to_sentence
43
-
44
- # add validation classes to `input_field`
45
- config.input_field_error_class = 'is-invalid'
46
- config.input_field_valid_class = 'is-valid'
47
-
48
-
49
- # vertical forms
50
- #
51
- # vertical default_wrapper
52
- config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
53
- b.use :html5
54
- b.use :placeholder
55
- b.optional :maxlength
56
- b.optional :minlength
57
- b.optional :pattern
58
- b.optional :min_max
59
- b.optional :readonly
60
- b.use :label
61
- b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
62
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
63
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
64
- end
65
-
66
- # vertical input for boolean
67
- config.wrappers :vertical_boolean, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
68
- b.use :html5
69
- b.optional :readonly
70
- b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
71
- bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
72
- bb.use :label, class: 'form-check-label'
73
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
74
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
75
- end
76
- end
77
-
78
- # vertical input for radio buttons and check boxes
79
- config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
80
- b.use :html5
81
- b.optional :readonly
82
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
83
- ba.use :label_text
84
- end
85
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
86
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
87
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
88
- end
89
-
90
- # vertical input for inline radio buttons and check boxes
91
- config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
92
- b.use :html5
93
- b.optional :readonly
94
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
95
- ba.use :label_text
96
- end
97
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
98
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
99
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
100
- end
101
-
102
- # vertical file input
103
- config.wrappers :vertical_file, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
104
- b.use :html5
105
- b.use :placeholder
106
- b.optional :maxlength
107
- b.optional :minlength
108
- b.optional :readonly
109
- b.use :label
110
- b.use :input, class: 'form-control-file', error_class: 'is-invalid', valid_class: 'is-valid'
111
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
112
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
113
- end
114
-
115
- # vertical multi select
116
- config.wrappers :vertical_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
117
- b.use :html5
118
- b.optional :readonly
119
- b.use :label
120
- b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
121
- ba.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
122
- end
123
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
124
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
125
- end
126
-
127
- # vertical range input
128
- config.wrappers :vertical_range, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
129
- b.use :html5
130
- b.use :placeholder
131
- b.optional :readonly
132
- b.optional :step
133
- b.use :label
134
- b.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid'
135
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
136
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
137
- end
138
-
139
-
140
- # horizontal forms
141
- #
142
- # horizontal default_wrapper
143
- config.wrappers :horizontal_form, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
144
- b.use :html5
145
- b.use :placeholder
146
- b.optional :maxlength
147
- b.optional :minlength
148
- b.optional :pattern
149
- b.optional :min_max
150
- b.optional :readonly
151
- b.use :label, class: 'col-sm-3 col-form-label'
152
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
153
- ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
154
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
155
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
156
- end
157
- end
158
-
159
- # horizontal input for boolean
160
- config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
161
- b.use :html5
162
- b.optional :readonly
163
- b.wrapper tag: 'label', class: 'col-sm-3' do |ba|
164
- ba.use :label_text
165
- end
166
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |wr|
167
- wr.wrapper :form_check_wrapper, tag: 'div', class: 'form-check' do |bb|
168
- bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
169
- bb.use :label, class: 'form-check-label'
170
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
171
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
172
- end
173
- end
174
- end
175
-
176
- # horizontal input for radio buttons and check boxes
177
- config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
178
- b.use :html5
179
- b.optional :readonly
180
- b.use :label, class: 'col-sm-3 col-form-label pt-0'
181
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
182
- ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
183
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
184
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
185
- end
186
- end
187
-
188
- # horizontal input for inline radio buttons and check boxes
189
- config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
190
- b.use :html5
191
- b.optional :readonly
192
- b.use :label, class: 'col-sm-3 col-form-label pt-0'
193
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
194
- ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
195
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
196
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
197
- end
198
- end
199
-
200
- # horizontal file input
201
- config.wrappers :horizontal_file, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
202
- b.use :html5
203
- b.use :placeholder
204
- b.optional :maxlength
205
- b.optional :minlength
206
- b.optional :readonly
207
- b.use :label, class: 'col-sm-3 col-form-label'
208
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
209
- ba.use :input, error_class: 'is-invalid', valid_class: 'is-valid'
210
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
211
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
212
- end
213
- end
214
-
215
- # horizontal multi select
216
- config.wrappers :horizontal_multi_select, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
217
- b.use :html5
218
- b.optional :readonly
219
- b.use :label, class: 'col-sm-3 col-form-label'
220
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
221
- ba.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |bb|
222
- bb.use :input, class: 'form-control mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
223
- end
224
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
225
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
226
- end
227
- end
228
-
229
- # horizontal range input
230
- config.wrappers :horizontal_range, tag: 'div', class: 'form-group row', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
231
- b.use :html5
232
- b.use :placeholder
233
- b.optional :readonly
234
- b.optional :step
235
- b.use :label, class: 'col-sm-3 col-form-label'
236
- b.wrapper :grid_wrapper, tag: 'div', class: 'col-sm-9' do |ba|
237
- ba.use :input, class: 'form-control-range', error_class: 'is-invalid', valid_class: 'is-valid'
238
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
239
- ba.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
240
- end
241
- end
242
-
243
-
244
- # inline forms
245
- #
246
- # inline default_wrapper
247
- config.wrappers :inline_form, tag: 'span', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
248
- b.use :html5
249
- b.use :placeholder
250
- b.optional :maxlength
251
- b.optional :minlength
252
- b.optional :pattern
253
- b.optional :min_max
254
- b.optional :readonly
255
- b.use :label, class: 'sr-only'
256
-
257
- b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
258
- b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
259
- b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
260
- end
261
-
262
- # inline input for boolean
263
- config.wrappers :inline_boolean, tag: 'span', class: 'form-check mb-2 mr-sm-2', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
264
- b.use :html5
265
- b.optional :readonly
266
- b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid'
267
- b.use :label, class: 'form-check-label'
268
- b.use :error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
269
- b.optional :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
270
- end
271
-
272
-
273
- # bootstrap custom forms
274
- #
275
- # custom input for boolean
276
- config.wrappers :custom_boolean, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
277
- b.use :html5
278
- b.optional :readonly
279
- b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-checkbox' do |bb|
280
- bb.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
281
- bb.use :label, class: 'custom-control-label'
282
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
283
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
284
- end
285
- end
286
-
287
- # custom input switch for boolean
288
- config.wrappers :custom_boolean_switch, tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
289
- b.use :html5
290
- b.optional :readonly
291
- b.wrapper :form_check_wrapper, tag: 'div', class: 'custom-control custom-switch' do |bb|
292
- bb.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
293
- bb.use :label, class: 'custom-control-label'
294
- bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
295
- bb.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
296
- end
297
- end
298
-
299
- # custom input for radio buttons and check boxes
300
- config.wrappers :custom_collection, item_wrapper_class: 'custom-control', item_label_class: 'custom-control-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
301
- b.use :html5
302
- b.optional :readonly
303
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
304
- ba.use :label_text
305
- end
306
- b.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
307
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
308
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
309
- end
310
-
311
- # custom input for inline radio buttons and check boxes
312
- config.wrappers :custom_collection_inline, item_wrapper_class: 'custom-control custom-control-inline', item_label_class: 'custom-control-label', tag: 'fieldset', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
313
- b.use :html5
314
- b.optional :readonly
315
- b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba|
316
- ba.use :label_text
317
- end
318
- b.use :input, class: 'custom-control-input', error_class: 'is-invalid', valid_class: 'is-valid'
319
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
320
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
321
- end
322
-
323
- # custom file input
324
- config.wrappers :custom_file, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
325
- b.use :html5
326
- b.use :placeholder
327
- b.optional :maxlength
328
- b.optional :minlength
329
- b.optional :readonly
330
- b.use :label
331
- b.wrapper :custom_file_wrapper, tag: 'div', class: 'custom-file' do |ba|
332
- ba.use :input, class: 'custom-file-input', error_class: 'is-invalid', valid_class: 'is-valid'
333
- ba.use :label, class: 'custom-file-label'
334
- ba.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
335
- end
336
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
337
- end
338
-
339
- # custom multi select
340
- config.wrappers :custom_multi_select, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
341
- b.use :html5
342
- b.optional :readonly
343
- b.use :label
344
- b.wrapper tag: 'div', class: 'd-flex flex-row justify-content-between align-items-center' do |ba|
345
- ba.use :input, class: 'custom-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid'
346
- end
347
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
348
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
349
- end
350
-
351
- # custom range input
352
- config.wrappers :custom_range, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
353
- b.use :html5
354
- b.use :placeholder
355
- b.optional :readonly
356
- b.optional :step
357
- b.use :label
358
- b.use :input, class: 'custom-range', error_class: 'is-invalid', valid_class: 'is-valid'
359
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
360
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
361
- end
362
-
363
-
364
- # Input Group - custom component
365
- # see example app and config at https://github.com/rafaelfranca/simple_form-bootstrap
366
- # config.wrappers :input_group, tag: 'div', class: 'form-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
367
- # b.use :html5
368
- # b.use :placeholder
369
- # b.optional :maxlength
370
- # b.optional :minlength
371
- # b.optional :pattern
372
- # b.optional :min_max
373
- # b.optional :readonly
374
- # b.use :label
375
- # b.wrapper :input_group_tag, tag: 'div', class: 'input-group' do |ba|
376
- # ba.optional :prepend
377
- # ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
378
- # ba.optional :append
379
- # end
380
- # b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback d-block' }
381
- # b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
382
- # end
383
-
384
-
385
- # Floating Labels form
386
- #
387
- # floating labels default_wrapper
388
- config.wrappers :floating_labels_form, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
389
- b.use :html5
390
- b.use :placeholder
391
- b.optional :maxlength
392
- b.optional :minlength
393
- b.optional :pattern
394
- b.optional :min_max
395
- b.optional :readonly
396
- b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid'
397
- b.use :label
398
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
399
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
400
- end
401
-
402
- # custom multi select
403
- config.wrappers :floating_labels_select, tag: 'div', class: 'form-label-group', error_class: 'form-group-invalid', valid_class: 'form-group-valid' do |b|
404
- b.use :html5
405
- b.optional :readonly
406
- b.use :input, class: 'custom-select', error_class: 'is-invalid', valid_class: 'is-valid'
407
- b.use :label
408
- b.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' }
409
- b.use :hint, wrap_with: { tag: 'small', class: 'form-text text-muted' }
410
- end
411
-
412
-
413
- # The default wrapper to be used by the FormBuilder.
414
- config.default_wrapper = :vertical_form
415
-
416
- # Custom wrappers for input types. This should be a hash containing an input
417
- # type as key and the wrapper that will be used for all inputs with specified type.
418
- config.wrapper_mappings = {
419
- boolean: :vertical_boolean,
420
- check_boxes: :vertical_collection,
421
- date: :vertical_multi_select,
422
- datetime: :vertical_multi_select,
423
- file: :vertical_file,
424
- radio_buttons: :vertical_collection,
425
- range: :vertical_range,
426
- time: :vertical_multi_select
427
- }
428
-
429
- # enable custom form wrappers
430
- # config.wrapper_mappings = {
431
- # boolean: :custom_boolean,
432
- # check_boxes: :custom_collection,
433
- # date: :custom_multi_select,
434
- # datetime: :custom_multi_select,
435
- # file: :custom_file,
436
- # radio_buttons: :custom_collection,
437
- # range: :custom_range,
438
- # time: :custom_multi_select
439
- # }
440
- end