Batman
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
{# Expects: events, csrf, old, errors (all optional) #}
|
||||
{% if events %}
|
||||
<table class="events-table">
|
||||
<thead>
|
||||
<tr><th>When</th><th>Type</th><th>Miles</th><th>Cost</th><th>Notes</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for ev in events %}
|
||||
<tr>
|
||||
<td>{{ ev.event_date }}</td>
|
||||
<td><span class="tag tag-{{ ev.type }}">{{ ev.type }}</span></td>
|
||||
<td>{% if ev.mileage is not none %}{{ ev.mileage | money }}{% else %}-{% endif %}</td>
|
||||
<td>{{ ev.cost | money if ev.cost is not none else '-' }}</td>
|
||||
<td class="notes">{{ ev.notes or '' }}</td>
|
||||
<td class="row-actions">
|
||||
<form method="post" action="/events/{{ ev.id }}/delete"
|
||||
onsubmit="if(!confirm('Delete this event?'))return false;">
|
||||
<input type="hidden" name="csrf" value="{{ csrf }}">
|
||||
<button class="btn btn-link btn-danger" type="submit" aria-label="Delete event">×</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="muted">No events yet. Log your first one below.</p>
|
||||
{% endif %}
|
||||
{% if errors %}
|
||||
<div class="alert alert-error" style="margin-top:1rem">
|
||||
{% for key, val in errors.items() %}<div>{{ val }}</div>{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,11 @@
|
||||
{# HTMX swap target for POST /bikes/{id}/events (swaps into #bike-body).
|
||||
Expects: bike, summary, events, old, errors, csrf, event_types. #}
|
||||
{% include "components/service_card.html" with context %}
|
||||
<section class="card list-card">
|
||||
{% include "events/list.html" with context %}
|
||||
</section>
|
||||
{% if errors %}
|
||||
<div id="form-errors" class="alert alert-error" role="alert">
|
||||
{% for key, val in errors.items() %}<div>{{ val }}</div>{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user