allegutta
allegutta

Reputation: 5644

Rails: Simple_form on one line?

I am making a form with simple_form, and I'm trying to get all inputs on the same line (I want all elements to be inline horizontally on the rendered page).

I have googled the problem for some hours, but I couldn't find a solution that works.

The simple_form code:

<%= simple_form_for(@post, :html => {:class => 'form-inline' }) do |f| %>
   <%= f.input :link, label: false, placeholder: "here..." %>
   <%= f.input :type, as: :radio_buttons, collection: [['<span class="add-on"><i class="icon-on icon-white"></i></span>'.html_safe, '0'], ['<span class="add-on"><i class="icon-off icon-white"></i></span>'.html_safe, '1'], ['<span class="add-on"><i class="icon-on icon-white"></i> + <i class="icon-of icon-white"></i></span>'.html_safe, '2']], item_wrapper_class: 'inline', label: false %>
   <%= button_tag(type: 'submit', class: "btn btn-inverse") do %>
      <i class="icon-ok icon-white"></i>
   <% end %>
<% end %>

Any solution to this?

Upvotes: 3

Views: 4035

Answers (1)

Martin M
Martin M

Reputation: 8668

simple_form creates a form containing a div for each input. Each div contains a label and an input field

so your css should look like:

.form-inline div { display: inline-block }

Upvotes: 6

Related Questions