Extract dashboard row and sync-all form into reusable partials
These render the initial dashboard page today and will also be rendered standalone by the sync routes in the next commits, so the same markup drives both the full page and the post-sync response. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
5
app/web/templates/fragments/sync_all_form.html
Normal file
5
app/web/templates/fragments/sync_all_form.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<form method="post" action="/sync-all" class="inline-form"
|
||||
hx-post="/sync-all" hx-target="this" hx-swap="outerHTML" hx-disabled-elt="find button">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">Sync all now</button>
|
||||
</form>
|
||||
3
app/web/templates/fragments/toast.html
Normal file
3
app/web/templates/fragments/toast.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<div id="toast-container" hx-swap-oob="true">
|
||||
<div class="toast toast-{{ level }}">{{ message }}</div>
|
||||
</div>
|
||||
24
app/web/templates/fragments/user_row.html
Normal file
24
app/web/templates/fragments/user_row.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<li class="card user-card" id="user-row-{{ row.id }}"{% if oob %} hx-swap-oob="true"{% endif %}>
|
||||
<div class="user-main">
|
||||
<a class="user-name" href="/users/{{ row.id }}">{{ row.name }}</a>
|
||||
<div class="user-meta">
|
||||
<span class="badge badge-{{ row.health_state }}">{{ row.health_state.replace("_", " ") }}</span>
|
||||
<span>{{ "enabled" if row.enabled else "disabled" }}</span>
|
||||
<span>last sync: {{ row.last_sync_at or "-" }}</span>
|
||||
<span>last activity: {{ row.last_activity_name or "-" }} ({{ row.last_activity_status or "-" }})</span>
|
||||
</div>
|
||||
{% if row.action_reason == "garmin_mfa_required" %}
|
||||
<span class="action-required">Garmin MFA required — <a href="/users/{{ row.id }}">resolve</a></span>
|
||||
{% elif row.action_reason == "mywhoosh_device_conflict" %}
|
||||
<span class="action-required">MyWhoosh account logged in on another device — log out there, then <a href="/users/{{ row.id }}">retry</a></span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="user-actions">
|
||||
<form method="post" action="/users/{{ row.id }}/sync" class="inline-form"
|
||||
hx-post="/users/{{ row.id }}/sync" hx-target="closest .user-card" hx-swap="outerHTML"
|
||||
hx-disabled-elt="find button">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit" class="secondary">Sync now</button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
Reference in New Issue
Block a user