Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 05832912be7dd94e733cc3624e7668eecef9d4cf (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                                                                               
                                              







                                                                       
                                       
         


                                                                                
                                  
































                                                                                                                                              
                                                                                                                                                              








                                                                                                 
<!-- **************************************************************************
#
# Copyright  (c) 2004-2012 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors: 
#
#    Kohsuke Kawaguchi, Winston Prakash
#        
#************************************************************************** --> 


<?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>
    &lt;input type="checkbox"> tag that takes true/false for @checked, which is more Jelly friendly.

    <st:attribute name="name" />
    <st:attribute name="checked" />
    <st:attribute name="value" />
    <st:attribute name="json">
      Normally, the submitted JSON will be boolean indicating whether the checkbox was checked or not.
      This is sometimes inconvenient if you have a UI that lets user select a subset of a set.
      If this attribute is present, the submitted JSON will have this as a string value if the checkbox is checked,
      and none otherwise, making the subset selection easier.
    </st:attribute>
    <st:attribute name="default">
      The default value of the check box, in case both @checked and @instance are null.
      If this attribute is unspecified or null, it defaults to unchecked, otherwise checked.
    </st:attribute>
    <st:attribute name="id" />
    <st:attribute name="onclick" />
    <st:attribute name="class" />
    <st:attribute name="negative" />
    <st:attribute name="field">
      Used for databinding. TBD.
    </st:attribute>
    <st:attribute name="title">
      If specified, this human readable text will follow the checkbox, and clicking this text also
      toggles the checkbox.
    </st:attribute>
  </st:documentation>
  <f:prepareDatabinding />
  <input type="checkbox"
         name="${attrs.name?:'_.'+attrs.field}"
         value="${attrs.value}"
         onclick="${attrs.onclick}" id="${attrs.id}" class="${attrs.class} ${attrs.negative!=null ? 'negative' : null} ${attrs.checkUrl!=null?'validated':''}"
         checkUrl="${attrs.checkUrl}" json="${attrs.json}"
         checked="${(attrs.checked ?: instance[attrs.field] ?: attrs.default) ? 'true' : null}"/>
  <j:if test="${attrs.title!=null}">
    <label class="attach-previous">
      <j:whitespace> </j:whitespace>
      ${attrs.title}
    </label>
  </j:if>
</j:jelly>

Back to the top