Simple_form如何使接受字词复选框内嵌 [英] Simple_form how to make accept terms checkbox inline

查看:87
本文介绍了Simple_form如何使接受字词复选框内嵌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<p><%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %> 
Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
and <%=link_to "privacy Policy", privacy_path, :remote => true%></p>

最后看起来像这样

什么是最好的方法以将它们排列在同一行上。

What is the best way to line them up on the same line.

推荐答案

这是一个很简单的方法:

Here's a rather simple way:

<%= content_for(:the_links) do %>
    Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
    and <%=link_to "privacy Policy", privacy_path, :remote => true%>
<% end %>

<%= simple_form_for @user do |f| %>
  <%= f.input :email %>
  <%= f.input :password %>
  <%= f.input :terms, :as => :boolean, :label => content_for(:the_links)%> 
<% end%>

这篇关于Simple_form如何使接受字词复选框内嵌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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