加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在Rails中使用simple_form,nested_form和Twitt

发布时间:2020-12-16 21:33:43 所属栏目:百科 来源:网络整理
导读:我正在使用simple_form,nested_form和Twitter Bootstrap,并尝试将nested_form中的“Remove Link”放在与对象相同的行上. 现在它看起来像这样: http://grab.by/eKDS 我希望它看起来像这样: http://grab.by/eKEc 这是我的代码的样子: %= cform.simple_field
我正在使用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 %>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读