<tal:principal tal:define="
                 is_group python: here.portal_type == 'ploneintranet.userprofile.workgroup';
                 is_contact python: here.portal_type == 'ploneintranet.contacts.contact';
                 is_emergency_service python: getattr(here, 'friendly_type_name', None) == 'Emergency Service' or getattr(here, 'contact_type', None) == 'emergency-service';
                 url here/absolute_url|here/getURL;
                 here_id here/getId;
                 title here/Title;
                 description here/description;
               "
               i18n:domain="ploneintranet"
>
  <label class="item group user-group ${python:'has-description' if description else 'has-no-description'}"
         tal:condition="is_group"
  >
    <a class="follow pat-inject pat-switch"
       href="${url}"
       data-pat-inject="source: #document-body; target: #document-body; scroll: top; history: record"
       data-pat-switch="#application-body focus-* focus-document &amp;&amp; #application-body sidebar-large sidebar-normal"
    >
      <img class="group-badge"
           alt=""
           src="${url}/@@logo.jpg"
           tal:condition="here/has_thumbs"
      />
      <strong class="title">${python: title or here_id}</strong>
      <tal:description condition="description">
        <br />
        <dfn class="byline">${description}</dfn>
      </tal:description>
    </a>
  </label>
  <label class="item user has-no-description unchecked"
         tal:define="
           proto nocall:here/@@proto;
         "
         tal:condition="python: not is_group and not is_contact"
  >
    <a class="follow pat-inject pat-switch"
       href="${url}"
       data-pat-inject="source: #document-body; target: #document-body; scroll: top; history: record"
       data-pat-switch="#application-body focus-* focus-document &amp;&amp; #application-body sidebar-large sidebar-normal"
    >
      <tal:avatar replace="structure python:proto.get_avatar_tag(here_id)" />
      <strong class="title">${python: title or here_id}</strong>
    </a>
  </label>
  <tal:emergency_service tal:condition="is_emergency_service">
    <label class="item emergency-service ${css_extra}"
           tal:define="
             obj python: here.getObject();
             service_icon here/service_icon|obj/service_icon|nothing;
             css_extra python: 'has-description' if here.contact_telephone else '';
           "
    >
      <a class="follow pat-inject pat-switch icon-${service_icon}"
         href="${url}/@@contact-view"
         data-pat-inject="source: #document-body; target: #document-body; scroll: top; history: record"
         data-pat-switch="#application-body focus-* focus-document &amp;&amp; #application-body sidebar-large sidebar-normal"
      >
        <strong class="title">${python: title or here_id}</strong>
        <br />
        <dfn class="byline"
             tal:condition="here/contact_telephone"
        >${here/contact_telephone}</dfn>
      </a>
    </label>
  </tal:emergency_service>
</tal:principal>
