05/27 Update template toggle function

This commit is contained in:
2026-05-27 11:25:45 -04:00
parent 0767bcaeee
commit 06bbfb7214
5 changed files with 84 additions and 4 deletions
+26 -3
View File
@@ -19,12 +19,17 @@
<div class="row">
{% for template in templates %}
<div class="col-md-6 col-lg-4 mb-4">
<div class="card shadow-sm h-100">
<div class="card shadow-sm h-100 {% if not template.active %}opacity-75 border-secondary{% endif %}">
<div class="card-body">
<h5 class="card-title">
<a href="{{ url_for('templates.view_template', template_id=template.id) }}" class="text-decoration-none">
<h5 class="card-title d-flex align-items-start gap-2">
<a href="{{ url_for('templates.view_template', template_id=template.id) }}" class="text-decoration-none flex-grow-1">
{{ template.name }}
</a>
{% if template.active %}
<span class="badge bg-success flex-shrink-0">Active</span>
{% else %}
<span class="badge bg-secondary flex-shrink-0">Inactive</span>
{% endif %}
</h5>
<p class="card-text text-muted small">{{ template.description or 'No description' }}</p>
<div class="mt-3">
@@ -66,6 +71,24 @@
</button>
</form>
<!-- Toggle active/inactive -->
<form method="POST"
action="{{ url_for('templates.toggle_active', template_id=template.id) }}"
class="d-inline">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if template.active %}
<button type="submit" class="btn btn-sm btn-outline-warning"
title="Deactivate template">
<i class="bi bi-pause-circle"></i> Deactivate
</button>
{% else %}
<button type="submit" class="btn btn-sm btn-outline-success"
title="Activate template">
<i class="bi bi-play-circle"></i> Activate
</button>
{% endif %}
</form>
<!-- Delete -->
<button type="button"
class="btn btn-sm btn-outline-danger ms-auto"