Loop component could provide a parameter for delimiting its body for each
iteration
-----------------------------------------------------------------------------------
Key: TAPESTRY-2043
URL: https://issues.apache.org/jira/browse/TAPESTRY-2043
Project: Tapestry
Issue Type: Improvement
Components: Core Components, tapestry-core
Reporter: Chris Lewis
Fix For: 5.0, 5.0.8
There are cases where one needs to output a list of data and delimit the items.
In a simple situations, and in a world with perfect browsers, we could use CSS2
pseudo selectors to tack on trailng characters. In reality this is not an
option, at least not now. Say a page has a list of strings like so:
{ "one", "two", "three" }
The desired output is:
one, two, three
Currently this is not possible using the loop component. There are at least 2
solutions that could be implemented, each of which was suggested on the mailing
list. The first is to improve the 'language' used by T5 to support more tests:
<t:loop source="strings" value="var:string" index="var:index">
<a href="#" t:type="pagelink" page="nada"
context="var:string">${var:string}</a>
<t:if test="var:index < strings.size()">,</t:if>
</t:loop>
I'm under the impression that the language will be improved to do such things,
but in my opinion this delimiting function is a common enough need to
recognized it by a parameter in the Loop component proper:
<t:loop source="strings" value="var:string" delimiter=", ">
<a href="#" t:type="pagelink" page="nada"
context="var:string">${var:string}</a>
</t:loop>
The logic would ensure that the output is only delimited and not create leading
or trailing characters (if need they can be inserted outside of the component).
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]