From 4c546e0133670dd10aec890c3cea6329c3a29663 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 6 Jun 2024 03:54:54 +0200 Subject: [PATCH] For Processes and Conditions, in edit page title warn if creation NEW. --- plomtask/http.py | 4 ++-- templates/condition.html | 2 +- templates/process.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plomtask/http.py b/plomtask/http.py index ea1358a..2d5db82 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -214,7 +214,7 @@ class TaskHandler(BaseHTTPRequestHandler): id_ = self.params.get_int_or_none('id') c = Condition.by_id(self.conn, id_, create=True) ps = Process.all(self.conn) - return {'condition': c, + return {'condition': c, 'is_new': c.id_ is None, 'enabled_processes': [p for p in ps if c in p.conditions], 'disabled_processes': [p for p in ps if c in p.blockers], 'enabling_processes': [p for p in ps if c in p.enables], @@ -240,7 +240,7 @@ class TaskHandler(BaseHTTPRequestHandler): if title_64: title = b64decode(title_64.encode()).decode() process.title.set(title) - return {'process': process, + return {'process': process, 'is_new': process.id_ is None, 'steps': process.get_steps(self.conn), 'owners': process.used_as_step_by(self.conn), 'n_todos': len(Todo.by_process_id(self.conn, process.id_)), diff --git a/templates/condition.html b/templates/condition.html index 6b28a52..b20b5fe 100644 --- a/templates/condition.html +++ b/templates/condition.html @@ -4,7 +4,7 @@ {% block content %} -

condition

+

{% if is_new %}NEW {% endif %}condition

diff --git a/templates/process.html b/templates/process.html index bc8d6e6..f073a57 100644 --- a/templates/process.html +++ b/templates/process.html @@ -40,7 +40,7 @@ add sub-step: process +

{% if is_new %}NEW {% endif %}process

-- 2.30.2