Skip to content
This repository

Couldn't find wrapper with name inline #61

Closed
tibbon opened this Issue · 9 comments

4 participants

David Fisher Nathan Van der Auwera Paul Millar Marc Morata Fité
David Fisher

I'm trying to model your examples using simple_form and Twitter Bootstrap, but I just can't seem to get them working. Getting an error about wrapper with the name inline. Where do I define this wrapper with the name inline?

<%= simple_form_for @broadcast, :wrapper => 'inline' do |f| %>
  <%= f.input :name %>
  <%= f.simple_fields_for :product_images, :wrapper => 'inline' do |image| %>
<%= render :partial => 'product_image_fields', :f => image %>
  <% end %>
    <%= f.submit nil, :class => 'btn btn-primary' %>
<% end %>
David Fisher

It would appear that my simple_form.rb initializer file doesn't have the inline one that your demo has. Since I'm using Bootstrap, I'm unsure which to use, but I'll mess around with it. For referennce, i'm talking about this one

  config.wrappers :inline, :class => 'clearfix', :error_class => :error do |b|
    b.use :placeholder
    b.use :label
    b.use :tag => 'div', :class => 'input' do |ba|
      ba.use :input
      ba.use :error, :tag => :span, :class => :'help-inline'
      ba.use :hint,  :tag => :span, :class => :'help-block'
    end

end

David Fisher

I've gotten a little farther. Sure enough, that wrapper seems to be working (no errors) but with the following Erb code, it renders the new items right above the :name input box.

<%= simple_form_for @broadcast, :wrapper => 'inline' do |f| %>
      <%= f.input :name %>
        <%= f.simple_fields_for :product_images, :wrapper => 'inline' do |image| %>
                    <%= render 'product_image_fields', :f => image %>
                <% end %>
                <%= link_to_add_association 'add photo', f, :product_images, :render_options => { :wrapper => 'inline' } %>
    <%= f.submit nil, :class => 'btn btn-primary' %>
<% end %>
Nathan Van der Auwera
Owner

Could you try writing your view as follows:

<%= simple_form_for @broadcast, :wrapper => 'inline' do |f| %>
  <%= f.input :name %>
  <div class="product-images">
    <%= f.simple_fields_for :product_images, :wrapper => 'inline' do |image| %>
      <%= render 'product_image_fields', :f => image %>
    <% end %>
    <div class='links'>
      <%= link_to_add_association 'add photo', f, :product_images, :render_options => { :wrapper => 'inline' } %>
    </div>
  </div>
  <%= f.submit nil, :class => 'btn btn-primary' %>
<% end %>

What versions of bootstrap and simple-form are you using? It could also be that my demo-project is no longer up to date with the latest versions. I will try to update that (later).

Paul Millar

I'm having the same issue that tibbon described: (Couldn't find wrapper with name inline) being a rails-newbie I'm not 100% if I'm just being stupid though...

Using rails 3.2, simple_form 2 and bootstrap-sass

Should I be defining this inline wrapper somewhere?

Paul Millar

Actually, I think I just figured this issue out... Instead of:

:render_options => { :wrapper => 'inline' }

it should be

:render_options =>  { :wrapper_html => { :class => 'inline' }}

Note: I may be talking out of my arse here.

Nathan Van der Auwera
Owner

Did you check out cocoon_simple_form_demo ?

There you can see there is an initializer config/initializers/simple_form.rb, which defines the wrapper :inline.

Now mind you: I still need to update that project to the latest versions, but for me (with the versions I used) that worked. I will try to make some time to update the demo-project to the latest version. Hope this helps.

Nathan Van der Auwera
Owner

Did you have any progress on this? I was not yet able to update the demo-project.

Paul Millar

My initializer didn't contain an inline wrapper, rather it was named bootstrap. I switched the wrapper to bootstrap and pretty much all good with the exception that the CSS needs tweaking (new items are created a level above where they should (if that makes sense))? But thats a different issue completely, so you can probably close this issue.

Thanks again for all your help :)

Marc Morata Fité

Seems that the :inline wrapper it's now the :bootstrap wrapper. Replacing on the example code :inline for :bootstrap works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.