From 59d287e978856b33c47582f3c06bc7715ed1f085 Mon Sep 17 00:00:00 2001 From: Bernard Siebens Date: Fri, 21 Aug 2026 14:14:31 +0200 Subject: [PATCH] Factor the avatar-initials circle into a shared partial mobile/templates/mobile/_avatar.html replaces four copies of the same rounded-full/font-display/initials-slicing markup across event_detail.html, me.html (the account's own header avatar and each "People I manage" row), and news_detail.html's byline -- size/text/background stay parameterized per call site so nothing changes visually. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9 --- mobile/templates/mobile/_avatar.html | 11 +++++++++++ mobile/templates/mobile/event_detail.html | 2 +- mobile/templates/mobile/me.html | 4 ++-- mobile/templates/mobile/news_detail.html | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 mobile/templates/mobile/_avatar.html diff --git a/mobile/templates/mobile/_avatar.html b/mobile/templates/mobile/_avatar.html new file mode 100644 index 0000000..f4cb8e8 --- /dev/null +++ b/mobile/templates/mobile/_avatar.html @@ -0,0 +1,11 @@ +{% comment %} + Avatar-initials circle -- the one idiom repeated across every M-screen + (event_detail's "Your answers" rows, me.html's own header + "People I + manage" rows, news_detail's byline). Expects ``person`` (anything with + first_name/last_name) in scope; all other vars are optional and default + to the most common case (me.html's "People I manage" rows): + - size_class: the h-*/w-* pair, default "h-10 w-10" + - text_class: the initials' font size, default "text-sm" + - bg_class: the circle's background, default "bg-steel" +{% endcomment %} +{{ person.first_name|slice:":1" }}{{ person.last_name|slice:":1" }} diff --git a/mobile/templates/mobile/event_detail.html b/mobile/templates/mobile/event_detail.html index 59b2b05..63a9973 100644 --- a/mobile/templates/mobile/event_detail.html +++ b/mobile/templates/mobile/event_detail.html @@ -50,7 +50,7 @@ {% if not forloop.first %}
{% endif %}
- {{ answer.member.first_name|slice:":1" }}{{ answer.member.last_name|slice:":1" }} + {% include "mobile/_avatar.html" with person=answer.member size_class="h-8 w-8" %}
{{ answer.member.get_full_name }}
{% if answer.membership %} diff --git a/mobile/templates/mobile/me.html b/mobile/templates/mobile/me.html index f29ade9..c32754f 100644 --- a/mobile/templates/mobile/me.html +++ b/mobile/templates/mobile/me.html @@ -19,7 +19,7 @@
{% else %}