Простая форма как сделать флажок принять условия встроенным
<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>
В конечном итоге это выглядит так

Как лучше всего выстроить их в одну линию?
3 ответов:
Вот довольно простой способ:
<%= 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%>
Убедитесь, что флажок и текст достаточно малы, чтобы поместиться в одной строке внутри контейнера, затем установите
display: inline;илиfloat:left;
Попробуйте использовать
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>

Comments