【问题标题】:Wrapping 'simple form'包装“简单形式”
【发布时间】:2015-04-07 17:45:13
【问题描述】:

我不能用简单的形式产生这个输出

.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

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

【问题讨论】:

    标签: ruby-on-rails haml simple-form


    【解决方案1】:

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

    【讨论】:

    • 感谢您的提示!我完全忽略了我用于 simple_form 的第二个初始化程序...它没有解决但指出了正确的方向,因此我接受,我会更新问题....
    • 如果您在 Zurb Foundation 中使用 simple_form,我已经在这里解决了复选框问题:github.com/plataformatec/simple_form/wiki/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    相关资源
    最近更新 更多