/hudson-core/src/main/resources/lib/form/descriptorRadioList.jelly
http://github.com/hudson/hudson · Unknown · 63 lines · 56 code · 7 blank · 0 comment · 0 complexity · e83d54d7b51b6b2548a869b2a8bb1a8a MD5 · raw file
- <!--
- The MIT License
- Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- -->
- <?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>
- Generate config pages from a list of Descriptors into a section.
- <st:attribute name="title" use="required">
- Human readable title of the section to be rendered in HTML.
- </st:attribute>
- <st:attribute name="descriptors" use="required">
- hudson.model.Descriptor collection whose configuration page is rendered.
- </st:attribute>
- <st:attribute name="instance" use="required">
- The currently configured instance used to fill the initial values of the form.
- </st:attribute>
- <st:attribute name="targetType">
- the type for which descriptors will be configured.
- default to ${it.class}
- </st:attribute>
- <st:attribute name="varName" use="required">
- Used as a variable name as well as block name.
- </st:attribute>
- </st:documentation>
- <j:set var="targetType" value="${attrs.targetType?:it.class}"/>
- <f:section title="${attrs.title}">
- <d:invokeBody />
- <j:forEach var="d" items="${descriptors}" varStatus="loop">
- <f:radioBlock name="${varName}" help="${d.helpFile}" value="${loop.index}"
- title="${d.displayName}" checked="${instance.descriptor==d}">
- <j:set var="descriptor" value="${d}" />
- <j:set var="instance" value="${instance.descriptor==d?instance:null}" />
- <f:invisibleEntry>
- <input type="hidden" name="stapler-class" value="${descriptor.clazz.name}"/>
- </f:invisibleEntry>
- <st:include from="${d}" page="${d.configPage}" optional="true" />
- </f:radioBlock>
- </j:forEach>
- </f:section>
- </j:jelly>