Add a home-location box to the club detail page in the control panel
Setting a club's home ground here creates/updates the same events.Location row (flagged is_home) that the club's own Teams > Locations page shows and edits -- no separate sync step, it's the same record either way. Also fixes the shared form_field templatetag: django-countries' CountryField widget reports as "lazyselect", which fell through to a broken plain text input instead of rendering as a dropdown. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R1gj3J1QPfP38XWpnpbFpy
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{% load lucide %}
|
||||
|
||||
{% comment %}
|
||||
The club's home ground -- an events.Location row flagged is_home, so setting or
|
||||
editing it here creates/updates the very same Location the club's own Teams >
|
||||
Locations page shows, no separate sync step involved. Included with `club`,
|
||||
`home_location`, `home_location_form` already in context.
|
||||
{% endcomment %}
|
||||
<div class="card mb-6 bg-base-100 shadow">
|
||||
<div class="card-body">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="card-title text-base">{% lucide "map-pin" size=18 %} Home location</h2>
|
||||
<button class="btn btn-primary btn-sm gap-2" type="button" onclick="document.getElementById('club_home_location_modal').showModal()">
|
||||
{% if home_location %}
|
||||
{% lucide "pencil" size=16 %} Edit
|
||||
{% else %}
|
||||
{% lucide "plus" size=16 %} Set home location
|
||||
{% endif %}
|
||||
</button>
|
||||
</div>
|
||||
{% if home_location %}
|
||||
<dl class="divide-y divide-base-200">
|
||||
<div class="flex items-center justify-between py-2">
|
||||
<dt class="text-sm opacity-70">Name</dt>
|
||||
<dd class="font-semibold">{{ home_location.name }}</dd>
|
||||
</div>
|
||||
<div class="flex items-center justify-between py-2">
|
||||
<dt class="text-sm opacity-70">Address</dt>
|
||||
<dd>{{ home_location.address }}, {{ home_location.zip_code }} {{ home_location.city }}, {{ home_location.country }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
{% else %}
|
||||
<p class="text-sm opacity-60">Not set yet. Once set, events at this location can be recognised as home games.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% url 'controlpanel:club_home_location_set' club.pk as home_location_url %}
|
||||
{% include "controlpanel/_modal_form.html" with modal_id="club_home_location_modal" title="Home location" form=home_location_form action_url=home_location_url submit_label="Save" submit_icon="save" blurb="This creates or updates a Location for the club -- the same one that shows up on its own Teams > Locations page." %}
|
||||
@@ -194,12 +194,14 @@
|
||||
</div>
|
||||
{% include "controlpanel/_club_features_card.html" %}
|
||||
{% include "controlpanel/_club_billing_card.html" %}
|
||||
{% include "controlpanel/_club_home_location_card.html" %}
|
||||
{% include "controlpanel/_club_admins_card.html" %}
|
||||
{% endblock panel %}
|
||||
|
||||
{% block extra_body %}
|
||||
{{ charts|json_script:"chart-data" }}
|
||||
<script src="{% static 'js/chart.js' %}"></script>
|
||||
<script src="{% static 'js/searchable-select.js' %}"></script>
|
||||
<script>
|
||||
(() => {
|
||||
const data = JSON.parse(document.getElementById("chart-data").textContent);
|
||||
|
||||
Reference in New Issue
Block a user