From: Christian Heller Date: Sat, 18 May 2024 02:47:49 +0000 (+0200) Subject: Add VersionedAttribute history display pages for Processes. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/error?a=commitdiff_plain;h=29969c2d0fb6c464662737df1da94f76dc2c0982;p=plomtask Add VersionedAttribute history display pages for Processes. --- diff --git a/plomtask/http.py b/plomtask/http.py index 98bb49f..2c7e628 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -94,8 +94,9 @@ class TaskHandler(BaseHTTPRequestHandler): """Handle any GET request.""" try: self._init_handling() - if self.site in {'calendar', 'day', 'process', 'processes', 'todo', - 'condition', 'conditions'}: + if self.site in {'calendar', 'day', 'process', 'process_titles', + 'process_descriptions', 'process_efforts', + 'processes', 'todo', 'condition', 'conditions'}: template = f'{self.site}.html' ctx = getattr(self, f'do_GET_{self.site}')() html = self.server.jinja.get_template(template).render(**ctx) @@ -156,7 +157,7 @@ class TaskHandler(BaseHTTPRequestHandler): return {'condition': Condition.by_id(self.conn, id_, create=True)} def do_GET_process(self) -> dict[str, object]: - """Show process of ?id=.""" + """Show Process of ?id=.""" id_ = self.params.get_int_or_none('id') process = Process.by_id(self.conn, id_, create=True) return {'process': process, @@ -165,6 +166,24 @@ class TaskHandler(BaseHTTPRequestHandler): 'step_candidates': Process.all(self.conn), 'condition_candidates': Condition.all(self.conn)} + def do_GET_process_titles(self) -> dict[str, object]: + """Show title history of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + + def do_GET_process_descriptions(self) -> dict[str, object]: + """Show description historys of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + + def do_GET_process_efforts(self) -> dict[str, object]: + """Show default effort history of Process of ?id=.""" + id_ = self.params.get_int_or_none('id') + process = Process.by_id(self.conn, id_) + return {'process': process} + def do_GET_processes(self) -> dict[str, object]: """Show all Processes.""" return {'processes': Process.all(self.conn)} diff --git a/templates/process.html b/templates/process.html index 5aebe53..d833c52 100644 --- a/templates/process.html +++ b/templates/process.html @@ -42,17 +42,17 @@ add: title - +{% if process.id_ %} [history]{% endif %} default effort - +{% if process.id_ %} [history]{% endif %} description - +
{% if process.id_ %} [history]{% endif %} diff --git a/templates/process_descriptions.html b/templates/process_descriptions.html new file mode 100644 index 0000000..f1b93cb --- /dev/null +++ b/templates/process_descriptions.html @@ -0,0 +1,23 @@ +{% extends '_base.html' %} + + + +{% block content %} +

process description history

+ + + + + + + +{% for date in process.description.history.keys() | sort(reverse=True) %} + + + + +{% endfor %} + +
process{{process.title.newest|e}}
{{date | truncate(19, True, '') }}
{{process.description.history[date]}}
+{% endblock %} + diff --git a/templates/process_efforts.html b/templates/process_efforts.html new file mode 100644 index 0000000..31efcc3 --- /dev/null +++ b/templates/process_efforts.html @@ -0,0 +1,23 @@ +{% extends '_base.html' %} + + + +{% block content %} +

process default effort history

+ + + + + + + +{% for date in process.effort.history.keys() | sort(reverse=True) %} + + + + +{% endfor %} + +
process{{process.title.newest|e}}
{{date | truncate(19, True, '') }}{{process.effort.history[date]}}
+{% endblock %} + diff --git a/templates/process_titles.html b/templates/process_titles.html new file mode 100644 index 0000000..574ef1c --- /dev/null +++ b/templates/process_titles.html @@ -0,0 +1,22 @@ +{% extends '_base.html' %} + + + +{% block content %} +

process title history

+ + + + + + + +{% for date in process.title.history.keys() | sort(reverse=True) %} + + + + +{% endfor %} + +
process{{process.title.newest|e}}
{{date | truncate(19, True, '') }}{{process.title.history[date]}}
+{% endblock %}