2012-10-08 11:51:56 +02:00
|
|
|
# Use this setup block to configure all options available in SimpleForm.
|
|
|
|
SimpleForm.setup do |config|
|
2014-11-21 14:37:56 +01:00
|
|
|
config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
|
2012-10-08 11:51:56 +02:00
|
|
|
b.use :html5
|
|
|
|
b.use :placeholder
|
|
|
|
b.use :label
|
2014-11-21 14:37:56 +01:00
|
|
|
b.wrapper tag: 'div', class: 'controls' do |ba|
|
2012-10-08 11:51:56 +02:00
|
|
|
ba.use :input
|
2014-11-21 14:37:56 +01:00
|
|
|
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
|
|
|
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
2012-10-08 11:51:56 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-21 14:37:56 +01:00
|
|
|
config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
2012-10-08 11:51:56 +02:00
|
|
|
b.use :html5
|
|
|
|
b.use :placeholder
|
|
|
|
b.use :label
|
2014-11-21 14:37:56 +01:00
|
|
|
b.wrapper tag: 'div', class: 'controls' do |input|
|
|
|
|
input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
|
2012-10-08 11:51:56 +02:00
|
|
|
prepend.use :input
|
|
|
|
end
|
2014-11-21 14:37:56 +01:00
|
|
|
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
|
|
|
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
2012-10-08 11:51:56 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-21 14:37:56 +01:00
|
|
|
config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
|
2012-10-08 11:51:56 +02:00
|
|
|
b.use :html5
|
|
|
|
b.use :placeholder
|
|
|
|
b.use :label
|
2014-11-21 14:37:56 +01:00
|
|
|
b.wrapper tag: 'div', class: 'controls' do |input|
|
|
|
|
input.wrapper tag: 'div', class: 'input-append' do |append|
|
2012-10-08 11:51:56 +02:00
|
|
|
append.use :input
|
|
|
|
end
|
2014-11-21 14:37:56 +01:00
|
|
|
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
|
|
|
|
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
2012-10-08 11:51:56 +02:00
|
|
|
end
|
|
|
|
end
|
2014-11-21 14:37:56 +01:00
|
|
|
|
2013-06-26 15:16:52 +02:00
|
|
|
# Do not use the label in tables
|
2014-11-21 14:37:56 +01:00
|
|
|
config.wrappers :intable, tag: 'div', class: 'control-group control-group-intable', error_class: 'error' do |b|
|
2013-06-26 15:16:52 +02:00
|
|
|
b.use :html5
|
|
|
|
b.use :placeholder
|
2014-11-21 14:37:56 +01:00
|
|
|
b.wrapper tag: 'div', class: 'controls controls-intable' do |ba|
|
2013-06-26 15:16:52 +02:00
|
|
|
ba.use :input
|
2014-11-21 14:37:56 +01:00
|
|
|
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
|
|
|
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
|
2013-06-26 15:16:52 +02:00
|
|
|
end
|
|
|
|
end
|
2014-11-21 14:37:56 +01:00
|
|
|
|
2012-10-08 11:51:56 +02:00
|
|
|
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
|
|
|
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
|
|
|
# to learn about the different styles for forms and inputs,
|
|
|
|
# buttons and other elements.
|
|
|
|
config.default_wrapper = :bootstrap
|
|
|
|
end
|