Files
Rolf 06995c5668 Remove manual course creation; import-only with per-tee stroke indices
Courses can now only be added via Golf Course API import, which
provides the full data model: per-tee slope/rating/gender/SI
(stroke_indices JSON) and front/back split ratings. Manual creation
required admins to enter SI by hand and didn't match the API model.

Changes:
- Remove GET/POST /admin/courses/new routes and new_course.html
- Remove _parse_hole_form helper (no longer needed)
- Edit course: par-only editing; stroke_index preserved from import,
  not exposed or overwritten in the admin form
- courses.html: replace "+ New course" with "+ Import course" button
- course_search.html: remove "+ Manual" shortcut
- edit_course.html: remove SI column from hole grid

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 20:03:19 +01:00

57 lines
2.0 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}Courses Skins &amp; Pins{% endblock %}
{% block content %}
<div class="page">
<div class="page-header">
<h1>⚙️ Admin</h1>
</div>
<div class="admin-subnav">
<a href="/admin" class="admin-subnav-item">Users</a>
<a href="/admin/courses" class="admin-subnav-item active">Courses</a>
<a href="/admin/games" class="admin-subnav-item">Games</a>
</div>
{% if request.query_params.get('success') %}
<div class="alert alert-success">{{ request.query_params.get('success') }}</div>
{% endif %}
<div style="display:flex; gap:0.5rem; justify-content:flex-end; margin-bottom:1rem;">
<a href="/admin/courses/search" class="btn btn-primary" style="width:auto; padding:0.5rem 1rem;">+ Import course</a>
</div>
{% if courses %}
<div class="card" style="padding:0;">
<table class="data-table" style="margin:0;">
<thead>
<tr><th>Course</th><th>Holes</th><th>Location</th><th></th></tr>
</thead>
<tbody>
{% for c in courses %}
<tr>
<td style="font-weight:500;">{{ c.name }}</td>
<td style="color:var(--text-muted);">{{ c.holes }}</td>
<td style="color:var(--text-muted);">{{ c.location or '—' }}</td>
<td style="white-space:nowrap;">
<a href="/admin/courses/{{ c.id }}/edit" class="btn-table-action">Edit</a>
<form method="post" action="/admin/courses/{{ c.id }}/delete" style="display:inline;"
onsubmit="return confirm('Delete {{ c.name }}? This cannot be undone.')">
<button type="submit" class="btn-table-action danger">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="empty-state">
<div class="empty-icon"></div>
<p>No courses yet.</p>
<a href="/admin/courses/search" class="btn btn-primary" style="margin-top:1rem; max-width:200px;">Import a course</a>
</div>
{% endif %}
</div>
{% endblock %}