中更改为类。
我有一个基于时间的输入,我想显示为一个输入与两个默认选择框。我发现解决方案是将html: true
添加到我的输入中。不幸的是,这将输入的父容器类别从form-control
更改为form-inline
。有没有一种方法可以从SimpleForm内部更改它,而无需明确地将其在HTML选项Hash?
转到Simple_form_form_bootstrap.rb并检查此SNIP
config.wrappers :multi_select, tag: :div, class: 'form-group', error_class: 'has-danger' do |b|
b.use :html5
b.optional :readonly
b.use :label
b.wrapper tag: :div, class: 'form-inline' do |ba|
ba.use :input, class: 'form-control'
ba.use :error, wrap_with: { tag: :div, class: 'invalid-feedback' }
ba.use :hint, wrap_with: { tag: :small, class: 'form-text text-muted' }
end
end
有您要寻找的表单内线,请注意,时间和日期的默认包装器是multi_select
config.wrapper_mappings = {
check_boxes: :horizontal_radio_and_checkboxes,
radio_buttons: :horizontal_radio_and_checkboxes,
file: :horizontal_file_input,
boolean: :horizontal_boolean,
datetime: :multi_select,
date: :multi_select,
time: :multi_select
}