home · contact · privacy
Allow creation of new Todos rather than just adoption from Todo edit view.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 6 Jun 2024 05:30:02 +0000 (07:30 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 6 Jun 2024 05:30:02 +0000 (07:30 +0200)
plomtask/http.py
templates/todo.html

index 773548f8a9201e3e48ab8093b6431ab826842110..1a06f3094c9c66a95f73b9a13e52d7618d3b2aaa 100644 (file)
@@ -156,6 +156,7 @@ class TaskHandler(BaseHTTPRequestHandler):
         id_ = self.params.get_int('id')
         todo = Todo.by_id(self.conn, id_)
         return {'todo': todo,
+                'process_candidates': Process.all(self.conn),
                 'todo_candidates': Todo.by_date(self.conn, todo.date),
                 'condition_candidates': Condition.all(self.conn)}
 
@@ -359,6 +360,9 @@ class TaskHandler(BaseHTTPRequestHandler):
                 continue
             child = Todo.by_id(self.conn, child_id)
             todo.add_child(child)
+        for process_id in self.form_data.get_all_int('make'):
+            made = Todo.create_with_children(self.conn, process_id, todo.date)
+            todo.add_child(made)
         effort = self.form_data.get_str('effort', ignore_strict=True)
         todo.effort = float(effort) if effort else None
         todo.set_conditions(self.conn, self.form_data.get_all_int('condition'))
index a2ef536eaf8230b21be7d3049db878a5a34c7cec..870eab35dd91449e367d15f4ca3c4bc1d95ae806 100644 (file)
@@ -69,7 +69,8 @@
 
 <tr>
 <th>children</th>
-<td>{{ macros.simple_checkbox_table("adopt", todo.children, "todo", "todo_candidates", "adopt", true) }}</td>
+<td>{{ macros.simple_checkbox_table("adopt", todo.children, "todo", "todo_candidates", "adopt", true) }}<br />
+make: <input name="make" list="process_candidates" autocomplete="off" /></td>
 </tr>
 
 </table>
@@ -77,6 +78,7 @@
 </form>
 
 {{ macros.datalist_of_titles("condition_candidates", condition_candidates) }}
+{{ macros.datalist_of_titles("process_candidates", process_candidates) }}
 <datalist id="todo_candidates">
 {% for candidate in todo_candidates %}
 <option value="{{candidate.id_}}">{{candidate.title.newest|e}} {{candidate.comment|e}}</option>