config/initializers/simple_form.rb in msip-2.2.0.alfa3 vs config/initializers/simple_form.rb in msip-2.2.0.beta1

- old
+ new

@@ -1,6 +1,7 @@ # frozen_string_literal: true + # # Uncomment this and change the path if necessary to include your own # components. # See https://github.com/heartcombo/simple_form#custom-components to know # more about custom components. @@ -11,53 +12,58 @@ # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the # wrapper, change the order or even add your own to the # stack. The options given below are used to wrap the # whole input. - config.wrappers :default, class: :input, - hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b| + config.wrappers( + :default, + class: :input, + hint_class: :field_with_hint, + error_class: :field_with_errors, + valid_class: :field_without_errors, + ) do |b| ## Extensions enabled by default # Any of these extensions can be disabled for a # given input by passing: `f.input EXTENSION_NAME => false`. # You can make any of these extensions optional by # renaming `b.use` to `b.optional`. # Determines whether to use HTML5 (:email, :url, ...) # and required attributes - b.use :html5 + b.use(:html5) # Calculates placeholders automatically from I18n # You can also pass a string as f.input placeholder: "Placeholder" - b.use :placeholder + b.use(:placeholder) ## Optional extensions # They are disabled unless you pass `f.input EXTENSION_NAME => true` # to the input. If so, they will retrieve the values from the model # if any exists. If you want to enable any of those # extensions by default, you can change `b.optional` to `b.use`. # Calculates maxlength from length validations for string inputs # and/or database column lengths - b.optional :maxlength + b.optional(:maxlength) # Calculate minlength from length validations for string inputs - b.optional :minlength + b.optional(:minlength) # Calculates pattern from format validations for string inputs - b.optional :pattern + b.optional(:pattern) # Calculates min and max from length validations for numeric inputs - b.optional :min_max + b.optional(:min_max) # Calculates readonly automatically from readonly attributes - b.optional :readonly + b.optional(:readonly) ## Inputs # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid' - b.use :label_input - b.use :hint, wrap_with: { tag: :span, class: :hint } - b.use :error, wrap_with: { tag: :span, class: :error } + b.use(:label_input) + b.use(:hint, wrap_with: { tag: :span, class: :hint }) + b.use(:error, wrap_with: { tag: :span, class: :error }) ## full_messages_for # If you want to display the full error message for the attribute, you can # use the component :full_error, like: # @@ -72,22 +78,22 @@ # inline: input + label # nested: label > input config.boolean_style = :nested # Default class for buttons - config.button_class = 'btn' + config.button_class = "btn" # Method used to tidy up errors. Specify any Rails Array method. # :first lists the first message for each field. # Use :to_sentence to list all errors for each field. # config.error_method = :first # Default tag used for error notification helper. config.error_notification_tag = :div # CSS class to add for error notification helper. - config.error_notification_class = 'error_notification' + config.error_notification_class = "error_notification" # Series of attempts to detect a default label method for collection. # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] # Series of attempts to detect a default value method for collection. @@ -156,13 +162,13 @@ # Cache SimpleForm inputs discovery # config.cache_discovery = !Rails.env.development? # Default class for inputs - config.input_class = 'msip-sf-bs-input' + config.input_class = "msip-sf-bs-input" # Define the default class of the input wrapper of the boolean input. - config.boolean_label_class = 'checkbox' + config.boolean_label_class = "checkbox" # Defines if the default input wrapper class should be included in radio # collection wrappers. # config.include_default_input_wrapper_class = true