Simple_form how to make accept terms checkbox inline

后端 未结 3 803
无人共我
无人共我 2020-12-31 13:32

<%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %> Accept <%= link_to \"Terms of use\", terms_path,:remot

相关标签:
3条回答
  • 2020-12-31 14:09

    Try using wrapper_html like this:

    <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>
    
    0 讨论(0)
  • 2020-12-31 14:10

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

    0 讨论(0)
  • 2020-12-31 14:22

    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

    0 讨论(0)
提交回复
热议问题