Couldn't find wrapper with name inline #61

Closed
tibbon opened this Issue Apr 24, 2012 · 9 comments

4 participants

@tibbon

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

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

@tibbon

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 %>
@nathanvda
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).

@digitaldawn

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?

@digitaldawn

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.

@nathanvda
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.

@nathanvda
Owner

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

@digitaldawn

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

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

@eidus eidus added a commit to eidus/cocoon that referenced this issue Jul 6, 2012
@eidus eidus Modified the documentation to reflect resolved issue #61 b11423e
@nathanvda nathanvda closed this Oct 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment