Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

Bad interaction between tags and a collection that follows #119

Closed hbaragar closed 9 years ago

hbaragar commented 10 years ago

I want the <new-link> for a child collection to precede the collection on the <show-page> of the parent. However, this has the effect of creating two "empty" cards and suppressing the <empty-message> and <else> tags.

To recreate the problem:

    hobo g resource Parent name hm:children
    hobo g resource Child name bt:parent
    hobo g migrate
    <show-page>
      <before-collection:>
         <a:children action="new" if="&can_create?(@parent.children)" param="new-link">
            <ht key="child.actions.new" count="1">
              New Child
            </ht>
         </a:children>
      </before-collection:>
    </show-page>

Note that using <after-collection-heading:> exhibits the same problem. I don't know of any work-arounds.

I have found that the action="new" and if="&can_create?(@parent.children)" param="new-link" attributes each cause one of the "blank" cards to be created.

hbaragar commented 10 years ago

I think this is related: if you add the following before the <a...>...</a>

        <unless:children>
          Empty Message
        </unless:children>

it prints out Empty Message when there are no records in the collection, but it does not when put after the <a...>...</a>.

iox commented 10 years ago

Thanks Henry for the nice bug description. I remember seeing something similar before, something to do with some instance variable being set and thus printing that extra card.

iox commented 9 years ago

I think this commit fixed this issue: https://github.com/Hobo/hobo/commit/bbc6e9b92ab42711e51f036a569acd5ef56da28d

I will close it for now. @hbaragar , feel free to reopen it if it's still happening!

Warm regards, Ignacio