Replace internal todos with Vikunja API wrapper
- New app/vikunja.py: get_tasks, create_task, update_task, delete_task - /todos page now reads from and writes to Vikunja (create, mark done, delete) - Auto-todos (clean build plate, filament low) post to Vikunja after DB commit - /api/todos router proxies to Vikunja - .env.install: VIKUNJA_URL, VIKUNJA_API_TOKEN, VIKUNJA_PROJECT_ID Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,39 +2,63 @@
|
||||
{% block title %}To-Do — POPS{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h5 class="text-white mb-4">To-Do</h5>
|
||||
<div class="d-flex align-items-center justify-content-between mb-4">
|
||||
<h5 class="text-white mb-0">To-Do</h5>
|
||||
</div>
|
||||
|
||||
{# ── Add task ── #}
|
||||
<form method="POST" action="/todos" class="mb-3 d-flex gap-2" style="max-width:480px">
|
||||
<input type="text" name="title" required
|
||||
class="form-control form-control-sm bg-dark border-secondary text-white"
|
||||
placeholder="New task…">
|
||||
<button type="submit" class="btn btn-sm btn-primary px-3">Add</button>
|
||||
</form>
|
||||
|
||||
<div class="card">
|
||||
{% if todos %}
|
||||
<table class="table table-dark table-hover mb-0 align-middle">
|
||||
<table class="table table-dark table-hover mb-0 align-middle" style="font-size:.875rem">
|
||||
<thead>
|
||||
<tr class="text-secondary small">
|
||||
<th class="fw-normal" style="width:32px"></th>
|
||||
<th class="fw-normal">Task</th>
|
||||
<th class="fw-normal">Printer</th>
|
||||
<th class="fw-normal text-center">Done</th>
|
||||
<th class="fw-normal text-end">Created</th>
|
||||
<th class="fw-normal" style="width:40px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in todos %}
|
||||
<tr class="{% if t.done %}opacity-50{% endif %}">
|
||||
<td class="{% if t.done %}text-decoration-line-through text-secondary{% else %}text-white{% endif %}">
|
||||
{{ t.title }}
|
||||
</td>
|
||||
<td class="text-secondary small">{{ t.printer.name if t.printer else '—' }}</td>
|
||||
<td class="text-center">
|
||||
{% if t.done %}
|
||||
{% set done = t.done %}
|
||||
<tr class="{% if done %}opacity-50{% endif %}">
|
||||
<td>
|
||||
{% if done %}
|
||||
<i class="bi bi-check-circle-fill text-success"></i>
|
||||
{% else %}
|
||||
<i class="bi bi-circle text-secondary"></i>
|
||||
<form method="POST" action="/todos/{{ t.id }}/done" class="m-0">
|
||||
<button type="submit" class="btn btn-link p-0 text-secondary" title="Mark done">
|
||||
<i class="bi bi-circle"></i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-secondary small text-end">{{ t.created_at.strftime('%d.%m.%Y') }}</td>
|
||||
<td class="{% if done %}text-decoration-line-through text-secondary{% else %}text-white{% endif %}">
|
||||
{{ t.title }}
|
||||
</td>
|
||||
<td class="text-secondary small text-end text-nowrap">
|
||||
{{ t.created[:10] if t.created else '—' }}
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" action="/todos/{{ t.id }}/delete" class="m-0 text-end">
|
||||
<button type="submit" class="btn btn-link p-0 text-secondary" title="Delete">
|
||||
<i class="bi bi-trash3"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="card-body text-secondary">No to-do items yet.</div>
|
||||
<div class="card-body text-secondary">No tasks. Nice.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user