在 Rails 中使用 simple_form、nested_form 和 Twitter Bootstrap 添加内联控件 [英] Adding controls inline with simple_form, nested_form and Twitter Bootstrap in Rails

查看:40
本文介绍了在 Rails 中使用 simple_form、nested_form 和 Twitter Bootstrap 添加内联控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 simple_form、nested_form 和 Twitter Bootstrap,并尝试将 Nested_form 中的删除链接"与对象放在同一行.

I'm using simple_form, nested_form and Twitter Bootstrap and trying to put the "Remove Link" from nested_form on the same line as the object.

现在看起来像这样:

http://grab.by/eKDS

我希望它看起来像这样:

and I want it to look like this:

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 的代码,但我无法确定是否有办法完成此操作.

I've tried putting the second link_to_remove inside a block for the first lf.input but then the actual dropdown doesn't appear. I've looked through simple_form's code but I wasn't able to track down if there was a way to accomplish this.

推荐答案

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

Thanks for the answers but I couldn't get either to work. I found the answer on the Google Groups mailing list:

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 %>

这篇关于在 Rails 中使用 simple_form、nested_form 和 Twitter Bootstrap 添加内联控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆