Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple_form how to make accept terms 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>

It ends up looking like this

enter image description here

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

like image 910
Benamir Avatar asked Oct 24 '12 16:10

Benamir


2 Answers

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

the-non-styled-output

like image 124
Jesse Wolgamott Avatar answered Oct 18 '22 22:10

Jesse Wolgamott


Ensure the checkbox and text are small enough to fit in one row inside the container, then set display: inline; or float:left;

like image 43
Andy Avatar answered Oct 18 '22 22:10

Andy