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
<ruralhun...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org