Tapestry
  1. Tapestry
  2. TAPESTRY-2509

Add type coercions from String to Renderable, Block

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.13
    • Fix Version/s: 5.0.15
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Having a String to Block coercion would allow the following to be equivalent (excluding minor whitespace issues):

      <t:if test="stuff">
      $

      {stuff}
      <t:parameter name="else">No stuff to display.
      </t:if>

      and

      <t:if test="stuff" else="No stuff to display">
      ${stuff}

      </t:if>

      This could also be implemented as String -> Renderable and Renderable -> Block; this would allow (for example) a lone component to be passed to a component parameter of type Block.

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Of course, it's all about the type coercion. It provides a lot of functionality for free, if you "prime the pump" with a few well selected coercions.

        Show
        Howard M. Lewis Ship added a comment - Of course, it's all about the type coercion. It provides a lot of functionality for free, if you "prime the pump" with a few well selected coercions.
        Hide
        Renat Zubairov added a comment -

        Will the following case also work?

        <t:if test="stuff" else="message:nothing-to-display">
        $

        {stuff}

        </t:if>

        Show
        Renat Zubairov added a comment - Will the following case also work? <t:if test="stuff" else="message:nothing-to-display"> $ {stuff} </t:if>

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development