[% IF profile_user.teams.size == 0 %]
  &lt;none&gt;
[% ELSE %]
  <table class="w-full rowhover">
    [%- show_max = 3 -%]
    [%- has_more = 0; IF profile_user.teams.size > show_max; has_more = 1; END -%]
    [%- has_admin = c.check_user_roles("admin") -%]
    [%- FOREACH t = profile_user.teams.sort -%]
      <tr[% IF has_more && loop.index >= show_max %] style="display: none;" class="js-hidden_teams"[% END %]>
        <td class="align-top">
          [%- IF has_admin -%]
            <a class="link" href="conf.cgi?sub=teams&action=edit&team=[% t | uri %]">[% t | html %]</a>
          [%- ELSE -%]
            [%- t | html -%]
          [%- END -%]
          [%- IF !loop.last %], [% END -%]
        </td>
      </tr>
    [% END %]
    [% IF has_more  %]
      <tr class="js-show_teams">
        <td class="align-top clickable hoverable rounded" colspan="2" onclick="jQuery('.js-hidden_teams').show(); jQuery('.js-show_teams').hide(); jQuery('.js-show_less_teams').show();">
          <i class="uil uil-angle-down"></i>show all [% profile_user.teams.size %] teams...
        </td>
      </tr>
      <tr class="js-show_less_teams" style="display: none;">
        <td class="align-top clickable hoverable rounded" colspan="2" onclick="jQuery('.js-hidden_teams').hide(); jQuery('.js-show_teams').show(); jQuery('.js-show_less_teams').hide();">
          <i class="uil uil-angle-up"></i>show less...
        </td>
      </tr>
    [% END %]
  </table>
[% END %]
