<script>
    function set_diabled() {
        $('input[name="visible:list"]').each(function(i, elem){
            var radio_cell = $(elem.parentNode.parentNode).find('input[name="default_tab"]');
            radio_cell.attr('disabled', !($(elem).is(':checked')));
            $(elem).attr('disabled', radio_cell.is(':checked'));
        });
    }
    $(document).ready(function() {
        set_diabled();
        $('input[name="default_tab"], input[name="visible:list"]').click(function(e) {
            set_diabled();
        });
    });
</script>
<div i18n:domain="schooltool">
  <form method="post"
        tal:attributes="action string:${context/@@absolute_url}/hide_unhide_tabs.html">
    <h3 i18n:translate="">Set Tab Visibility</h3>
    <table>
      <thead>
        <tr>
          <th i18n:translate="">Title</th>
          <th i18n:translate="">Visible</th>
          <th i18n:translate="">Default</th>
        </tr>
      </thead>
      <tr tal:repeat="tab view/tabs">
        <td>
          <span tal:content="tab/title" />
        </td>
        <td>
          <input type="checkbox" name="visible:list"
                 tal:attributes="value tab/name;
                                 checked tab/checked" />
        </td>
        <td>
          <input type="radio" name="default_tab"
                 tal:attributes="value tab/name;
                                 checked tab/default" />
        </td>
      </tr>
    </table>

    <div class="buttons controls">
      <input type="submit" class="button-ok" name="SUBMIT" value="Submit"
             i18n:attributes="value" />
      <tal:block metal:use-macro="view/@@standard_macros/cancel-button" />
    </div>
  </form>
</div>

