环绕 'simple form'

Wrapping 'simple form'

我无法用简单形式生成此输出:

.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 按默认顺序一起输出 labelinput。也许你应该试试:

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