You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rural Hunter <ru...@gmail.com> on 2013/11/01 00:59:41 UTC
Re: [5.4] Is preview-able TML dead?
I see. Thanks for the nice trick!
δΊ 2013/10/31 20:27, Thiago H de Paula Figueiredo ει:
> On Wed, 30 Oct 2013 22:16:59 -0200, Rural Hunter
> <ru...@gmail.com> wrote:
>
>> Thiago,
>>
>> Good answer and I learnt from it. Is there a good way to handle the
>> Layout thing?
>
> Yep!
>
> Here's an example and the code of the crud/Remove and crud/JustBody
> will be listed below. The Layout component is normal, declaring <htm>,
> <head>, <link type="text/css"> etc, plus a <body> with <t:body/>
> somewhere inside it.
>
> A page using the Layout component. Notice the use of crud/Remove and
> crud/JustBody:
>
> <html t:type="Layout"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3_0.xsd">
> <!-- For previewability, as this tag will not appear in generated
> pages -->
> <head t:type="crud/Remove">
> <title>Welcome!</title>
> <link href="css/main.css" rel="stylesheet" type="text/css"/>
> </head>
> <!-- The body tag will not appear in the generated page, just its
> contents (body). -->
> <body t:type="crud/JustBody">
> ... content ...
> </body>
> </html>
>
> crud/Remove (I'm not sure the DiscardBody mixin here is actually needed):
>
> /**
> * A component that doesn't render its tag nor its body. It is used for
> * previewability purposes and works a lot like Tapestry 4's
> <code>$remove$</code>.
> * One example can be found
> * <a
> href="http://ars-machina.svn.sourceforge.net/viewvc/ars-machina/example/trunk/src/main/webapp/Index.tml?view=markup"
> * >in the Ars Machina Project Example Application</a>.
> *
> * @author Thiago H. de Paula Figueiredo
> */
> public class Remove {
>
> @Mixin
> @SuppressWarnings("unused")
> private DiscardBody discardBody;
>
> @SetupRender
> public boolean nothing() {
> return true;
> }
>
> }
>
> crud/JustBody:
>
> /**
> * A component that just renders its body, not its tag, thus providing
> previewability
> * for Tapestry templates. It was meant to be used in the
> * <code>body</code> tag that in pages that use some Layout component.
> * One example can be found
> * <a
> href="http://ars-machina.svn.sourceforge.net/viewvc/ars-machina/example/trunk/src/main/webapp/Index.tml?view=markup"
> * >in the Ars Machina Project Example Application</a>.
> *
> * @author Thiago H. de Paula Figueiredo
> */
> public class JustBody {
>
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org