Improve foundation initializer code quality and comment to make it clearer
This commit is contained in:
parent
eb3ee37383
commit
8e7ba80e29
|
@ -1,9 +1,13 @@
|
|||
# Use this setup block to configure all options available in SimpleForm.
|
||||
SimpleForm.setup do |config|
|
||||
# Don't forget to edit this file to adapt to your needs (specially
|
||||
# Don't forget to edit this file to adapt it to your needs (specially
|
||||
# all the grid-related classes)
|
||||
#
|
||||
# Please note that hints are commented out by default since Foundation
|
||||
# does't provide styles for hints. You will need to provide your own CSS styles for hints.
|
||||
# Uncomment them to enable hints.
|
||||
|
||||
config.wrappers :vertical_foundation, class: :input, hint_class: :field_with_hint, error_class: :error do |b|
|
||||
config.wrappers :vertical_form, class: :input, hint_class: :field_with_hint, error_class: :error do |b|
|
||||
b.use :html5
|
||||
b.use :placeholder
|
||||
b.optional :maxlength
|
||||
|
@ -13,8 +17,6 @@ SimpleForm.setup do |config|
|
|||
b.use :label_input
|
||||
b.use :error, wrap_with: { tag: :small, class: :error }
|
||||
|
||||
# Uncomment the following line to enable hints. The line is commented out by default since Foundation
|
||||
# does't provide styles for hints. You will need to provide your own CSS styles for hints.
|
||||
# b.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||
end
|
||||
|
||||
|
@ -33,7 +35,7 @@ SimpleForm.setup do |config|
|
|||
b.wrapper :right_input_wrapper, tag: :div, class: 'small-9 columns' do |ba|
|
||||
ba.use :input
|
||||
ba.use :error, wrap_with: { tag: :small, class: :error }
|
||||
ba.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||
# ba.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -52,6 +54,13 @@ SimpleForm.setup do |config|
|
|||
end
|
||||
end
|
||||
|
||||
# Foundation does not provide a way to handle inline forms
|
||||
# This wrapper can be used to create an inline form
|
||||
# by hiding that labels on every screen sizes ('hidden-for-small-up').
|
||||
#
|
||||
# Note that you need to adapt this wrapper to your needs. If you need a 4
|
||||
# columns form then change the wrapper class to 'small-3', if you need
|
||||
# only two use 'small-6' and so on.
|
||||
config.wrappers :inline_form, tag: 'div', class: 'column small-4', hint_class: :field_with_hint, error_class: :error do |b|
|
||||
b.use :html5
|
||||
b.use :placeholder
|
||||
|
@ -67,10 +76,10 @@ SimpleForm.setup do |config|
|
|||
# b.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||
end
|
||||
|
||||
# Example of use:
|
||||
# Examples of use:
|
||||
# - wrapper_html: {class: 'row'}, custom_wrapper_html: {class: 'column small-12'}
|
||||
# - custom_wrapper_html: {class: 'column small-3 end'}
|
||||
config.wrappers :foundation_customizable_wrapper, tag: 'div', error_class: :error do |b|
|
||||
config.wrappers :customizable_wrapper, tag: 'div', error_class: :error do |b|
|
||||
b.use :html5
|
||||
b.optional :readonly
|
||||
|
||||
|
@ -94,5 +103,5 @@ SimpleForm.setup do |config|
|
|||
config.error_notification_class = 'alert-box alert'
|
||||
|
||||
# The default wrapper to be used by the FormBuilder.
|
||||
config.default_wrapper = :vertical_foundation
|
||||
config.default_wrapper = :vertical_form
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue