home · contact · privacy
Add VersionedAttributes history pages for Conditions.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 18 May 2024 03:01:16 +0000 (05:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 18 May 2024 03:01:16 +0000 (05:01 +0200)
plomtask/http.py
templates/condition.html
templates/condition_descriptions.html [new file with mode: 0644]
templates/condition_titles.html [new file with mode: 0644]
templates/process_efforts.html

index 2c7e628bdd14fd572a29c5686a5d3a5a37ceb409..88725fcc57b9ada06d2bb85a4744b489a8bf97e7 100644 (file)
@@ -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')
index 8e73e5ee5ec712f566271dc2ab8eb8347042048a..1fc5902025c7cc21a04a656880a973ed5b6ed312 100644 (file)
@@ -10,7 +10,7 @@
 
 <tr>
 <th>title</th>
-<td><input name="title" value="{{condition.title.newest|e}}" /></td>
+<td><input name="title" value="{{condition.title.newest|e}}" />{% if condition.id_ %} [<a href="condition_titles?id={{condition.id_}}">history</a>]{% endif %}</td>
 <tr/>
 
 <tr>
@@ -20,7 +20,7 @@
 
 <tr>
 <th>description</th>
-<td><input name="description" value="{{condition.description.newest|e}}" /></td>
+<td><textarea name="description">{{condition.description.newest|e}}</textarea>{% if condition.id_ %} [<a href="condition_descriptions?id={{condition.id_}}">history</a>]{% endif %}</td>
 <tr/>
 
 </table>
diff --git a/templates/condition_descriptions.html b/templates/condition_descriptions.html
new file mode 100644 (file)
index 0000000..17dd066
--- /dev/null
@@ -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 (file)
index 0000000..6ab8ca9
--- /dev/null
@@ -0,0 +1,8 @@
+{% extends '_base.html' %}
+{% import '_macros.html' as macros %}
+
+
+
+{% block content %}
+{{ macros.history_page("condition", condition, "title", condition.title) }}
+{% endblock %}
index bdfa7dd0547496a32625d3e29d97d592587be705..579ded1e0b9c15ab3350094caf7bb8e04e298ae9 100644 (file)
@@ -6,4 +6,3 @@
 {% block content %}
 {{ macros.history_page("process", process, "effort", process.effort) }}
 {% endblock %}
-