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

こんな感じになってしまいます

ここに画像の説明を入力してください

それらを同じ線上に並べる最良の方法は何ですか。

4

3 に答える 3

23

かなり簡単な方法は次のとおりです。

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

于 2012-10-24T17:11:20.817 に答える
1

チェックボックスとテキストがコンテナ内の1行に収まるほど小さいことを確認してから、display: inline;またはを設定します。float:left;

于 2012-10-24T16:55:33.550 に答える
0

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>
于 2012-10-24T16:56:10.063 に答える