You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2008/10/16 19:23:45 UTC

[jira] Updated: (TAP5-114) improve if component to support block when test is true

     [ https://issues.apache.org/jira/browse/TAP5-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAP5-114:
--------------------------------------

    Issue Type: Improvement  (was: Bug)

> improve if component to support block when test is true
> -------------------------------------------------------
>
>                 Key: TAP5-114
>                 URL: https://issues.apache.org/jira/browse/TAP5-114
>             Project: Tapestry 5
>          Issue Type: Improvement
>    Affects Versions: 5.0.15
>            Reporter: Davor Hrg
>            Priority: Minor
>
> This addition can make if component more versatile:
> I came up with this while trying to make the template code more readable.
> The first version was some ifs and loops which I decided to break up into blocks,
> so that logic inside the loop is more readable.
> so one snippet stuck to me as it can be done better...
> the first version was:
> <t:if test="currentContainer"><t:delegate to="containerEditor"/></t:if>
> <t:unless test="currentContainer"><t:delegate to="block:containerDisplay"/></t:unless>
> version 2.
> <t:if test="currentContainer" else="block:containerDisplay"><t:delegate to="containerEditor"/></t:if>
> this is scrambled and akward so I've made a copy of if component and got this:
> <t:if test="currentContainer" render="containerEditor" else="block:containerDisplay"/>
> with "render" block parameter the if component in this case becomes simpler to read
> and can also act as conditional delegate when "else" block parameter is ommited:
> <t:if test="currentContainer" render="containerEditor" else="block:containerDisplay"/>
> this also simply doable by pushing more logic to java code:
> <t:delegate to="containerRender"/>
> public Object getContainerRender(){
>     if(isCurrentContainer){
>         return _containerEditor;
>     }else{
>         return _resources.getBlock("containerDisplay");
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org