From: Christian Heller Date: Sat, 18 May 2024 01:40:54 +0000 (+0200) Subject: Add Todo.title shortcut to Todo.process.title for more template refactoring. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/todo?a=commitdiff_plain;h=9e297373770305a915dbe987bf6fda02db704ec6;p=plomtask Add Todo.title shortcut to Todo.process.title for more template refactoring. --- diff --git a/plomtask/todos.py b/plomtask/todos.py index a9bd94c..0313e55 100644 --- a/plomtask/todos.py +++ b/plomtask/todos.py @@ -5,6 +5,7 @@ from typing import Any from sqlite3 import Row from plomtask.db import DatabaseConnection, BaseModel from plomtask.processes import Process +from plomtask.versioned_attributes import VersionedAttribute from plomtask.conditions import Condition, ConditionsRelations from plomtask.exceptions import (NotFoundException, BadFormatException, HandledException) @@ -128,6 +129,11 @@ class Todo(BaseModel[int], ConditionsRelations): for condition in self.disables: condition.is_active = False + @property + def title(self) -> VersionedAttribute: + """Shortcut to .process.title.""" + return self.process.title + def adopt_from(self, todos: list[Todo]) -> bool: """As far as possible, fill unsatisfied dependencies from todos.""" adopted = False diff --git a/templates/day.html b/templates/day.html index da5e17a..ce16f28 100644 --- a/templates/day.html +++ b/templates/day.html @@ -177,5 +177,5 @@ add todo: -{{ macros.datalist_of_direct_titles("processes", processes) }} +{{ macros.datalist_of_titles("processes", processes) }} {% endblock %} diff --git a/templates/process.html b/templates/process.html index 41f8117..5aebe53 100644 --- a/templates/process.html +++ b/templates/process.html @@ -95,6 +95,6 @@ add: {{ macros.edit_buttons() }} -{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }} -{{ macros.datalist_of_direct_titles("step_candidates", step_candidates) }} +{{ macros.datalist_of_titles("condition_candidates", condition_candidates) }} +{{ macros.datalist_of_titles("step_candidates", step_candidates) }} {% endblock %} diff --git a/templates/todo.html b/templates/todo.html index d3957af..71f2e1b 100644 --- a/templates/todo.html +++ b/templates/todo.html @@ -54,23 +54,13 @@ children - - -{% for child in todo.children %} - - - - -{% endfor %} -
{{child.process.title.newest|e}}
-adopt: - +{{ macros.simple_checkbox_table("adopt", todo.children, "adopt", "todo_candidates", "adopt") }} {{ macros.edit_buttons() }} -{{ macros.datalist_of_direct_titles("condition_candidates", condition_candidates) }} -{{ macros.datalist_of_indirect_titles("todo_candidates", todo_candidates) }} +{{ macros.datalist_of_titles("condition_candidates", condition_candidates) }} +{{ macros.datalist_of_titles("todo_candidates", todo_candidates) }} {% endblock %}