Подтвердить что ты не робот

Simple_form, как установить условия accept checkbox inline

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

Он выглядит так:

enter image description here

Каков наилучший способ выстроить их на одной строке.

4b9b3361

Ответ 1

Вот довольно простой способ:

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

the-non-styled-output

Ответ 2

Убедитесь, что флажок и текст достаточно малы, чтобы вписаться в одну строку внутри контейнера, затем установите display: inline; или float:left;

Ответ 3

Попробуйте использовать wrapper_html следующим образом:

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