Tapestry
  1. Tapestry
  2. TAPESTRY-2542

Add new method hasBody() to ComponentResources, to reveal if component has a body or not

    Details

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

      Description

      Same idea as in Tapestry-2541 but in a much lighter way :

      In my case, I use the Layout pattern for rendering my pages, but depending on the situation, sometimes the body of the layout is empty. In that case I would like to display a generic content. So I imagine something like this :

      <t:if test="hasBody">
      Blah blah blah
      <t:parameter name="else">
      <t:body />
      </t:parameter>
      </t:if>

      But I don't know how to write the test "hasBody".

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568179 ] jira [ 12591262 ]
        Mark Thomas made changes -
        Workflow jira [ 12436234 ] Default workflow, editable Closed status [ 12568179 ]
        Howard M. Lewis Ship made changes -
        Fix Version/s 5.0.14 [ 12313214 ]
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Howard M. Lewis Ship made changes -
        Summary Add a new method hasBody() to ComponentRessources Add new method hasBody() to ComponentResources, to reveal if component has a body or not
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Summary Add a new method hasBody() to ComponentRessource Add a new method hasBody() to ComponentRessources
        Martin Papy made changes -
        Field Original Value New Value
        Description Same idea as in Tapestry-2541 but in a much lighter way :

        In my case, I use the Layout pattern for rendering my pages, but depending on the situation, sometimes the body of the layout is empty. In that case I would like to display a generic content. So I imagine something like this :

        <t:if test="hasBody">
        Blah blah blah
        <t:parameter name="else">
        <t:body />
        </t:parameter>
        </t:if>

        But I don't know how to write the test "hasBody".

        HLS said this :

        "This is not currently possible, but that's mostly an API issue. The Tapestry component has, internally, its body (as an array of TemplateToken objects) and can determine if the body is empty or not. It's a bit more complicated to determine if a Mixin on the component may affect rendering of the body (by providing BeforeBody or AfterBody render phase methods). I could implement a method on ComponentResources: boolean hasBody(). Without an API change this will be difficult."

        Same idea as in Tapestry-2541 but in a much lighter way :

        In my case, I use the Layout pattern for rendering my pages, but depending on the situation, sometimes the body of the layout is empty. In that case I would like to display a generic content. So I imagine something like this :

        <t:if test="hasBody">
        Blah blah blah
        <t:parameter name="else">
        <t:body />
        </t:parameter>
        </t:if>

        But I don't know how to write the test "hasBody".
        Hide
        Martin Papy added a comment -

        HLS said this :

        "This is not currently possible, but that's mostly an API issue. The Tapestry component has, internally, its body (as an array of TemplateToken objects) and can determine if the body is empty or not. It's a bit more complicated to determine if a Mixin on the component may affect rendering of the body (by providing BeforeBody or AfterBody render phase methods). I could implement a method on ComponentResources: boolean hasBody(). Without an API change this will be difficult."

        Show
        Martin Papy added a comment - HLS said this : "This is not currently possible, but that's mostly an API issue. The Tapestry component has, internally, its body (as an array of TemplateToken objects) and can determine if the body is empty or not. It's a bit more complicated to determine if a Mixin on the component may affect rendering of the body (by providing BeforeBody or AfterBody render phase methods). I could implement a method on ComponentResources: boolean hasBody(). Without an API change this will be difficult."
        Martin Papy created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development