Let eligible referees self-serve sign-up for games needing one
Creating (or re-teaming) a home game for a club-managed team now auto- invites every eligible referee (teams.RefereeProfile) via a new RefereeSignup model, notifying them the same way news/events already do. They see it as its own distinct row on the mobile Calendar (own accent colour) and can accept or decline right there -- accepting routes through the existing capacity-checked assign_referee (assigned_by=None marks it self-service), so it lands as a real EventReferee row with no separate sync step. The desktop referee-management screen and event detail page both surface pending invites and flag self-signed-up referees distinctly from admin assignments. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
50
mobile/templates/mobile/_calendar_referee_row.html
Normal file
50
mobile/templates/mobile/_calendar_referee_row.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{% load i18n lucide %}
|
||||
{% comment %}
|
||||
One referee sign-up row on M3's Calendar -- a home game the signed-in
|
||||
account is eligible (and, once responded, confirmed) to referee for.
|
||||
Merged into the same chronological list as the account's own RSVP rows
|
||||
(mobile/_calendar_row.html), but in the referee accent (assets/mobile.
|
||||
css's --color-referee/.pill-referee) so it reads as a different kind of
|
||||
commitment at a glance -- and scoped to self.me only (mobile/views.py's
|
||||
CalendarView), never managed_people, since a referee is an adult acting
|
||||
on their own behalf, not something a parent does for a child.
|
||||
|
||||
Expects ``row`` ({event, referee_signup}) in scope. Accept/Decline are
|
||||
two small forms, not a single multi-button one, so hx-boost="false" can
|
||||
sit on each without a formaction/htmx-boost mismatch (see event_detail.
|
||||
html's own top-of-file comment for that failure mode).
|
||||
{% endcomment %}
|
||||
<div class="flex items-center gap-3 bg-white px-4 py-3">
|
||||
<div class="w-9.5 shrink-0 text-center">
|
||||
<div class="font-mono text-[10px] tracking-wide text-muted uppercase">{{ row.event.start|date:"D" }}</div>
|
||||
<div class="font-display text-2xl leading-none font-extrabold text-ink">{{ row.event.start|date:"d" }}</div>
|
||||
</div>
|
||||
<div class="w-[3px] shrink-0 self-stretch rounded-full" style="background: var(--color-referee)"></div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex items-center gap-1 text-sm font-semibold text-ink">
|
||||
{% lucide "flag" size=13 stroke_width=2.4 class="shrink-0 text-referee" %}
|
||||
<span class="truncate">{% trans "Referee" %} · {{ row.event.title }}</span>
|
||||
</div>
|
||||
<div class="truncate text-xs text-muted">
|
||||
{{ row.event.start|date:"H:i" }}
|
||||
{% for team in row.event.teams.all %}· {{ team.name }}{% endfor %}
|
||||
{% if row.event.location %}· {{ row.event.location.name }}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if row.referee_signup.status == "accepted" %}
|
||||
<span class="pill pill-referee shrink-0">{% trans "Confirmed" %}</span>
|
||||
{% else %}
|
||||
<div class="flex shrink-0 gap-1.5">
|
||||
<form method="post" action="{% url "mobile:referee_signup_respond" row.referee_signup.pk %}" hx-boost="false">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="response" value="accept">
|
||||
<button type="submit" class="pill pill-referee">{% trans "I'll ref" %}</button>
|
||||
</form>
|
||||
<form method="post" action="{% url "mobile:referee_signup_respond" row.referee_signup.pk %}" hx-boost="false">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="response" value="decline">
|
||||
<button type="submit" class="pill pill-neutral">{% trans "Can't" %}</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -7,7 +7,10 @@
|
||||
everything further out grouped by calendar month (see CalendarView's own
|
||||
docstring -- later_months is a list of {month_start, rows}). No person
|
||||
switcher and no club-wide toggle here -- always every event
|
||||
self.managed_people is invited to, full stop. A real, working ?kind=
|
||||
self.managed_people is invited to, plus (merged into the same
|
||||
chronological list, own accent colour) any home game self.me is
|
||||
eligible to referee -- see mobile/_calendar_referee_row.html. A real,
|
||||
working ?kind=
|
||||
filter (All/Games/Practices) stands in for the design mock's "Games only"
|
||||
pill; its List/Month toggle isn't reproduced -- that's a second view
|
||||
mode, not a filter. -mx-4 (on the row groups only, not this filter row)
|
||||
@@ -60,7 +63,7 @@
|
||||
<div class="sticky top-0 z-10 bg-paper px-4 py-2 font-display text-xs font-extrabold tracking-wide text-muted uppercase">{% trans "This week" %}</div>
|
||||
<div class="flex flex-col gap-px bg-line">
|
||||
{% for row in this_week %}
|
||||
{% include "mobile/_calendar_row.html" %}
|
||||
{% if row.referee_signup %}{% include "mobile/_calendar_referee_row.html" %}{% else %}{% include "mobile/_calendar_row.html" %}{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,7 +74,7 @@
|
||||
<div class="sticky top-0 z-10 bg-paper px-4 py-2 font-display text-xs font-extrabold tracking-wide text-muted uppercase">{% trans "Next week" %}</div>
|
||||
<div class="flex flex-col gap-px bg-line">
|
||||
{% for row in next_week %}
|
||||
{% include "mobile/_calendar_row.html" %}
|
||||
{% if row.referee_signup %}{% include "mobile/_calendar_referee_row.html" %}{% else %}{% include "mobile/_calendar_row.html" %}{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,7 +85,7 @@
|
||||
<div class="sticky top-0 z-10 bg-paper px-4 py-2 font-display text-xs font-extrabold tracking-wide text-muted uppercase">{{ month.month_start|date:"F Y" }}</div>
|
||||
<div class="flex flex-col gap-px bg-line">
|
||||
{% for row in month.rows %}
|
||||
{% include "mobile/_calendar_row.html" %}
|
||||
{% if row.referee_signup %}{% include "mobile/_calendar_referee_row.html" %}{% else %}{% include "mobile/_calendar_row.html" %}{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user