From: Christian Heller Date: Sat, 18 May 2024 03:01:16 +0000 (+0200) Subject: Add VersionedAttributes history pages for Conditions. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/todo?a=commitdiff_plain;h=53f151ef577dd8115e72d38a8991ad77c75f7e59;p=plomtask Add VersionedAttributes history pages for Conditions. --- diff --git a/plomtask/http.py b/plomtask/http.py index 2c7e628..88725fc 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -96,7 +96,9 @@ class TaskHandler(BaseHTTPRequestHandler): self._init_handling() if self.site in {'calendar', 'day', 'process', 'process_titles', 'process_descriptions', 'process_efforts', - 'processes', 'todo', 'condition', 'conditions'}: + 'processes', 'todo', 'condition', + 'condition_titles', 'condition_descriptions', + 'conditions'}: template = f'{self.site}.html' ctx = getattr(self, f'do_GET_{self.site}')() html = self.server.jinja.get_template(template).render(**ctx) @@ -156,6 +158,18 @@ class TaskHandler(BaseHTTPRequestHandler): id_ = self.params.get_int_or_none('id') return {'condition': Condition.by_id(self.conn, id_, create=True)} + def do_GET_condition_titles(self) -> dict[str, object]: + """Show title history of Condition of ?id=.""" + id_ = self.params.get_int_or_none('id') + condition = Condition.by_id(self.conn, id_) + return {'condition': condition} + + def do_GET_condition_descriptions(self) -> dict[str, object]: + """Show description historys of Condition of ?id=.""" + id_ = self.params.get_int_or_none('id') + condition = Condition.by_id(self.conn, id_) + return {'condition': condition} + def do_GET_process(self) -> dict[str, object]: """Show Process of ?id=.""" id_ = self.params.get_int_or_none('id') diff --git a/templates/condition.html b/templates/condition.html index 8e73e5e..1fc5902 100644 --- a/templates/condition.html +++ b/templates/condition.html @@ -10,7 +10,7 @@ title - +{% if condition.id_ %} [history]{% endif %} @@ -20,7 +20,7 @@ description - +{% if condition.id_ %} [history]{% endif %} diff --git a/templates/condition_descriptions.html b/templates/condition_descriptions.html new file mode 100644 index 0000000..17dd066 --- /dev/null +++ b/templates/condition_descriptions.html @@ -0,0 +1,8 @@ +{% extends '_base.html' %} +{% import '_macros.html' as macros %} + + + +{% block content %} +{{ macros.history_page("condition", condition, "description", condition.description, true) }} +{% endblock %} diff --git a/templates/condition_titles.html b/templates/condition_titles.html new file mode 100644 index 0000000..6ab8ca9 --- /dev/null +++ b/templates/condition_titles.html @@ -0,0 +1,8 @@ +{% extends '_base.html' %} +{% import '_macros.html' as macros %} + + + +{% block content %} +{{ macros.history_page("condition", condition, "title", condition.title) }} +{% endblock %} diff --git a/templates/process_efforts.html b/templates/process_efforts.html index bdfa7dd..579ded1 100644 --- a/templates/process_efforts.html +++ b/templates/process_efforts.html @@ -6,4 +6,3 @@ {% block content %} {{ macros.history_page("process", process, "effort", process.effort) }} {% endblock %} -