我无法使用简单形式:生成此输出
.row
.checkbox.check-default
%input#checkbox1{:checked => "checked", :type => "checkbox", :value => "1"}/
%label{:for => "checkbox1"} Keep Me Signed in
我当前的包装:
config.wrappers :inline_checkbox, :tag => 'div', :class => 'checkbox check-default', :error_class => 'error' do |b|
b.use :html5
b.use :label_input, :wrap_with => { :class => 'checkbox inline' }
end
更新
我不小心忽略了以下内容:
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :inline
我有第二个初始化器。。。谢谢你为我指明了正确的方向。。
我不是专家,但请记住,:label_input
按默认顺序一起输出label
和input
。也许你应该试试:
config.wrappers :inline_checkbox, :tag => 'div', :class => 'checkbox check-default', :error_class => 'error' do |b|
b.use :html5
b.use :input
b.use :label
end