Tapestry 5
  1. Tapestry 5
  2. TAP5-496

Change If and Unless to render thier template element if provided (i.e., when using t:type) as well as informal parameters

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.18
    • Fix Version/s: 5.1.0.0
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      I use a lot of dummy texts in my template to see what the page will actually look like when rendered. To filter out these fragments I created a "Dummy" component whose setupRender method always returns "false".

      I don't know if this is efficient but it would be nice to have something like this already in T5's component library.

      More efficient would be a special marker XML attribute that the template parser recognizes. Maybe something like a t:test attribute which is works like <t:if test="...">...</t:if>. If the contained expression evaluations to false or null the marked element is filtered.

      <ul>
      <li t:test="show.item">conditional item</li>
      <li t:test="literal:false">dummy item</li>
      </ul>

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        You are correct, I thought I had implemented that for If, but I've only done it for Loop.

        Show
        Howard M. Lewis Ship added a comment - You are correct, I thought I had implemented that for If, but I've only done it for Loop.
        Hide
        Folke Behrens added a comment -

        The If component's element, the <li> in this case, will not appear in output markup.

        Show
        Folke Behrens added a comment - The If component's element, the <li> in this case, will not appear in output markup.
        Hide
        Howard M. Lewis Ship added a comment -

        Already in the framework,

        <ul>
        <li t:type="if" t:test="show.item">conditional item</li>
        <li t:type="if" t:test="literal:false">dummy item</li>
        </ul>

        If, Unless and Loop adapt to the element used to define them in the template.

        Show
        Howard M. Lewis Ship added a comment - Already in the framework, <ul> <li t:type="if" t:test="show.item">conditional item</li> <li t:type="if" t:test="literal:false">dummy item</li> </ul> If, Unless and Loop adapt to the element used to define them in the template.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development