avatar.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {%- assign src = include.src -%}
  2. {%- assign placeholder = include.placeholder -%}
  3. {%- if include.person-id -%}
  4. {%- assign person-id = include.person-id | minus: 1 -%}
  5. {%- assign person = people[person-id] -%}
  6. {%- assign src = person.photo -%}
  7. {%- unless src -%}
  8. {%- assign placeholder = person.full_name | first_letters -%}
  9. {%- endunless -%}
  10. {%- elsif include.person -%}
  11. {%- assign person = include.person -%}
  12. {%- assign src = person.photo -%}
  13. {%- unless src -%}
  14. {%- assign placeholder = person.full_name | first_letters -%}
  15. {%- endunless -%}
  16. {%- endif -%}
  17. {%- assign link = include.link | default: false -%}
  18. {%- if include.dropdown -%}
  19. {%- assign link = true -%}
  20. {%- endif -%}
  21. {%- assign el = 'span' -%}
  22. {%- if link -%}{%- assign el = 'a' -%}{%- endif -%}
  23. <{{ 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 src %} style="background-image: url({{ page | relative }}/{{ src }})"{% endif %}{% if include.dropdown %} data-bs-toggle="dropdown"{% endif %}>
  24. {%- 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>
  26. {%- endif -%}
  27. {%- if include.brand -%}
  28. <span class="avatar-brand" style="background-image: url({{ page | relative }}/static/brands/{{ include.brand }}.svg);"></span>
  29. {%- endif -%}
  30. {% if src %}
  31. {% elsif placeholder %}
  32. {{ placeholder }}
  33. {% elsif include.icon %}
  34. {% include "ui/icon.html" icon=include.icon class="avatar-icon" %}
  35. {% else %}
  36. {% include "ui/icon.html" icon="user" class="avatar-icon" %}
  37. {% endif %}
  38. </{{ el }}>