<tal:comment replace="nothing">View macro for a Boolean.</tal:comment>
<metal:view define-macro="view">
  <span tal:replace="value"></span>
  <input type="hidden" tal:condition="masterCss"
         tal:attributes="class masterCss; value rawValue; name name; id name"/>
</metal:view>

<tal:comment replace="nothing">Edit macro for an Boolean.</tal:comment>
<metal:edit define-macro="edit">
  <input type="checkbox"
    tal:attributes="name python: name + '_visible'; id name;
                    checked python:contextObj.checkboxChecked(name, rawValue);
                    onClick python:'toggleCheckbox(\'%s\', \'%s_hidden\');;updateSlaves(this)' % (name, name);
                    class masterCss"/>
  <input type="hidden"
    tal:attributes="name name;
                    id string:${name}_hidden;
                    value python: test(contextObj.checkboxChecked(name, rawValue), 'True', 'False')"/>
</metal:edit>

<tal:comment replace="nothing">Cell macro for an Boolean.</tal:comment>
<metal:cell define-macro="cell">
  <metal:call use-macro="app/ui/widgets/boolean/macros/view"/>
</metal:cell>

<tal:comment replace="nothing">Search macro for an Boolean.</tal:comment>
<metal:search define-macro="search"
              tal:define="typedWidget python:'%s*bool' % widgetName">
  <label tal:attributes="for widgetName" tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
  <tal:yes define="valueId python:'%s_yes' % name">
    <input type="radio" value="True" tal:attributes="name typedWidget; id valueId"/>
    <label tal:attributes="for valueId" tal:content="python: _('yes')"></label>
  </tal:yes>
  <tal:no define="valueId python:'%s_no' % name">
    <input type="radio" value="False" tal:attributes="name typedWidget; id valueId"/>
    <label tal:attributes="for valueId" tal:content="python: _('no')"></label>
  </tal:no>
  <tal:whatever define="valueId python:'%s_whatever' % name">
    <input type="radio" value="" tal:attributes="name typedWidget; id valueId" checked="checked"/>
    <label tal:attributes="for valueId" tal:content="python: _('whatever')"></label>
  </tal:whatever><br/>
</metal:search>
