ruby-on-rails – 在Rails中使用simple_form,nested_form和Twitter Bootstrap内联添加控件

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在Rails中使用simple_form,nested_form和Twitter Bootstrap内联添加控件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用simple_form,nested_form和Twitter Bootstrap,并尝试将nested_form中的“Remove Link”放在与对象相同的行上.

现在它看起来像这样:

http://grab.by/eKDS

我希望它看起来像这样:

http://grab.by/eKEc

这是我的代码的样子:

<%= cform.simple_fields_for :licensings do |lf| %>
  <%= lf.input :state,:collection => us_states,:wrapper => false %>
  <%= lf.link_to_remove "Remove this Licensing",:class => 'btn btn-mini btn-danger' %>
<% end %>

我已经尝试将第二个link_to_remove放在第一个lf.input的块中,但是实际的下拉列表没有出现.我查看了simple_form的代码,但是我无法找到是否有办法实现这一目标.

解决方法

谢谢你的答案,但我无法工作.我在Google网上论坛邮件列表中找到了答案:

https://groups.google.com/forum/?fromgroups#!topic/plataformatec-simpleform/hL9ek5svyAU

<%= cform.simple_fields_for :licensings do |lf| %>
    <%= lf.input :state do %>
      <%= lf.input_field :state,:collection => us_states  %>
      <%= lf.link_to_remove "Remove this Licensing",:class => 'btn btn-mini btn-danger' %>
    <% end %>
  <% end %>
原文链接:https://www.f2er.com/ruby/267264.html

猜你在找的Ruby相关文章