包装'简单形式'

时间:2015-04-07 17:45:13

标签: ruby-on-rails haml 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

我有第二个初始化程序...感谢您指出我正确的方向..

1 个答案:

答案 0 :(得分:0)

我不是专家,但请记住: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