Rails:简单表单复选框和材料设计

时间:2016-09-28 10:42:41

标签: ruby-on-rails ruby-on-rails-4 material-design simple-form

我一直在试图弄清楚如何使简单的表单为复选框生成正确的代码。

我尝试创建的代码是:

<div class="checkbox m-b-15">
  <input value="0" type="hidden" name="group[open]">
  <label>
    <input class="boolean optional" type="checkbox" value="1" checked="checked" name="group[open]" id="group_open">
    <i class="input-helper"></i>
    Label text
  </label>
</div>

到目前为止我设法生成

<div class="checkbox"><input value="0" type="hidden" name="group[open]">
  <label class="boolean optional" for="group_open">
  <input class="boolean optional" type="checkbox" value="1" checked="checked" name="group[open]" id="group_open">
    Label text
  </label>
</div>

使用以下代码

b.wrapper tag: :label do |ba|
  ba.use :input

  # <i class="input-helper"></i> tag should go here

  ba.use :label_text
end

那么如何插入i tag?

<i class="input-helper"></i>

0 个答案:

没有答案