From fb317a554ed912736498a5b3917b40bb9bfd7489 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 29 Apr 2024 05:09:41 +0200
Subject: [PATCH] Enable Condition.is_active toggling in Condition view.

---
 plomtask/http.py         | 1 +
 templates/condition.html | 1 +
 2 files changed, 2 insertions(+)

diff --git a/plomtask/http.py b/plomtask/http.py
index 316fd08..196540a 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -287,6 +287,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             condition.remove(self.conn)
             return '/conditions'
         condition = Condition.by_id(self.conn, id_, create=True)
+        condition.is_active = self.form_data.get_all_str('is_active') != []
         condition.title.set(self.form_data.get_str('title'))
         condition.description.set(self.form_data.get_str('description'))
         condition.save(self.conn)
diff --git a/templates/condition.html b/templates/condition.html
index a0a9f45..92f04eb 100644
--- a/templates/condition.html
+++ b/templates/condition.html
@@ -5,6 +5,7 @@
 <form action="condition?id={{condition.id_ or ''}}" method="POST">
 title: <input name="title" value="{{condition.title.newest|e}}" />
 description: <input name="description" value="{{condition.description.newest|e}}" />
+is active: <input name="is_active" type="checkbox" {% if condition.is_active %}checked{% endif %} />
 
 <input class="btn-harmless" type="submit" name="update" value="update" />
 <div class="btn-to-right">
-- 
2.30.2