Re: Empty body?
On Mon, Mar 15, 2010 at 5:07 PM, Robert Hailey rob...@cmediacorp.comwrote: On Mar 12, 2010, at 1:20 PM, Manuel Sugawara wrote: Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like: I am not able to find such a menu component in the howtos. Can you provide a link please? http://wiki.apache.org/tapestry/Tapestry5LayoutWithMenu Regards, Manuel.
Re: Empty body?
Hi Manuel, Seems more logical to have the ul at the same level as the li. That way you will know if you have generated any li. BR Mats Manuel Sugawara skrev: Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like: t:content li t:if test=isPage t:pageLink page=prop:page class=prop:className${pageTitle}/t:pageLink p:else a href=# class=${className}${pageTitle}/a /p:else /t:if ul t:body/ /ul /li /t:content however this template still renders an empty ul if there is no body. I would like to conditionally display the ul depending if there is a body or not. Something like: t:if test=hasBody ul t:body/ /ul /t:if Now, I have solved this implementing the hasBody method like: @Inject private ComponentResources resources; public boolean getHasBody() { Block block = resources.getBody(); if (PlaceholderBlock.equals(block.toString())) { return false; } return true; } This works but seems a bit flaky. Is there a better way to figure out if a block is empty? Regards, Manuel. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Empty body?
On Mar 12, 2010, at 1:20 PM, Manuel Sugawara wrote: Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like: I am not able to find such a menu component in the howtos. Can you provide a link please? -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Empty body?
Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like: t:content li t:if test=isPage t:pageLink page=prop:page class=prop:className${pageTitle}/t:pageLink p:else a href=# class=${className}${pageTitle}/a /p:else /t:if ul t:body/ /ul /li /t:content however this template still renders an empty ul if there is no body. I would like to conditionally display the ul depending if there is a body or not. Something like: t:if test=hasBody ul t:body/ /ul /t:if Now, I have solved this implementing the hasBody method like: @Inject private ComponentResources resources; public boolean getHasBody() { Block block = resources.getBody(); if (PlaceholderBlock.equals(block.toString())) { return false; } return true; } This works but seems a bit flaky. Is there a better way to figure out if a block is empty? Regards, Manuel.