avatar.html 1.6 KB

1234567891011121314151617181920212223242526
  1. {% removeemptylines %}
  2. {% assign src = include.src %}
  3. {% assign placeholder = include.placeholder %}
  4. {% if include.person-id %}
  5. {% assign person-id = include.person-id | minus: 1 %}
  6. {% assign person = site.data.people[person-id] %}
  7. {% assign src = person.photo %}
  8. {% unless src %}
  9. {% assign placeholder = person.full_name | first_letters %}
  10. {% endunless %}
  11. {% elsif include.person %}
  12. {% assign person = include.person %}
  13. {% assign src = person.photo %}
  14. {% unless src %}
  15. {% assign placeholder = person.full_name | first_letters %}
  16. {% endunless %}
  17. {% endif %}
  18. {% assign link = include.link | default: false %}
  19. {% if include.dropdown %}
  20. {% assign link = true %}
  21. {% endif %}
  22. {% assign el = 'span' %}
  23. {% if link %}{% assign el = 'a' %}{% endif %}
  24. <{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}{% if include.rounded %} rounded{% endif %}"{% if src %} style="background-image: url({{ site.base }}/{{ src }})"{% endif %}{% if include.dropdown %} data-bs-toggle="dropdown"{% endif %}>{% if include.status %}
  25. <span class="badge bg-{{ include.status }}">{% if include.status-text %}{{ include.status-text }}{% elsif include.status-icon %}{% include ui/icon.html icon=include.status-icon class="avatar-status-icon" %}{% endif %}</span>{% endif %}{% if placeholder %}{{ placeholder }}{% elsif include.icon %}{% include ui/icon.html icon=include.icon class="avatar-icon" %}{% endif %}</{{ el }}>
  26. {% endremoveemptylines %}