src/main/resources/lib/custom/customOptionalBlock.jelly
<!--
~ MIT License
~
~ Copyright 2012-2024 Open Text
~
~ The only warranties for products and services of Open Text and
~ its affiliates and licensors ("Open Text") are as may be set forth
~ in the express warranty statements accompanying such products and services.
~ Nothing herein should be construed as constituting an additional warranty.
~ Open Text shall not be liable for technical or editorial errors or
~ omissions contained herein. The information contained herein is subject
~ to change without notice.
~
~ Except as specifically indicated otherwise, this document contains
~ confidential information and a valid license is required for possession,
~ use or copying. If this work is provided to the U.S. Government,
~ consistent with FAR 12.211 and 12.212, Commercial Computer Software,
~ Computer Software Documentation, and Technical Data for Commercial Items are
~ licensed to the U.S. Government under vendor's standard commercial license.
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~ ___________________________________________________________________
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation>
Foldable block that can be expanded to show more controls by checking the checkbox.
<st:attribute name="name">
Name of the checkbox. Can be used by the server to determine
if the block is collapsed or expanded at the time of submission.
Note that when the block is collapsed, none of its child controls will send
the values to the server (unlike <f:advanced>)
</st:attribute>
<st:attribute name="title">
Human readable text that follows the checkbox.
If this field is null, the checkbox degrades to a <f:rowSet>, which provides
a grouping at JSON level but on the UI there's no checkbox (and you always see
the body of it.)
</st:attribute>
<st:attribute name="field">
Used for databinding. TBD. Either this or @name/@title combo is required.
</st:attribute>
<st:attribute name="checked">
initial checkbox status. true/false.
</st:attribute>
<st:attribute name="help">
If present, the (?) icon will be rendered on the right to show inline help.
See @help for <f:entry>.
</st:attribute>
<st:attribute name="negative">
if present, the foldable section expands when the checkbox is unchecked.
</st:attribute>
<st:attribute name="inline">
if present, the foldable section will not be grouped into a separate JSON object upon submission
</st:attribute>
</st:documentation>
<script type="text/javascript" src="${rootURL}/plugin/hp-application-automation-tools-plugin/parallelRunnerEnvironment.js"/>
<j:if test="${attrs.help == null and attrs.field != null}">
<!-- infer the help page from the current descriptor and field if possible -->
<j:set target="${attrs}" property="help"
value="${descriptor.getHelpFile(attrs.field)}" />
</j:if>
<j:choose>
<j:when test="${attrs.title!=null}">
<div class="optionalBlock-container">
<div class="help-sibling tr optional-block-start row-group-start ${attrs.inline?'':'row-set-start'}" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
<div colspan="3">
<f:checkbox name="${attrs.name}" class="optional-block-control block-control" onclick="javascript:updateOptionalBlock(this,true);setViewVisibility()"
negative="${attrs.negative}" checked="${attrs.checked}" field="${attrs.field}" title="${title}" />
<f:helpLink url="${attrs.help}" featureName="${title}"/>
</div>
</div>
<j:if test="${attrs.help!=null}">
<f:helpArea />
</j:if>
<div class="rowvg-start tr"></div>
<div class="form-container tr">
<d:invokeBody />
</div>
<!-- end marker -->
<div class="tr ${attrs.inline?'':'row-set-end'} rowvg-end optional-block-end row-group-end"></div>
</div>
</j:when>
<j:otherwise>
<f:rowSet name="${attrs.name}">
<d:invokeBody />
</f:rowSet>
</j:otherwise>
</j:choose>
</j:jelly>